hasktorch-0.2.0.0: Functional differentiable programming in Haskell
Safe HaskellNone
LanguageHaskell2010

Torch.Typed.NN.Recurrent.LSTM

Synopsis

Documentation

data LSTMLayerSpec (inputSize :: Nat) (hiddenSize :: Nat) (directionality :: RNNDirectionality) (dtype :: DType) (device :: (DeviceType, Nat)) Source #

Constructors

LSTMLayerSpec 

Instances

Instances details
Show (LSTMLayerSpec inputSize hiddenSize directionality dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Methods

showsPrec :: Int -> LSTMLayerSpec inputSize hiddenSize directionality dtype device -> ShowS Source #

show :: LSTMLayerSpec inputSize hiddenSize directionality dtype device -> String Source #

showList :: [LSTMLayerSpec inputSize hiddenSize directionality dtype device] -> ShowS Source #

Eq (LSTMLayerSpec inputSize hiddenSize directionality dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Methods

(==) :: LSTMLayerSpec inputSize hiddenSize directionality dtype device -> LSTMLayerSpec inputSize hiddenSize directionality dtype device -> Bool Source #

(/=) :: LSTMLayerSpec inputSize hiddenSize directionality dtype device -> LSTMLayerSpec inputSize hiddenSize directionality dtype device -> Bool Source #

(RandDTypeIsValid device dtype, KnownNat inputSize, KnownNat hiddenSize, KnownDType dtype, KnownDevice device) => Randomizable (LSTMLayerSpec inputSize hiddenSize 'Bidirectional dtype device) (LSTMLayer inputSize hiddenSize 'Bidirectional dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Methods

sample :: LSTMLayerSpec inputSize hiddenSize 'Bidirectional dtype device -> IO (LSTMLayer inputSize hiddenSize 'Bidirectional dtype device) Source #

(RandDTypeIsValid device dtype, KnownNat inputSize, KnownNat hiddenSize, KnownDType dtype, KnownDevice device) => Randomizable (LSTMLayerSpec inputSize hiddenSize 'Unidirectional dtype device) (LSTMLayer inputSize hiddenSize 'Unidirectional dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Methods

sample :: LSTMLayerSpec inputSize hiddenSize 'Unidirectional dtype device -> IO (LSTMLayer inputSize hiddenSize 'Unidirectional dtype device) Source #

data LSTMLayer (inputSize :: Nat) (hiddenSize :: Nat) (directionality :: RNNDirectionality) (dtype :: DType) (device :: (DeviceType, Nat)) where Source #

Constructors

LSTMUnidirectionalLayer :: Parameter device dtype (LSTMWIShape hiddenSize inputSize) -> Parameter device dtype (LSTMWHShape hiddenSize inputSize) -> Parameter device dtype (LSTMBIShape hiddenSize inputSize) -> Parameter device dtype (LSTMBHShape hiddenSize inputSize) -> LSTMLayer inputSize hiddenSize 'Unidirectional dtype device 
LSTMBidirectionalLayer :: Parameter device dtype (LSTMWIShape hiddenSize inputSize) -> Parameter device dtype (LSTMWHShape hiddenSize inputSize) -> Parameter device dtype (LSTMBIShape hiddenSize inputSize) -> Parameter device dtype (LSTMBHShape hiddenSize inputSize) -> Parameter device dtype (LSTMWIShape hiddenSize inputSize) -> Parameter device dtype (LSTMWHShape hiddenSize inputSize) -> Parameter device dtype (LSTMBIShape hiddenSize inputSize) -> Parameter device dtype (LSTMBHShape hiddenSize inputSize) -> LSTMLayer inputSize hiddenSize 'Bidirectional dtype device 

Instances

Instances details
Show (LSTMLayer inputSize hiddenSize directionality dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Methods

showsPrec :: Int -> LSTMLayer inputSize hiddenSize directionality dtype device -> ShowS Source #

show :: LSTMLayer inputSize hiddenSize directionality dtype device -> String Source #

showList :: [LSTMLayer inputSize hiddenSize directionality dtype device] -> ShowS Source #

Parameterized (LSTMLayer inputSize hiddenSize directionality dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Methods

flattenParameters :: LSTMLayer inputSize hiddenSize directionality dtype device -> [Parameter] Source #

_replaceParameters :: LSTMLayer inputSize hiddenSize directionality dtype device -> ParamStream (LSTMLayer inputSize hiddenSize directionality dtype device) Source #

Parameterized (LSTMLayer inputSize hiddenSize 'Bidirectional dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Associated Types

type Parameters (LSTMLayer inputSize hiddenSize 'Bidirectional dtype device) :: [Type] Source #

Methods

flattenParameters :: LSTMLayer inputSize hiddenSize 'Bidirectional dtype device -> HList (Parameters (LSTMLayer inputSize hiddenSize 'Bidirectional dtype device)) Source #

replaceParameters :: LSTMLayer inputSize hiddenSize 'Bidirectional dtype device -> HList (Parameters (LSTMLayer inputSize hiddenSize 'Bidirectional dtype device)) -> LSTMLayer inputSize hiddenSize 'Bidirectional dtype device Source #

Parameterized (LSTMLayer inputSize hiddenSize 'Unidirectional dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Associated Types

type Parameters (LSTMLayer inputSize hiddenSize 'Unidirectional dtype device) :: [Type] Source #

Methods

flattenParameters :: LSTMLayer inputSize hiddenSize 'Unidirectional dtype device -> HList (Parameters (LSTMLayer inputSize hiddenSize 'Unidirectional dtype device)) Source #

replaceParameters :: LSTMLayer inputSize hiddenSize 'Unidirectional dtype device -> HList (Parameters (LSTMLayer inputSize hiddenSize 'Unidirectional dtype device)) -> LSTMLayer inputSize hiddenSize 'Unidirectional dtype device Source #

(RandDTypeIsValid device dtype, KnownNat inputSize, KnownNat hiddenSize, KnownDType dtype, KnownDevice device) => Randomizable (LSTMLayerSpec inputSize hiddenSize 'Bidirectional dtype device) (LSTMLayer inputSize hiddenSize 'Bidirectional dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Methods

sample :: LSTMLayerSpec inputSize hiddenSize 'Bidirectional dtype device -> IO (LSTMLayer inputSize hiddenSize 'Bidirectional dtype device) Source #

(RandDTypeIsValid device dtype, KnownNat inputSize, KnownNat hiddenSize, KnownDType dtype, KnownDevice device) => Randomizable (LSTMLayerSpec inputSize hiddenSize 'Unidirectional dtype device) (LSTMLayer inputSize hiddenSize 'Unidirectional dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Methods

sample :: LSTMLayerSpec inputSize hiddenSize 'Unidirectional dtype device -> IO (LSTMLayer inputSize hiddenSize 'Unidirectional dtype device) Source #

type Parameters (LSTMLayer inputSize hiddenSize 'Bidirectional dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

type Parameters (LSTMLayer inputSize hiddenSize 'Bidirectional dtype device) = '[Parameter device dtype (LSTMWIShape hiddenSize inputSize), Parameter device dtype (LSTMWHShape hiddenSize inputSize), Parameter device dtype (LSTMBIShape hiddenSize inputSize), Parameter device dtype (LSTMBHShape hiddenSize inputSize), Parameter device dtype (LSTMWIShape hiddenSize inputSize), Parameter device dtype (LSTMWHShape hiddenSize inputSize), Parameter device dtype (LSTMBIShape hiddenSize inputSize), Parameter device dtype (LSTMBHShape hiddenSize inputSize)]
type Parameters (LSTMLayer inputSize hiddenSize 'Unidirectional dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

type Parameters (LSTMLayer inputSize hiddenSize 'Unidirectional dtype device) = '[Parameter device dtype (LSTMWIShape hiddenSize inputSize), Parameter device dtype (LSTMWHShape hiddenSize inputSize), Parameter device dtype (LSTMBIShape hiddenSize inputSize), Parameter device dtype (LSTMBHShape hiddenSize inputSize)]

data LSTMLayerStackSpec (inputSize :: Nat) (hiddenSize :: Nat) (numLayers :: Nat) (directionality :: RNNDirectionality) (dtype :: DType) (device :: (DeviceType, Nat)) Source #

Constructors

LSTMLayerStackSpec 

Instances

Instances details
Show (LSTMLayerStackSpec inputSize hiddenSize numLayers directionality dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Methods

showsPrec :: Int -> LSTMLayerStackSpec inputSize hiddenSize numLayers directionality dtype device -> ShowS Source #

show :: LSTMLayerStackSpec inputSize hiddenSize numLayers directionality dtype device -> String Source #

showList :: [LSTMLayerStackSpec inputSize hiddenSize numLayers directionality dtype device] -> ShowS Source #

Eq (LSTMLayerStackSpec inputSize hiddenSize numLayers directionality dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Methods

(==) :: LSTMLayerStackSpec inputSize hiddenSize numLayers directionality dtype device -> LSTMLayerStackSpec inputSize hiddenSize numLayers directionality dtype device -> Bool Source #

(/=) :: LSTMLayerStackSpec inputSize hiddenSize numLayers directionality dtype device -> LSTMLayerStackSpec inputSize hiddenSize numLayers directionality dtype device -> Bool Source #

(1 <= numLayers, (2 <=? numLayers) ~ flag, RandDTypeIsValid device dtype, KnownDType dtype, KnownDevice device, LSTMLayerStackRandomizable flag inputSize hiddenSize numLayers directionality dtype device) => Randomizable (LSTMLayerStackSpec inputSize hiddenSize numLayers directionality dtype device) (LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Methods

sample :: LSTMLayerStackSpec inputSize hiddenSize numLayers directionality dtype device -> IO (LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device) Source #

data LSTMLayerStack (inputSize :: Nat) (hiddenSize :: Nat) (numLayers :: Nat) (directionality :: RNNDirectionality) (dtype :: DType) (device :: (DeviceType, Nat)) where Source #

Constructors

LSTMLayer1 :: LSTMLayer inputSize hiddenSize directionality dtype device -> LSTMLayerStack inputSize hiddenSize 1 directionality dtype device 
LSTMLayerK :: LSTMLayer (hiddenSize * NumberOfDirections directionality) hiddenSize directionality dtype device -> LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device -> LSTMLayerStack inputSize hiddenSize (numLayers + 1) directionality dtype device 

Instances

Instances details
Show (LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Methods

showsPrec :: Int -> LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device -> ShowS Source #

show :: LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device -> String Source #

showList :: [LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device] -> ShowS Source #

Parameterized (LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Methods

flattenParameters :: LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device -> [Parameter] Source #

_replaceParameters :: LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device -> ParamStream (LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device) Source #

(1 <= numLayers, (2 <=? numLayers) ~ flag, LSTMLayerStackParameterized flag inputSize hiddenSize numLayers directionality dtype device) => Parameterized (LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Associated Types

type Parameters (LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device) :: [Type] Source #

Methods

flattenParameters :: LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device -> HList (Parameters (LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device)) Source #

replaceParameters :: LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device -> HList (Parameters (LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device)) -> LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device Source #

(1 <= numLayers, (2 <=? numLayers) ~ flag, RandDTypeIsValid device dtype, KnownDType dtype, KnownDevice device, LSTMLayerStackRandomizable flag inputSize hiddenSize numLayers directionality dtype device) => Randomizable (LSTMLayerStackSpec inputSize hiddenSize numLayers directionality dtype device) (LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Methods

sample :: LSTMLayerStackSpec inputSize hiddenSize numLayers directionality dtype device -> IO (LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device) Source #

type Parameters (LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

type Parameters (LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device) = LSTMLayerStackParameters (2 <=? numLayers) inputSize hiddenSize numLayers directionality dtype device

class LSTMLayerStackParameterized (flag :: Bool) inputSize hiddenSize numLayers directionality dtype device where Source #

Associated Types

type LSTMLayerStackParameters flag inputSize hiddenSize numLayers directionality dtype device :: [Type] Source #

Methods

lstmLayerStackFlattenParameters :: Proxy flag -> LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device -> HList (LSTMLayerStackParameters flag inputSize hiddenSize numLayers directionality dtype device) Source #

lstmLayerStackReplaceParameters :: Proxy flag -> LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device -> HList (LSTMLayerStackParameters flag inputSize hiddenSize numLayers directionality dtype device) -> LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device Source #

Instances

Instances details
Parameterized (LSTMLayer inputSize hiddenSize directionality dtype device) => LSTMLayerStackParameterized 'False inputSize hiddenSize 1 directionality dtype device Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Associated Types

type LSTMLayerStackParameters 'False inputSize hiddenSize 1 directionality dtype device :: [Type] Source #

Methods

lstmLayerStackFlattenParameters :: Proxy 'False -> LSTMLayerStack inputSize hiddenSize 1 directionality dtype device -> HList (LSTMLayerStackParameters 'False inputSize hiddenSize 1 directionality dtype device) Source #

lstmLayerStackReplaceParameters :: Proxy 'False -> LSTMLayerStack inputSize hiddenSize 1 directionality dtype device -> HList (LSTMLayerStackParameters 'False inputSize hiddenSize 1 directionality dtype device) -> LSTMLayerStack inputSize hiddenSize 1 directionality dtype device Source #

(Parameterized (LSTMLayer (hiddenSize * NumberOfDirections directionality) hiddenSize directionality dtype device), Parameterized (LSTMLayerStack inputSize hiddenSize (numLayers - 1) directionality dtype device), HAppendFD (Parameters (LSTMLayerStack inputSize hiddenSize (numLayers - 1) directionality dtype device)) (Parameters (LSTMLayer (hiddenSize * NumberOfDirections directionality) hiddenSize directionality dtype device)) (Parameters (LSTMLayerStack inputSize hiddenSize (numLayers - 1) directionality dtype device) ++ Parameters (LSTMLayer (hiddenSize * NumberOfDirections directionality) hiddenSize directionality dtype device))) => LSTMLayerStackParameterized 'True inputSize hiddenSize numLayers directionality dtype device Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Associated Types

type LSTMLayerStackParameters 'True inputSize hiddenSize numLayers directionality dtype device :: [Type] Source #

Methods

lstmLayerStackFlattenParameters :: Proxy 'True -> LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device -> HList (LSTMLayerStackParameters 'True inputSize hiddenSize numLayers directionality dtype device) Source #

lstmLayerStackReplaceParameters :: Proxy 'True -> LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device -> HList (LSTMLayerStackParameters 'True inputSize hiddenSize numLayers directionality dtype device) -> LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device Source #

class LSTMLayerStackRandomizable (flag :: Bool) inputSize hiddenSize numLayers directionality dtype device where Source #

Methods

lstmLayerStackSample :: Proxy flag -> LSTMLayerStackSpec inputSize hiddenSize numLayers directionality dtype device -> IO (LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device) Source #

Instances

Instances details
Randomizable (LSTMLayerSpec inputSize hiddenSize directionality dtype device) (LSTMLayer inputSize hiddenSize directionality dtype device) => LSTMLayerStackRandomizable 'False inputSize hiddenSize 1 directionality dtype device Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Methods

lstmLayerStackSample :: Proxy 'False -> LSTMLayerStackSpec inputSize hiddenSize 1 directionality dtype device -> IO (LSTMLayerStack inputSize hiddenSize 1 directionality dtype device) Source #

(1 <= numLayers, Randomizable (LSTMLayerSpec (hiddenSize * NumberOfDirections directionality) hiddenSize directionality dtype device) (LSTMLayer (hiddenSize * NumberOfDirections directionality) hiddenSize directionality dtype device), Randomizable (LSTMLayerStackSpec inputSize hiddenSize (numLayers - 1) directionality dtype device) (LSTMLayerStack inputSize hiddenSize (numLayers - 1) directionality dtype device)) => LSTMLayerStackRandomizable 'True inputSize hiddenSize numLayers directionality dtype device Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Methods

lstmLayerStackSample :: Proxy 'True -> LSTMLayerStackSpec inputSize hiddenSize numLayers directionality dtype device -> IO (LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device) Source #

newtype LSTMSpec (inputSize :: Nat) (hiddenSize :: Nat) (numLayers :: Nat) (directionality :: RNNDirectionality) (dtype :: DType) (device :: (DeviceType, Nat)) Source #

Constructors

LSTMSpec DropoutSpec 

Instances

Instances details
Generic (LSTMSpec inputSize hiddenSize numLayers directionality dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Associated Types

type Rep (LSTMSpec inputSize hiddenSize numLayers directionality dtype device) :: Type -> Type Source #

Methods

from :: LSTMSpec inputSize hiddenSize numLayers directionality dtype device -> Rep (LSTMSpec inputSize hiddenSize numLayers directionality dtype device) x Source #

to :: Rep (LSTMSpec inputSize hiddenSize numLayers directionality dtype device) x -> LSTMSpec inputSize hiddenSize numLayers directionality dtype device Source #

Show (LSTMSpec inputSize hiddenSize numLayers directionality dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Methods

showsPrec :: Int -> LSTMSpec inputSize hiddenSize numLayers directionality dtype device -> ShowS Source #

show :: LSTMSpec inputSize hiddenSize numLayers directionality dtype device -> String Source #

showList :: [LSTMSpec inputSize hiddenSize numLayers directionality dtype device] -> ShowS Source #

(KnownDType dtype, KnownDevice device, KnownNat inputSize, KnownNat hiddenSize, KnownNat (NumberOfDirections directionality), RandDTypeIsValid device dtype, Randomizable (LSTMLayerStackSpec inputSize hiddenSize numLayers directionality dtype device) (LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device), 1 <= numLayers) => Randomizable (LSTMSpec inputSize hiddenSize numLayers directionality dtype device) (LSTM inputSize hiddenSize numLayers directionality dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Methods

sample :: LSTMSpec inputSize hiddenSize numLayers directionality dtype device -> IO (LSTM inputSize hiddenSize numLayers directionality dtype device) Source #

type Rep (LSTMSpec inputSize hiddenSize numLayers directionality dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

type Rep (LSTMSpec inputSize hiddenSize numLayers directionality dtype device) = D1 ('MetaData "LSTMSpec" "Torch.Typed.NN.Recurrent.LSTM" "hasktorch-0.2.0.0-F6yFRaDiRF49lpq95SVuR8" 'True) (C1 ('MetaCons "LSTMSpec" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 DropoutSpec)))

data LSTM (inputSize :: Nat) (hiddenSize :: Nat) (numLayers :: Nat) (directionality :: RNNDirectionality) (dtype :: DType) (device :: (DeviceType, Nat)) where Source #

Constructors

LSTM 

Fields

Instances

Instances details
1 <= numLayers => Generic (LSTM inputSize hiddenSize numLayers directionality dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Associated Types

type Rep (LSTM inputSize hiddenSize numLayers directionality dtype device) :: Type -> Type Source #

Methods

from :: LSTM inputSize hiddenSize numLayers directionality dtype device -> Rep (LSTM inputSize hiddenSize numLayers directionality dtype device) x Source #

to :: Rep (LSTM inputSize hiddenSize numLayers directionality dtype device) x -> LSTM inputSize hiddenSize numLayers directionality dtype device Source #

Show (LSTM inputSize hiddenSize numLayers directionality dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Methods

showsPrec :: Int -> LSTM inputSize hiddenSize numLayers directionality dtype device -> ShowS Source #

show :: LSTM inputSize hiddenSize numLayers directionality dtype device -> String Source #

showList :: [LSTM inputSize hiddenSize numLayers directionality dtype device] -> ShowS Source #

Parameterized (LSTM inputSize hiddenSize numLayers directionality dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Methods

flattenParameters :: LSTM inputSize hiddenSize numLayers directionality dtype device -> [Parameter] Source #

_replaceParameters :: LSTM inputSize hiddenSize numLayers directionality dtype device -> ParamStream (LSTM inputSize hiddenSize numLayers directionality dtype device) Source #

(1 <= numLayers, Parameterized (LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device), HAppendFD (Parameters (LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device)) (Parameters Dropout) (Parameters (LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device) ++ Parameters Dropout)) => Parameterized (LSTM inputSize hiddenSize numLayers directionality dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Associated Types

type Parameters (LSTM inputSize hiddenSize numLayers directionality dtype device) :: [Type] Source #

Methods

flattenParameters :: LSTM inputSize hiddenSize numLayers directionality dtype device -> HList (Parameters (LSTM inputSize hiddenSize numLayers directionality dtype device)) Source #

replaceParameters :: LSTM inputSize hiddenSize numLayers directionality dtype device -> HList (Parameters (LSTM inputSize hiddenSize numLayers directionality dtype device)) -> LSTM inputSize hiddenSize numLayers directionality dtype device Source #

(KnownDType dtype, KnownDevice device, KnownNat inputSize, KnownNat hiddenSize, KnownNat (NumberOfDirections directionality), RandDTypeIsValid device dtype, Randomizable (LSTMLayerStackSpec inputSize hiddenSize numLayers directionality dtype device) (LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device), 1 <= numLayers) => Randomizable (LSTMSpec inputSize hiddenSize numLayers directionality dtype device) (LSTM inputSize hiddenSize numLayers directionality dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Methods

sample :: LSTMSpec inputSize hiddenSize numLayers directionality dtype device -> IO (LSTM inputSize hiddenSize numLayers directionality dtype device) Source #

type Rep (LSTM inputSize hiddenSize numLayers directionality dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

type Rep (LSTM inputSize hiddenSize numLayers directionality dtype device) = Rec0 (LSTMLayerStack inputSize hiddenSize numLayers directionality dtype device) :*: Rec0 Dropout
type Parameters (LSTM inputSize hiddenSize numLayers directionality dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

type Parameters (LSTM inputSize hiddenSize numLayers directionality dtype device) = GParameters (Rep (LSTM inputSize hiddenSize numLayers directionality dtype device))

xavierUniformLSTM :: forall device dtype hiddenSize featureSize. (KnownDType dtype, KnownNat hiddenSize, KnownNat featureSize, KnownDevice device, RandDTypeIsValid device dtype) => IO (Tensor device dtype '[4 * hiddenSize, featureSize]) Source #

Helper to do xavier uniform initializations on weight matrices and orthagonal initializations for the gates. (When implemented.)

data LSTMWithInitSpec (inputSize :: Nat) (hiddenSize :: Nat) (numLayers :: Nat) (directionality :: RNNDirectionality) (initialization :: RNNInitialization) (dtype :: DType) (device :: (DeviceType, Nat)) where Source #

A specification for a long, short-term memory layer.

Constructors

LSTMWithZerosInitSpec :: forall inputSize hiddenSize numLayers directionality dtype device. LSTMSpec inputSize hiddenSize numLayers directionality dtype device -> LSTMWithInitSpec inputSize hiddenSize numLayers directionality 'ConstantInitialization dtype device

Weights drawn from Xavier-Uniform with zeros-value initialized biases and cell states.

LSTMWithConstInitSpec

Weights drawn from Xavier-Uniform with zeros-value initialized biases and user-provided cell states.

Fields

  • :: forall inputSize hiddenSize numLayers directionality dtype device. LSTMSpec inputSize hiddenSize numLayers directionality dtype device
     
  • -> Tensor device dtype '[numLayers * NumberOfDirections directionality, hiddenSize]

    The initial values of the memory cell

  • -> Tensor device dtype '[numLayers * NumberOfDirections directionality, hiddenSize]

    The initial values of the hidden state

  • -> LSTMWithInitSpec inputSize hiddenSize numLayers directionality 'ConstantInitialization dtype device
     
LSTMWithLearnedInitSpec

Weights drawn from Xavier-Uniform with zeros-value initialized biases and learned cell states.

Fields

  • :: forall inputSize hiddenSize numLayers directionality dtype device. LSTMSpec inputSize hiddenSize numLayers directionality dtype device
     
  • -> Tensor device dtype '[numLayers * NumberOfDirections directionality, hiddenSize]

    The initial (learnable) values of the memory cell

  • -> Tensor device dtype '[numLayers * NumberOfDirections directionality, hiddenSize]

    The initial (learnable) values of the hidden state

  • -> LSTMWithInitSpec inputSize hiddenSize numLayers directionality 'LearnedInitialization dtype device
     

Instances

Instances details
Show (LSTMWithInitSpec inputSize hiddenSize numLayers directionality initialization dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Methods

showsPrec :: Int -> LSTMWithInitSpec inputSize hiddenSize numLayers directionality initialization dtype device -> ShowS Source #

show :: LSTMWithInitSpec inputSize hiddenSize numLayers directionality initialization dtype device -> String Source #

showList :: [LSTMWithInitSpec inputSize hiddenSize numLayers directionality initialization dtype device] -> ShowS Source #

(KnownNat hiddenSize, KnownNat numLayers, KnownNat (NumberOfDirections directionality), KnownDType dtype, KnownDevice device, Randomizable (LSTMSpec inputSize hiddenSize numLayers directionality dtype device) (LSTM inputSize hiddenSize numLayers directionality dtype device)) => Randomizable (LSTMWithInitSpec inputSize hiddenSize numLayers directionality 'ConstantInitialization dtype device) (LSTMWithInit inputSize hiddenSize numLayers directionality 'ConstantInitialization dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Methods

sample :: LSTMWithInitSpec inputSize hiddenSize numLayers directionality 'ConstantInitialization dtype device -> IO (LSTMWithInit inputSize hiddenSize numLayers directionality 'ConstantInitialization dtype device) Source #

(KnownNat hiddenSize, KnownNat numLayers, KnownNat (NumberOfDirections directionality), KnownDType dtype, KnownDevice device, Randomizable (LSTMSpec inputSize hiddenSize numLayers directionality dtype device) (LSTM inputSize hiddenSize numLayers directionality dtype device)) => Randomizable (LSTMWithInitSpec inputSize hiddenSize numLayers directionality 'LearnedInitialization dtype device) (LSTMWithInit inputSize hiddenSize numLayers directionality 'LearnedInitialization dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Methods

sample :: LSTMWithInitSpec inputSize hiddenSize numLayers directionality 'LearnedInitialization dtype device -> IO (LSTMWithInit inputSize hiddenSize numLayers directionality 'LearnedInitialization dtype device) Source #

data LSTMWithInit (inputSize :: Nat) (hiddenSize :: Nat) (numLayers :: Nat) (directionality :: RNNDirectionality) (initialization :: RNNInitialization) (dtype :: DType) (device :: (DeviceType, Nat)) where Source #

A long, short-term memory layer with either fixed initial states for the memory cells and hidden state or learnable inital states for the memory cells and hidden state.

Constructors

LSTMWithConstInit 

Fields

LSTMWithLearnedInit 

Fields

Instances

Instances details
Generic (LSTMWithInit inputSize hiddenSize numLayers directionality 'ConstantInitialization dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Associated Types

type Rep (LSTMWithInit inputSize hiddenSize numLayers directionality 'ConstantInitialization dtype device) :: Type -> Type Source #

Methods

from :: LSTMWithInit inputSize hiddenSize numLayers directionality 'ConstantInitialization dtype device -> Rep (LSTMWithInit inputSize hiddenSize numLayers directionality 'ConstantInitialization dtype device) x Source #

to :: Rep (LSTMWithInit inputSize hiddenSize numLayers directionality 'ConstantInitialization dtype device) x -> LSTMWithInit inputSize hiddenSize numLayers directionality 'ConstantInitialization dtype device Source #

Generic (LSTMWithInit inputSize hiddenSize numLayers directionality 'LearnedInitialization dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Associated Types

type Rep (LSTMWithInit inputSize hiddenSize numLayers directionality 'LearnedInitialization dtype device) :: Type -> Type Source #

Methods

from :: LSTMWithInit inputSize hiddenSize numLayers directionality 'LearnedInitialization dtype device -> Rep (LSTMWithInit inputSize hiddenSize numLayers directionality 'LearnedInitialization dtype device) x Source #

to :: Rep (LSTMWithInit inputSize hiddenSize numLayers directionality 'LearnedInitialization dtype device) x -> LSTMWithInit inputSize hiddenSize numLayers directionality 'LearnedInitialization dtype device Source #

Show (LSTMWithInit inputSize hiddenSize numLayers directionality initialization dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Methods

showsPrec :: Int -> LSTMWithInit inputSize hiddenSize numLayers directionality initialization dtype device -> ShowS Source #

show :: LSTMWithInit inputSize hiddenSize numLayers directionality initialization dtype device -> String Source #

showList :: [LSTMWithInit inputSize hiddenSize numLayers directionality initialization dtype device] -> ShowS Source #

Parameterized (LSTMWithInit inputSize hiddenSize numLayers directionality initialization dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Methods

flattenParameters :: LSTMWithInit inputSize hiddenSize numLayers directionality initialization dtype device -> [Parameter] Source #

_replaceParameters :: LSTMWithInit inputSize hiddenSize numLayers directionality initialization dtype device -> ParamStream (LSTMWithInit inputSize hiddenSize numLayers directionality initialization dtype device) Source #

(Parameterized (LSTM inputSize hiddenSize numLayers directionality dtype device), HAppendFD (Parameters (LSTM inputSize hiddenSize numLayers directionality dtype device)) ('[] :: [Type]) (Parameters (LSTM inputSize hiddenSize numLayers directionality dtype device) ++ ('[] :: [Type]))) => Parameterized (LSTMWithInit inputSize hiddenSize numLayers directionality 'ConstantInitialization dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Associated Types

type Parameters (LSTMWithInit inputSize hiddenSize numLayers directionality 'ConstantInitialization dtype device) :: [Type] Source #

Methods

flattenParameters :: LSTMWithInit inputSize hiddenSize numLayers directionality 'ConstantInitialization dtype device -> HList (Parameters (LSTMWithInit inputSize hiddenSize numLayers directionality 'ConstantInitialization dtype device)) Source #

replaceParameters :: LSTMWithInit inputSize hiddenSize numLayers directionality 'ConstantInitialization dtype device -> HList (Parameters (LSTMWithInit inputSize hiddenSize numLayers directionality 'ConstantInitialization dtype device)) -> LSTMWithInit inputSize hiddenSize numLayers directionality 'ConstantInitialization dtype device Source #

(Parameterized (LSTM inputSize hiddenSize numLayers directionality dtype device), HAppendFD (Parameters (LSTM inputSize hiddenSize numLayers directionality dtype device)) '[Parameter device dtype '[numLayers * NumberOfDirections directionality, hiddenSize], Parameter device dtype '[numLayers * NumberOfDirections directionality, hiddenSize]] (Parameters (LSTM inputSize hiddenSize numLayers directionality dtype device) ++ '[Parameter device dtype '[numLayers * NumberOfDirections directionality, hiddenSize], Parameter device dtype '[numLayers * NumberOfDirections directionality, hiddenSize]])) => Parameterized (LSTMWithInit inputSize hiddenSize numLayers directionality 'LearnedInitialization dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Associated Types

type Parameters (LSTMWithInit inputSize hiddenSize numLayers directionality 'LearnedInitialization dtype device) :: [Type] Source #

Methods

flattenParameters :: LSTMWithInit inputSize hiddenSize numLayers directionality 'LearnedInitialization dtype device -> HList (Parameters (LSTMWithInit inputSize hiddenSize numLayers directionality 'LearnedInitialization dtype device)) Source #

replaceParameters :: LSTMWithInit inputSize hiddenSize numLayers directionality 'LearnedInitialization dtype device -> HList (Parameters (LSTMWithInit inputSize hiddenSize numLayers directionality 'LearnedInitialization dtype device)) -> LSTMWithInit inputSize hiddenSize numLayers directionality 'LearnedInitialization dtype device Source #

(KnownNat hiddenSize, KnownNat numLayers, KnownNat (NumberOfDirections directionality), KnownDType dtype, KnownDevice device, Randomizable (LSTMSpec inputSize hiddenSize numLayers directionality dtype device) (LSTM inputSize hiddenSize numLayers directionality dtype device)) => Randomizable (LSTMWithInitSpec inputSize hiddenSize numLayers directionality 'ConstantInitialization dtype device) (LSTMWithInit inputSize hiddenSize numLayers directionality 'ConstantInitialization dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Methods

sample :: LSTMWithInitSpec inputSize hiddenSize numLayers directionality 'ConstantInitialization dtype device -> IO (LSTMWithInit inputSize hiddenSize numLayers directionality 'ConstantInitialization dtype device) Source #

(KnownNat hiddenSize, KnownNat numLayers, KnownNat (NumberOfDirections directionality), KnownDType dtype, KnownDevice device, Randomizable (LSTMSpec inputSize hiddenSize numLayers directionality dtype device) (LSTM inputSize hiddenSize numLayers directionality dtype device)) => Randomizable (LSTMWithInitSpec inputSize hiddenSize numLayers directionality 'LearnedInitialization dtype device) (LSTMWithInit inputSize hiddenSize numLayers directionality 'LearnedInitialization dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

Methods

sample :: LSTMWithInitSpec inputSize hiddenSize numLayers directionality 'LearnedInitialization dtype device -> IO (LSTMWithInit inputSize hiddenSize numLayers directionality 'LearnedInitialization dtype device) Source #

type Rep (LSTMWithInit inputSize hiddenSize numLayers directionality 'ConstantInitialization dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

type Rep (LSTMWithInit inputSize hiddenSize numLayers directionality 'ConstantInitialization dtype device) = Rec0 (LSTM inputSize hiddenSize numLayers directionality dtype device) :*: (Rec0 (Tensor device dtype '[numLayers * NumberOfDirections directionality, hiddenSize]) :*: Rec0 (Tensor device dtype '[numLayers * NumberOfDirections directionality, hiddenSize]))
type Rep (LSTMWithInit inputSize hiddenSize numLayers directionality 'LearnedInitialization dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

type Rep (LSTMWithInit inputSize hiddenSize numLayers directionality 'LearnedInitialization dtype device) = Rec0 (LSTM inputSize hiddenSize numLayers directionality dtype device) :*: (Rec0 (Parameter device dtype '[numLayers * NumberOfDirections directionality, hiddenSize]) :*: Rec0 (Parameter device dtype '[numLayers * NumberOfDirections directionality, hiddenSize]))
type Parameters (LSTMWithInit inputSize hiddenSize numLayers directionality 'ConstantInitialization dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

type Parameters (LSTMWithInit inputSize hiddenSize numLayers directionality 'ConstantInitialization dtype device) = GParameters (Rep (LSTMWithInit inputSize hiddenSize numLayers directionality 'ConstantInitialization dtype device))
type Parameters (LSTMWithInit inputSize hiddenSize numLayers directionality 'LearnedInitialization dtype device) Source # 
Instance details

Defined in Torch.Typed.NN.Recurrent.LSTM

type Parameters (LSTMWithInit inputSize hiddenSize numLayers directionality 'LearnedInitialization dtype device) = GParameters (Rep (LSTMWithInit inputSize hiddenSize numLayers directionality 'LearnedInitialization dtype device))

lstmForward :: forall shapeOrder batchSize seqLen directionality initialization numLayers inputSize outputSize hiddenSize inputShape outputShape hxShape parameters tensorParameters dtype device. (KnownNat (NumberOfDirections directionality), KnownNat numLayers, KnownNat batchSize, KnownNat hiddenSize, KnownRNNShapeOrder shapeOrder, KnownRNNDirectionality directionality, outputSize ~ (hiddenSize * NumberOfDirections directionality), inputShape ~ RNNShape shapeOrder seqLen batchSize inputSize, outputShape ~ RNNShape shapeOrder seqLen batchSize outputSize, hxShape ~ '[numLayers * NumberOfDirections directionality, batchSize, hiddenSize], parameters ~ Parameters (LSTM inputSize hiddenSize numLayers directionality dtype device), Parameterized (LSTM inputSize hiddenSize numLayers directionality dtype device), tensorParameters ~ LSTMR inputSize hiddenSize numLayers directionality dtype device, Castable (HList tensorParameters) [ATenTensor], HMap' ToDependent parameters tensorParameters) => Bool -> LSTMWithInit inputSize hiddenSize numLayers directionality initialization dtype device -> Tensor device dtype inputShape -> (Tensor device dtype outputShape, Tensor device dtype hxShape, Tensor device dtype hxShape) Source #

lstmForwardWithDropout :: forall shapeOrder batchSize seqLen directionality initialization numLayers inputSize outputSize hiddenSize inputShape outputShape hxShape parameters tensorParameters dtype device. (KnownNat (NumberOfDirections directionality), KnownNat numLayers, KnownNat batchSize, KnownNat hiddenSize, KnownRNNShapeOrder shapeOrder, KnownRNNDirectionality directionality, outputSize ~ (hiddenSize * NumberOfDirections directionality), inputShape ~ RNNShape shapeOrder seqLen batchSize inputSize, outputShape ~ RNNShape shapeOrder seqLen batchSize outputSize, hxShape ~ '[numLayers * NumberOfDirections directionality, batchSize, hiddenSize], parameters ~ Parameters (LSTM inputSize hiddenSize numLayers directionality dtype device), Parameterized (LSTM inputSize hiddenSize numLayers directionality dtype device), tensorParameters ~ LSTMR inputSize hiddenSize numLayers directionality dtype device, Castable (HList tensorParameters) [ATenTensor], HMap' ToDependent parameters tensorParameters) => LSTMWithInit inputSize hiddenSize numLayers directionality initialization dtype device -> Tensor device dtype inputShape -> (Tensor device dtype outputShape, Tensor device dtype hxShape, Tensor device dtype hxShape) Source #

Forward propagate the LSTM module (without applying dropout on the outputs of each layer).

>>> input :: CPUTensor 'D.Float '[5,16,10] <- randn
>>> spec = LSTMWithZerosInitSpec @10 @30 @3 @'Bidirectional @'D.Float @'( 'D.CPU, 0) (LSTMSpec (DropoutSpec 0.5))
>>> model <- A.sample spec
>>> :t lstmForwardWithoutDropout @'BatchFirst model input
lstmForwardWithoutDropout @'BatchFirst model input
  :: (Tensor '( 'D.CPU, 0) 'D.Float '[5, 16, 60],
      Tensor '( 'D.CPU, 0) 'D.Float '[6, 5, 30],
      Tensor '( 'D.CPU, 0) 'D.Float '[6, 5, 30])
>>> (a,b,c) = lstmForwardWithoutDropout @'BatchFirst model input
>>> ((dtype a, shape a), (dtype b, shape b), (dtype c, shape c))
((Float,[5,16,60]),(Float,[6,5,30]),(Float,[6,5,30]))

Forward propagate the LSTM module and apply dropout on the outputs of each layer.

>>> input :: CPUTensor 'D.Float '[5,16,10] <- randn
>>> spec = LSTMWithZerosInitSpec @10 @30 @3 @'Bidirectional @'D.Float @'( 'D.CPU, 0) (LSTMSpec (DropoutSpec 0.5))
>>> model <- A.sample spec
>>> :t lstmForwardWithDropout @'BatchFirst model input
lstmForwardWithDropout @'BatchFirst model input
  :: (Tensor '( 'D.CPU, 0) 'D.Float '[5, 16, 60],
      Tensor '( 'D.CPU, 0) 'D.Float '[6, 5, 30],
      Tensor '( 'D.CPU, 0) 'D.Float '[6, 5, 30])
>>> (a,b,c) = lstmForwardWithDropout @'BatchFirst model input
>>> ((dtype a, shape a), (dtype b, shape b), (dtype c, shape c))
((Float,[5,16,60]),(Float,[6,5,30]),(Float,[6,5,30]))

lstmForwardWithoutDropout :: forall shapeOrder batchSize seqLen directionality initialization numLayers inputSize outputSize hiddenSize inputShape outputShape hxShape parameters tensorParameters dtype device. (KnownNat (NumberOfDirections directionality), KnownNat numLayers, KnownNat batchSize, KnownNat hiddenSize, KnownRNNShapeOrder shapeOrder, KnownRNNDirectionality directionality, outputSize ~ (hiddenSize * NumberOfDirections directionality), inputShape ~ RNNShape shapeOrder seqLen batchSize inputSize, outputShape ~ RNNShape shapeOrder seqLen batchSize outputSize, hxShape ~ '[numLayers * NumberOfDirections directionality, batchSize, hiddenSize], parameters ~ Parameters (LSTM inputSize hiddenSize numLayers directionality dtype device), Parameterized (LSTM inputSize hiddenSize numLayers directionality dtype device), tensorParameters ~ LSTMR inputSize hiddenSize numLayers directionality dtype device, Castable (HList tensorParameters) [ATenTensor], HMap' ToDependent parameters tensorParameters) => LSTMWithInit inputSize hiddenSize numLayers directionality initialization dtype device -> Tensor device dtype inputShape -> (Tensor device dtype outputShape, Tensor device dtype hxShape, Tensor device dtype hxShape) Source #

Forward propagate the LSTM module and apply dropout on the outputs of each layer.

>>> input :: CPUTensor 'D.Float '[5,16,10] <- randn
>>> spec = LSTMWithZerosInitSpec @10 @30 @3 @'Bidirectional @'D.Float @'( 'D.CPU, 0) (LSTMSpec (DropoutSpec 0.5))
>>> model <- A.sample spec
>>> :t lstmForwardWithDropout @'BatchFirst model input
lstmForwardWithDropout @'BatchFirst model input
  :: (Tensor '( 'D.CPU, 0) 'D.Float '[5, 16, 60],
      Tensor '( 'D.CPU, 0) 'D.Float '[6, 5, 30],
      Tensor '( 'D.CPU, 0) 'D.Float '[6, 5, 30])
>>> (a,b,c) = lstmForwardWithDropout @'BatchFirst model input
>>> ((dtype a, shape a), (dtype b, shape b), (dtype c, shape c))
((Float,[5,16,60]),(Float,[6,5,30]),(Float,[6,5,30]))