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

Torch.GraduallyTyped.NN.Linear

Synopsis

Documentation

data GLinear (weight :: Type) (bias :: Type) where Source #

Generic linear model with weight and optional bias.

Constructors

GLinear 

Fields

Instances

Instances details
Generic (GLinear weight bias) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Linear

Associated Types

type Rep (GLinear weight bias) :: Type -> Type Source #

Methods

from :: GLinear weight bias -> Rep (GLinear weight bias) x Source #

to :: Rep (GLinear weight bias) x -> GLinear weight bias Source #

(Show weight, Show bias) => Show (GLinear weight bias) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Linear

Methods

showsPrec :: Int -> GLinear weight bias -> ShowS Source #

show :: GLinear weight bias -> String Source #

showList :: [GLinear weight bias] -> ShowS Source #

(Eq weight, Eq bias) => Eq (GLinear weight bias) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Linear

Methods

(==) :: GLinear weight bias -> GLinear weight bias -> Bool Source #

(/=) :: GLinear weight bias -> GLinear weight bias -> Bool Source #

(Ord weight, Ord bias) => Ord (GLinear weight bias) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Linear

Methods

compare :: GLinear weight bias -> GLinear weight bias -> Ordering Source #

(<) :: GLinear weight bias -> GLinear weight bias -> Bool Source #

(<=) :: GLinear weight bias -> GLinear weight bias -> Bool Source #

(>) :: GLinear weight bias -> GLinear weight bias -> Bool Source #

(>=) :: GLinear weight bias -> GLinear weight bias -> Bool Source #

max :: GLinear weight bias -> GLinear weight bias -> GLinear weight bias Source #

min :: GLinear weight bias -> GLinear weight bias -> GLinear weight bias Source #

(HasStateDict weight, HasStateDict bias) => HasStateDict (GLinear weight bias) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Linear

Methods

fromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec (GLinear weight bias) -> StateDictKey -> m (GLinear weight bias) Source #

toStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> GLinear weight bias -> m () Source #

(output ~ GLinear (Tensor gradient ('Layout 'Dense) (device <+> generatorDevice) dataType ('Shape '[outputDim, inputDim])) (Tensor gradient ('Layout 'Dense) (device <+> generatorDevice) dataType ('Shape '[outputDim])), generatorOutputDevice ~ (device <+> generatorDevice), SGetGeneratorDevice generatorDevice, SGetGeneratorDevice generatorOutputDevice) => HasInitialize (GLinear (Tensor gradient ('Layout 'Dense) device dataType ('Shape '[outputDim, inputDim])) (Tensor gradient ('Layout 'Dense) device dataType ('Shape '[outputDim]))) generatorDevice output generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Linear

Methods

initialize :: MonadThrow m => ModelSpec (GLinear (Tensor gradient ('Layout 'Dense) device dataType ('Shape '[outputDim, inputDim])) (Tensor gradient ('Layout 'Dense) device dataType ('Shape '[outputDim]))) -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

(output ~ GLinear (Tensor gradient ('Layout 'Dense) (device <+> generatorDevice) dataType ('Shape '[outputDim, inputDim])) (), generatorOutputDevice ~ (device <+> generatorDevice), SGetGeneratorDevice generatorDevice) => HasInitialize (GLinear (Tensor gradient ('Layout 'Dense) device dataType ('Shape '[outputDim, inputDim])) ()) generatorDevice output generatorOutputDevice Source #

TODO: Add ForNonLinearity as parameter.

Instance details

Defined in Torch.GraduallyTyped.NN.Linear

Methods

initialize :: MonadThrow m => ModelSpec (GLinear (Tensor gradient ('Layout 'Dense) device dataType ('Shape '[outputDim, inputDim])) ()) -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

HasForward (GLinear weight bias) input generatorDevice output generatorDevice => HasForward (GLinear (NamedModel weight) (NamedModel bias)) input generatorDevice output generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Linear

Methods

forward :: MonadThrow m => GLinear (NamedModel weight) (NamedModel bias) -> input -> Generator generatorDevice -> m (output, Generator generatorDevice) Source #

HasInitialize (GLinear weight bias) generatorDevice (GLinear weight bias) generatorDevice => HasInitialize (GLinear (NamedModel weight) (NamedModel bias)) generatorDevice (GLinear (NamedModel weight) (NamedModel bias)) generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Linear

Methods

initialize :: MonadThrow m => ModelSpec (GLinear (NamedModel weight) (NamedModel bias)) -> Generator generatorDevice -> m (GLinear (NamedModel weight) (NamedModel bias), Generator generatorDevice) Source #

output ~ Tensor (gradient <|> gradient') ('Layout 'Dense <+> layout') (device <+> device') (dataType <+> dataType') (LinearWithBiasF ('Shape '[outputDim, inputDim]) ('Shape '[outputDim]) shape') => HasForward (GLinear (Tensor gradient ('Layout 'Dense) device dataType ('Shape '[outputDim, inputDim])) (Tensor gradient ('Layout 'Dense) device dataType ('Shape '[outputDim]))) (Tensor gradient' layout' device' dataType' shape') generatorDevice output generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Linear

Methods

forward :: MonadThrow m => GLinear (Tensor gradient ('Layout 'Dense) device dataType ('Shape '[outputDim, inputDim])) (Tensor gradient ('Layout 'Dense) device dataType ('Shape '[outputDim])) -> Tensor gradient' layout' device' dataType' shape' -> Generator generatorDevice -> m (output, Generator generatorDevice) Source #

output ~ Tensor (gradient <|> gradient') ('Layout 'Dense <+> layout') (device <+> device') (dataType <+> dataType') (LinearWithoutBiasF ('Shape '[outputDim, inputDim]) shape') => HasForward (GLinear (Tensor gradient ('Layout 'Dense) device dataType ('Shape '[outputDim, inputDim])) ()) (Tensor gradient' layout' device' dataType' shape') generatorDevice output generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Linear

Methods

forward :: MonadThrow m => GLinear (Tensor gradient ('Layout 'Dense) device dataType ('Shape '[outputDim, inputDim])) () -> Tensor gradient' layout' device' dataType' shape' -> Generator generatorDevice -> m (output, Generator generatorDevice) Source #

type Rep (GLinear weight bias) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Linear

type Rep (GLinear weight bias) = D1 ('MetaData "GLinear" "Torch.GraduallyTyped.NN.Linear" "hasktorch-gradually-typed-0.2.0.0-1KV1aIPzzbp6JpSr37tC1K" 'False) (C1 ('MetaCons "GLinear" 'PrefixI 'True) (S1 ('MetaSel ('Just "linearWeight") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 weight) :*: S1 ('MetaSel ('Just "linearBias") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 bias)))
type ModelSpec (GLinear weight bias) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Linear

type ModelSpec (GLinear weight bias) = GLinear (ModelSpec weight) (ModelSpec bias)

type family GLinearF (hasBias :: HasBias) (gradient :: Gradient RequiresGradient) (device :: Device (DeviceType Nat)) (dataType :: DataType DType) (inputDim :: Dim (Name Symbol) (Size Nat)) (outputDim :: Dim (Name Symbol) (Size Nat)) :: Type where ... Source #

Equations

GLinearF hasBias gradient device dataType inputDim outputDim = GLinear (NamedModel (LinearWeightF gradient device dataType inputDim outputDim)) (NamedModel (LinearBiasF hasBias gradient device dataType outputDim)) 

type family LinearWeightF (gradient :: Gradient RequiresGradient) (device :: Device (DeviceType Nat)) (dataType :: DataType DType) (inputDim :: Dim (Name Symbol) (Size Nat)) (outputDim :: Dim (Name Symbol) (Size Nat)) :: Type where ... Source #

Equations

LinearWeightF gradient device dataType inputDim outputDim = Tensor gradient ('Layout 'Dense) device dataType ('Shape '[outputDim, inputDim]) 

type family LinearBiasF (hasBias :: HasBias) (gradient :: Gradient RequiresGradient) (device :: Device (DeviceType Nat)) (dataType :: DataType DType) (outputDim :: Dim (Name Symbol) (Size Nat)) :: Type where ... Source #

Equations

LinearBiasF 'WithoutBias _ _ _ _ = () 
LinearBiasF 'WithBias gradient device dataType outputDim = Tensor gradient ('Layout 'Dense) device dataType ('Shape '[outputDim]) 

linearSpec :: forall hasBias gradient device dataType inputDim outputDim. SHasBias hasBias -> SGradient gradient -> SDevice device -> SDataType dataType -> SDim inputDim -> SDim outputDim -> ModelSpec (GLinearF hasBias gradient device dataType inputDim outputDim) Source #