hasktorch-gradually-typed-0.2.0.0: experimental project for hasktorch
Safe HaskellSafe-Inferred
LanguageHaskell2010

Torch.GraduallyTyped.NN.Initialization

Synopsis

Documentation

data ForNonLinearity Source #

Note: Identity = linear w/o activation

Instances

Instances details
Generic ForNonLinearity Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Initialization

Associated Types

type Rep ForNonLinearity :: Type -> Type Source #

Show ForNonLinearity Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Initialization

Eq ForNonLinearity Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Initialization

Ord ForNonLinearity Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Initialization

type Rep ForNonLinearity Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Initialization

type Rep ForNonLinearity = D1 ('MetaData "ForNonLinearity" "Torch.GraduallyTyped.NN.Initialization" "hasktorch-gradually-typed-0.2.0.0-1KV1aIPzzbp6JpSr37tC1K" 'False) ((C1 ('MetaCons "ForIdentity" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ForSigmoid" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ForTanh" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ForRelu" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ForLeakyRelu" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Float)))))

data FanMode Source #

Constructors

FanIn 
FanOut 

Instances

Instances details
Generic FanMode Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Initialization

Associated Types

type Rep FanMode :: Type -> Type Source #

Show FanMode Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Initialization

Eq FanMode Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Initialization

Ord FanMode Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Initialization

type Rep FanMode Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Initialization

type Rep FanMode = D1 ('MetaData "FanMode" "Torch.GraduallyTyped.NN.Initialization" "hasktorch-gradually-typed-0.2.0.0-1KV1aIPzzbp6JpSr37tC1K" 'False) (C1 ('MetaCons "FanIn" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "FanOut" 'PrefixI 'False) (U1 :: Type -> Type))

calculateGain :: ForNonLinearity -> Float Source #

Gain scaling value for He initialization

calculateFan :: [Dim String Integer] -> (Integer, Integer) Source #

Fan-in / Fan-out scaling calculation

sXavierUniform :: forall gradient layout device dataType shape gain generatorDevice m. (Num gain, Floating gain, Scalar gain, MonadThrow m, SGetGeneratorDevice generatorDevice) => TensorSpec gradient layout device dataType shape -> gain -> Generator generatorDevice -> m (Tensor gradient layout (device <+> generatorDevice) dataType shape, Generator (device <+> generatorDevice)) Source #

Xavier uniform initialization

sXavierNormal :: forall gradient layout device dataType shape gain generatorDevice m. (Num gain, Floating gain, Scalar gain, MonadThrow m, SGetGeneratorDevice generatorDevice) => TensorSpec gradient layout device dataType shape -> gain -> Generator generatorDevice -> m (Tensor gradient layout (device <+> generatorDevice) dataType shape, Generator (device <+> generatorDevice)) Source #

Xavier normal initialization

getter :: forall a. FanMode -> (a, a) -> a Source #

Get fan in or fan out value depending on selected fan mode, used by Kaiming

sKaimingUniform :: forall gradient layout device dataType shape generatorDevice m. (MonadThrow m, SGetGeneratorDevice generatorDevice) => TensorSpec gradient layout device dataType shape -> FanMode -> ForNonLinearity -> Generator generatorDevice -> m (Tensor gradient layout (device <+> generatorDevice) dataType shape, Generator (device <+> generatorDevice)) Source #

Kaiming uniform initialization

sKaimingNormal :: forall gradient layout device dataType shape generatorDevice m. (MonadThrow m, SGetGeneratorDevice generatorDevice) => TensorSpec gradient layout device dataType shape -> FanMode -> ForNonLinearity -> Generator generatorDevice -> m (Tensor gradient layout (device <+> generatorDevice) dataType shape, Generator (device <+> generatorDevice)) Source #

Kaiming normal initialization