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

Torch.GraduallyTyped.NN.Class

Synopsis

Documentation

data NamedModel model Source #

Constructors

NamedModel Text model 

Instances

Instances details
Generic (NamedModel model) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Associated Types

type Rep (NamedModel model) :: Type -> Type Source #

Methods

from :: NamedModel model -> Rep (NamedModel model) x Source #

to :: Rep (NamedModel model) x -> NamedModel model Source #

Show model => Show (NamedModel model) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

showsPrec :: Int -> NamedModel model -> ShowS Source #

show :: NamedModel model -> String Source #

showList :: [NamedModel model] -> ShowS Source #

Eq model => Eq (NamedModel model) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

(==) :: NamedModel model -> NamedModel model -> Bool Source #

(/=) :: NamedModel model -> NamedModel model -> Bool Source #

Ord model => Ord (NamedModel model) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

compare :: NamedModel model -> NamedModel model -> Ordering Source #

(<) :: NamedModel model -> NamedModel model -> Bool Source #

(<=) :: NamedModel model -> NamedModel model -> Bool Source #

(>) :: NamedModel model -> NamedModel model -> Bool Source #

(>=) :: NamedModel model -> NamedModel model -> Bool Source #

max :: NamedModel model -> NamedModel model -> NamedModel model Source #

min :: NamedModel model -> NamedModel model -> NamedModel model Source #

HasStateDict model => HasStateDict (NamedModel model) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

HasForward model input generatorDevice output generatorOutputDevice => HasForward (NamedModel model) input generatorDevice output generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

forward :: MonadThrow m => NamedModel model -> input -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

HasInitialize model generatorDevice output generatorOutputDevice => HasInitialize (NamedModel model) generatorDevice (NamedModel output) generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

initialize :: MonadThrow m => ModelSpec (NamedModel model) -> Generator generatorDevice -> m (NamedModel output, Generator generatorOutputDevice) Source #

HasInitialize (GBias (NamedModel (Tensor biasGradient biasLayout biasDevice biasDataType biasShape))) generatorDevice (GBias (NamedModel (Tensor biasGradient biasLayout biasDevice biasDataType biasShape))) generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GLMHead

Methods

initialize :: MonadThrow m => ModelSpec (GBias (NamedModel (Tensor biasGradient biasLayout biasDevice biasDataType biasShape))) -> Generator generatorDevice -> m (GBias (NamedModel (Tensor biasGradient biasLayout biasDevice biasDataType biasShape)), Generator generatorDevice) Source #

(shape' ~ BroadcastShapesF shape biasShape, Catch shape', output ~ Tensor (gradient <|> biasGradient) (layout <+> biasLayout) (device <+> biasDevice) (dataType <+> biasDataType) shape') => HasForward (GBias (NamedModel (Tensor biasGradient biasLayout biasDevice biasDataType biasShape))) (Tensor gradient layout device dataType shape) generatorDevice output generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GLMHead

Methods

forward :: MonadThrow m => GBias (NamedModel (Tensor biasGradient biasLayout biasDevice biasDataType biasShape)) -> Tensor gradient layout device dataType shape -> Generator generatorDevice -> m (output, Generator generatorDevice) 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 #

type Rep (NamedModel model) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type Rep (NamedModel model) = D1 ('MetaData "NamedModel" "Torch.GraduallyTyped.NN.Class" "hasktorch-gradually-typed-0.2.0.0-1KV1aIPzzbp6JpSr37tC1K" 'False) (C1 ('MetaCons "NamedModel" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 model)))
type ModelSpec (NamedModel model) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type ModelSpec (NamedModel model) = NamedModel (ModelSpec model)

pattern (::>) :: Text -> model -> NamedModel model Source #

class HasForward model input generatorDevice output generatorOutputDevice | model input generatorDevice -> output, model input generatorDevice -> generatorOutputDevice where Source #

Minimal complete definition

Nothing

Methods

forward Source #

Arguments

:: forall m. MonadThrow m 
=> model

model

-> input

model input, typically a tensor or a tuple of tensors

-> Generator generatorDevice

random generator

-> m (output, Generator generatorOutputDevice)

output of the model with an updated generator

forward m i g for a model m, an input i, and a generator g returns the tuple (o, g') where o is the output of the model applied to the input and g' is the updated generator. forward m i g may throw an exception if the input i or the generator g are not compatible with the model m.

default forward :: forall m. (MonadThrow m, Generic model, GHasForward (Rep model) input generatorDevice output generatorOutputDevice) => model -> input -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

Instances

Instances details
(input ~ Tensor gradient layout device dataType shape, output ~ Tensor gradient layout (device <+> generatorDevice) dataType shape, generatorOutputDevice ~ (device <+> generatorDevice), SGetDevice device, SGetGeneratorDevice generatorDevice) => HasForward Dropout input generatorDevice output generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Dropout

Methods

forward :: MonadThrow m => Dropout -> input -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

HasForward () input generatorDevice input generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

forward :: MonadThrow m => () -> input -> Generator generatorDevice -> m (input, Generator generatorDevice) Source #

(Catch (predShape <+> targetShape), output ~ Tensor (predGradient <|> targetGradient) (predLayout <+> targetLayout) (predDevice <+> targetDevice) (predDataType <+> targetDataType) ('Shape ('[] :: [Dim (Name Symbol) (Size Nat)]))) => HasForward MSELoss (Tensor predGradient predLayout predDevice predDataType predShape, Tensor targetGradient targetLayout targetDevice targetDataType targetShape) generatorDevice output generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Loss

Methods

forward :: MonadThrow m => MSELoss -> (Tensor predGradient predLayout predDevice predDataType predShape, Tensor targetGradient targetLayout targetDevice targetDataType targetShape) -> Generator generatorDevice -> m (output, Generator generatorDevice) Source #

MkTransformerPaddingMaskC layout device dataType shape output => HasForward MkTransformerPaddingMask (Tensor gradient layout device dataType shape) generatorDevice output generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.Type

Methods

forward :: MonadThrow m => MkTransformerPaddingMask -> Tensor gradient layout device dataType shape -> Generator generatorDevice -> m (output, Generator generatorDevice) Source #

HasForward Gelu (Tensor requiresGradient layout device dataType shape) generator (Tensor requiresGradient layout device dataType shape) generator Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Activation

Methods

forward :: MonadThrow m => Gelu -> Tensor requiresGradient layout device dataType shape -> Generator generator -> m (Tensor requiresGradient layout device dataType shape, Generator generator) Source #

HasForward GeluNew (Tensor requiresGradient layout device dataType shape) generator (Tensor requiresGradient layout device dataType shape) generator Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Activation

Methods

forward :: MonadThrow m => GeluNew -> Tensor requiresGradient layout device dataType shape -> Generator generator -> m (Tensor requiresGradient layout device dataType shape, Generator generator) Source #

HasForward Relu (Tensor requiresGradient layout device dataType shape) generator (Tensor requiresGradient layout device dataType shape) generator Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Activation

Methods

forward :: MonadThrow m => Relu -> Tensor requiresGradient layout device dataType shape -> Generator generator -> m (Tensor requiresGradient layout device dataType shape, Generator generator) Source #

HasForward Tanh (Tensor requiresGradient layout device dataType shape) generator (Tensor requiresGradient layout device dataType shape) generator Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Activation

Methods

forward :: MonadThrow m => Tanh -> Tensor requiresGradient layout device dataType shape -> Generator generator -> m (Tensor requiresGradient layout device dataType shape, Generator generator) Source #

MkPosC device shape seqDim seqName seqSize output => HasForward MkAbsPos (Tensor gradient layout device dataType shape) generatorDevice (Tensor ('Gradient 'WithoutGradient) ('Layout 'Dense) device ('DataType 'Int64) ('Shape '['Dim ('Name "*") seqSize])) generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.Type

Methods

forward :: MonadThrow m => MkAbsPos -> Tensor gradient layout device dataType shape -> Generator generatorDevice -> m (Tensor ('Gradient 'WithoutGradient) ('Layout 'Dense) device ('DataType 'Int64) ('Shape '['Dim ('Name "*") seqSize]), Generator generatorDevice) Source #

HasForward (ListToTuple models) input generatorDevice output generatorOutputDevice => HasForward (ModelStack models) input generatorDevice output generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

forward :: MonadThrow m => ModelStack models -> input -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

HasForward model input generatorDevice output generatorOutputDevice => HasForward (NamedModel model) input generatorDevice output generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

forward :: MonadThrow m => NamedModel model -> input -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

HasForward a input generatorDevice output generatorOutputDevice => HasForward (Wrap a) input generatorDevice output generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

forward :: MonadThrow m => Wrap a -> input -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

(input ~ Tensor inputGradient inputLayout inputDevice inputDataType inputShape, SGetLayout inputLayout, SGetDevice inputDevice, SGetDataType inputDataType, SGetShape inputShape, inputBatchDim ~ (inputShape ! 0), inputSeqDim ~ (inputShape ! 1), Scalar fillValue, rightShiftedInput ~ Tensor (inputGradient <|> 'Gradient 'WithoutGradient) inputLayout inputDevice inputDataType (ReplaceDimF ('SelectDim ('ByIndex 1 :: By Symbol Natural)) (inputShape <+> 'Shape '[inputBatchDim, inputSeqDim]) (AddDimF inputSeqDim ('Dim ('Name "*") ('Size 1))))) => HasForward (ShiftRight fillValue) input generator rightShiftedInput generator Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.Type

Methods

forward :: MonadThrow m => ShiftRight fillValue -> input -> Generator generator -> m (rightShiftedInput, Generator generator) Source #

(HasForward block (query, attentionBias) generatorDevice output generatorOutputDevice, HasForward block (output, attentionBias) generatorOutputDevice output generatorOutputDevice) => HasForward (GTransformerStack (Vector n block)) (query, attentionBias) generatorDevice output generatorOutputDevice Source #

HasForward instance for GTransformerStack in an encoder configuration.

┌───────┐  ┌───────────────┐
│ query │  │ attentionBias │
└───┬───┘  └───────┬───────┘
    │              │
    ▼              │
  block◄───────────┤
    ▼              │
  block◄───────────┤
    ▼              │
   ...            ...
    ▼              │
  block◄───────────┘
    │
    ▼
┌───────┐
│ query │
└───────┘
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GStack

Methods

forward :: MonadThrow m => GTransformerStack (Vector n block) -> (query, attentionBias) -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

HasForward (GTransformerStack (Vector 0 block)) (query, attentionBias) generatorDevice query generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GStack

Methods

forward :: MonadThrow m => GTransformerStack (Vector 0 block) -> (query, attentionBias) -> Generator generatorDevice -> m (query, Generator generatorDevice) Source #

HasForward block (query, attentionBias) generatorDevice output generatorOutputDevice => HasForward (GTransformerStack (Vector 1 block)) (query, attentionBias) generatorDevice output generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GStack

Methods

forward :: MonadThrow m => GTransformerStack (Vector 1 block) -> (query, attentionBias) -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

MkTransformerCrossAttentionMaskC dataType decoderInputShape decoderInputSeqDim inputPaddingMaskGradient inputPaddingMaskLayout inputPaddingMaskDevice inputPaddingMaksDataType inputPaddingMaskShape seqDim output => HasForward (MkTransformerCrossAttentionMask dataType) (Tensor decoderInputGradient decoderInputLayout decoderInputDevice decoderInputDataType decoderInputShape, Tensor inputPaddingMaskGradient inputPaddingMaskLayout inputPaddingMaskDevice inputPaddingMaksDataType inputPaddingMaskShape) generatorDevice output generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.Type

Methods

forward :: MonadThrow m => MkTransformerCrossAttentionMask dataType -> (Tensor decoderInputGradient decoderInputLayout decoderInputDevice decoderInputDataType decoderInputShape, Tensor inputPaddingMaskGradient inputPaddingMaskLayout inputPaddingMaskDevice inputPaddingMaksDataType inputPaddingMaskShape) -> Generator generatorDevice -> m (output, Generator generatorDevice) Source #

(HasForward block (query, key, attentionBias, crossAttentionBias) generatorDevice output generatorOutputDevice, HasForward block (output, key, attentionBias, crossAttentionBias) generatorOutputDevice output generatorOutputDevice) => HasForward (GTransformerStack (Vector n block)) (query, key, attentionBias, crossAttentionBias) generatorDevice output generatorOutputDevice Source #

HasForward instance for GTransformerStack in a decoder configuration.

┌───────┐  ┌─────┐  ┌───────────────┐  ┌────────────────────┐
│ query │  │ key │  │ attentionBias │  │ crossAttentionBias │
└───┬───┘  └──┬──┘  └───────┬───────┘  └─────────┬──────────┘
    │         │             │                    │
    ▼         │             │                    │
  block◄──────┤◄────────────┤◄───────────────────┤
    ▼         │             │                    │
  block◄──────┤◄────────────┤◄───────────────────┤
    ▼         │             │                    │
   ...       ...           ...                  ...
    ▼         │             │                    │
  block◄──────┘◄────────────┘◄───────────────────┘
    │
    ▼
┌───────┐
│ query │
└───────┘
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GStack

Methods

forward :: MonadThrow m => GTransformerStack (Vector n block) -> (query, key, attentionBias, crossAttentionBias) -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

HasForward (GTransformerStack (Vector 0 block)) (query, key, attentionBias, crossAttentionBias) generator query generator Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GStack

Methods

forward :: MonadThrow m => GTransformerStack (Vector 0 block) -> (query, key, attentionBias, crossAttentionBias) -> Generator generator -> m (query, Generator generator) Source #

HasForward block (query, key, attentionBias, crossAttentionBias) generatorDevice output generatorOutputDevice => HasForward (GTransformerStack (Vector 1 block)) (query, key, attentionBias, crossAttentionBias) generatorDevice output generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GStack

Methods

forward :: MonadThrow m => GTransformerStack (Vector 1 block) -> (query, key, attentionBias, crossAttentionBias) -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

(shape' ~ SoftmaxF selectDim shape, Catch shape', output ~ Tensor requiresGradient layout device dataType shape') => HasForward (LogSoftmax selectDim) (Tensor requiresGradient layout device dataType shape) generator output generator Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Activation

Methods

forward :: MonadThrow m => LogSoftmax selectDim -> Tensor requiresGradient layout device dataType shape -> Generator generator -> m (output, Generator generator) Source #

(shape' ~ SoftmaxF selectDim shape, Catch shape', output ~ Tensor requiresGradient layout device dataType shape') => HasForward (Softmax selectDim) (Tensor requiresGradient layout device dataType shape) generator output generator Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Activation

Methods

forward :: MonadThrow m => Softmax selectDim -> Tensor requiresGradient layout device dataType shape -> Generator generator -> m (output, Generator generator) Source #

(shape' ~ BroadcastShapesF shape biasShape, Catch shape', output ~ Tensor (gradient <|> biasGradient) (layout <+> biasLayout) (device <+> biasDevice) (dataType <+> biasDataType) shape') => HasForward (GBias (NamedModel (Tensor biasGradient biasLayout biasDevice biasDataType biasShape))) (Tensor gradient layout device dataType shape) generatorDevice output generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GLMHead

Methods

forward :: MonadThrow m => GBias (NamedModel (Tensor biasGradient biasLayout biasDevice biasDataType biasShape)) -> Tensor gradient layout device dataType shape -> Generator generatorDevice -> m (output, Generator generatorDevice) Source #

(shape' ~ BroadcastShapesF shape biasShape, Catch shape', output ~ Tensor (gradient <|> biasGradient) (layout <+> biasLayout) (device <+> biasDevice) (dataType <+> biasDataType) shape') => HasForward (GBias (Tensor biasGradient biasLayout biasDevice biasDataType biasShape)) (Tensor gradient layout device dataType shape) generatorDevice output generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GLMHead

Methods

forward :: MonadThrow m => GBias (Tensor biasGradient biasLayout biasDevice biasDataType biasShape) -> Tensor gradient layout device dataType shape -> Generator generatorDevice -> m (output, Generator generatorDevice) Source #

MkTransformerAttentionMaskC dataType inputGradient inputLayout inputDevice inputDataType inputShape seqDim output => HasForward (MkTransformerAttentionMask dataType) (Tensor inputGradient inputLayout inputDevice inputDataType inputShape) generatorDevice output generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.Type

Methods

forward :: MonadThrow m => MkTransformerAttentionMask dataType -> Tensor inputGradient inputLayout inputDevice inputDataType inputShape -> Generator generatorDevice -> m (output, Generator generatorDevice) Source #

MkTransformerDecoderAttentionMaskC dataType decoderInputLayout decoderInputDevice decoderInputShape seqDim output => HasForward (MkTransformerDecoderAttentionMask dataType) (Tensor decoderInputGradient decoderInputLayout decoderInputDevice decoderInputDataType decoderInputShape) generatorDevice output generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.Type

Methods

forward :: MonadThrow m => MkTransformerDecoderAttentionMask dataType -> Tensor decoderInputGradient decoderInputLayout decoderInputDevice decoderInputDataType decoderInputShape -> Generator generatorDevice -> m (output, Generator generatorDevice) Source #

HasForward (GBias ()) (Tensor gradient layout device dataType shape) generatorDevice (Tensor gradient layout device dataType shape) generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GLMHead

Methods

forward :: MonadThrow m => GBias () -> Tensor gradient layout device dataType shape -> Generator generatorDevice -> m (Tensor gradient layout device dataType shape, Generator generatorDevice) Source #

MkRelPosC device shape seqDim seqName seqSize output => HasForward (MkRelPos relPosEncBucketDim) (Tensor gradient layout device dataType shape) generatorDevice (Tensor ('Gradient 'WithoutGradient) ('Layout 'Dense) device ('DataType 'Int64) ('Shape '['Dim ('Name "*") ('Size 1), 'Dim ('Name "*") seqSize, 'Dim ('Name "*") seqSize])) generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.Type

Methods

forward :: MonadThrow m => MkRelPos relPosEncBucketDim -> Tensor gradient layout device dataType shape -> Generator generatorDevice -> m (Tensor ('Gradient 'WithoutGradient) ('Layout 'Dense) device ('DataType 'Int64) ('Shape '['Dim ('Name "*") ('Size 1), 'Dim ('Name "*") seqSize, 'Dim ('Name "*") seqSize]), Generator generatorDevice) 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 #

(HasForward a input generatorDevice output generatorOutputDevice, HasForward a output generatorOutputDevice output generatorOutputDevice) => HasForward (Vector n a) input generatorDevice output generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

forward :: MonadThrow m => Vector n a -> input -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

HasForward (Vector 0 a) input generatorDevice input generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

forward :: MonadThrow m => Vector 0 a -> input -> Generator generatorDevice -> m (input, Generator generatorDevice) Source #

HasForward a input generatorDevice output generatorOutputDevice => HasForward (Vector 1 a) input generatorDevice output generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

forward :: MonadThrow m => Vector 1 a -> input -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

(HasForward a input generatorDevice outputA generatorOutputADevice, HasForward b outputA generatorOutputADevice output generatorOutputDevice) => HasForward (a, b) input generatorDevice output generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

forward :: MonadThrow m => (a, b) -> input -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) 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 #

(HasForward dense (Tensor gradient layout device dataType shape) generatorDevice tensor0 generatorDevice0, HasForward activation tensor0 generatorDevice0 output generatorOutputDevice) => HasForward (GPooler dense activation) (Tensor gradient layout device dataType shape) generatorDevice output generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GPooler

Methods

forward :: MonadThrow m => GPooler dense activation -> Tensor gradient layout device dataType shape -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

(HasForward a input generatorDevice outputA generatorOutputADevice, HasForward b outputA generatorOutputADevice outputB generatorOutputBDevice, HasForward c outputB generatorOutputBDevice output generatorOutputDevice) => HasForward (a, b, c) input generatorDevice output generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

forward :: MonadThrow m => (a, b, c) -> input -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

(HasForward selfAttention (query, attentionBias) generatorDevice tensor0 generatorDevice0, HasForward feedForwardNetwork tensor0 generatorDevice0 output generatorOutputDevice) => HasForward (GTransformerBlock selfAttention () feedForwardNetwork) (query, attentionBias) generatorDevice output generatorOutputDevice Source #

HasForward instance for GTransformerBlock in an encoder configuration.

     ┌───────┐  ┌───────────────┐
     │ query │  │ attentionBias │
     └───┬───┘  └───────┬───────┘
         │              │
         ▼              │
  tbSelfAttention◄──────┘
         ▼
tbFeedForwardNetwork
         │
         ▼
     ┌───────┐
     │ query │
     └───────┘
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GBlock

Methods

forward :: MonadThrow m => GTransformerBlock selfAttention () feedForwardNetwork -> (query, attentionBias) -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

(HasForward selfAttention (query, attentionBias) generatorDevice tensor0 generatorDevice0, HasForward crossAttention (tensor0, key, crossAttentionBias) generatorDevice0 tensor1 generatorDevice1, HasForward feedForwardNetwork tensor1 generatorDevice1 output generatorOutputDevice) => HasForward (GTransformerBlock selfAttention crossAttention feedForwardNetwork) (query, key, attentionBias, crossAttentionBias) generatorDevice output generatorOutputDevice Source #

HasForward instance for GTransformerBlock in a decoder configuration.

┌──────────────────────┐  ┌───────┐  ┌─────┐  ┌────────────────────┐
│ decoderAttentionBias │  │ query │  │ key │  │ crossAttentionBias │
└──────────┬───────────┘  └───┬───┘  └──┬──┘  └─────────┬──────────┘
           │                  │         │               │
           │                  ▼         │               │
           └──────────►tdbSelfAttention │               │
                              │         │               │
                              ▼         ▼               │
                           tdbCrossAttention◄───────────┘
                              │
                              ▼
                    tdbFeedForwardNetwork
                              │
                              ▼
                          ┌───────┐
                          │ query │
                          └───────┘
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GBlock

Methods

forward :: MonadThrow m => GTransformerBlock selfAttention crossAttention feedForwardNetwork -> (query, key, attentionBias, crossAttentionBias) -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

(HasForward layer0 (Tensor gradient layout device dataType shape) generatorDevice (Tensor gradient' layout' device' dataType' shape') generatorDevice', HasForward activation (Tensor gradient' layout' device' dataType' shape') generatorDevice' (Tensor gradient' layout' device' dataType' shape') generatorDevice', HasForward layer1 (Tensor gradient layout device dataType shape) generatorDevice' (Tensor gradient' layout' device' dataType' shape') generatorDevice'', output ~ Tensor gradient' layout' device' dataType' shape', generatorOutputDevice ~ generatorDevice'') => HasForward (GGate layer0 activation layer1) (Tensor gradient layout device dataType shape) generatorDevice output generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GFeedForwardNetwork

Methods

forward :: MonadThrow m => GGate layer0 activation layer1 -> Tensor gradient layout device dataType shape -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

(HasForward a input generatorDevice outputA generatorOutputADevice, HasForward b outputA generatorOutputADevice outputB generatorOutputBDevice, HasForward c outputB generatorOutputBDevice outputC generatorOutputCDevice, HasForward d outputC generatorOutputCDevice output generatorOutputDevice) => HasForward (a, b, c, d) input generatorDevice output generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

forward :: MonadThrow m => (a, b, c, d) -> input -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

(HasForward initialLayerNorm (Tensor queryGradient queryLayout queryDevice queryDataType queryShape) generatorDevice tensor0 generatorDevice0, HasForward multiHeadAttention (tensor0, tensor0, tensor0, Tensor attentionBiasGradient attentionBiasLayout attentionBiasDevice attentionBiasDataType attentionBiasShape) generatorDevice0 tensor1 generatorDevice1, HasForward dropout tensor1 generatorDevice1 (Tensor gradient2 layout2 device2 dataType2 shape2) generatorDevice2, HasForward finalLayerNorm (Tensor (queryGradient <|> gradient2) (queryLayout <+> layout2) (queryDevice <+> device2) (queryDataType <+> dataType2) (BroadcastShapesF queryShape shape2)) generatorDevice2 output generatorOutputDevice, Catch (BroadcastShapesF queryShape shape2)) => HasForward (GSelfAttention initialLayerNorm multiHeadAttention dropout finalLayerNorm) (Tensor queryGradient queryLayout queryDevice queryDataType queryShape, Tensor attentionBiasGradient attentionBiasLayout attentionBiasDevice attentionBiasDataType attentionBiasShape) generatorDevice output generatorOutputDevice Source #

HasForward instance for GSelfAttention.

┌───────────────┐     ┌───────┐
│ attentionBias │     │ query │
└───────┬───────┘     └───┬───┘
        │                 │
        │           ┌─────┴─────┐
        │           │           │
        │           ▼           │
        │  (saInitialLayerNorm) │
        │           │           │
        │      ┌────┼────┐      │
        │      │    │    │      │
        │      ▼    ▼    ▼      │
        └─►saMultiHeadAttention │
                    │           │
                    ▼           │
                saDropout       │
                    │           │
                    └───►add◄───┘
                          │
                          ▼
                  (saFinalLayerNorm)
                          │
                          ▼
                      ┌───────┐
                      │ query │
                      └───────┘
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GSelfAttention

Methods

forward :: MonadThrow m => GSelfAttention initialLayerNorm multiHeadAttention dropout finalLayerNorm -> (Tensor queryGradient queryLayout queryDevice queryDataType queryShape, Tensor attentionBiasGradient attentionBiasLayout attentionBiasDevice attentionBiasDataType attentionBiasShape) -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

(HasForward mkPaddingMask input generatorDevice paddingMask generatorDevice, HasForward mkAttentionMask paddingMask generatorDevice attentionMask generatorDevice, HasForward mkPos input generatorDevice pos generatorDevice, HasForward model (EncoderOnlyTransformerInput input inputType pos attentionMask) generatorDevice (EncoderOnlyTransformerOutput output) generatorOutputDevice) => HasForward (GSimplifiedEncoderOnlyTransformer model mkPos mkPaddingMask mkAttentionMask) (SimplifiedEncoderOnlyTransformerInput input inputType) generatorDevice (SimplifiedEncoderOnlyTransformerOutput output paddingMask) generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GEncoderOnly

Methods

forward :: MonadThrow m => GSimplifiedEncoderOnlyTransformer model mkPos mkPaddingMask mkAttentionMask -> SimplifiedEncoderOnlyTransformerInput input inputType -> Generator generatorDevice -> m (SimplifiedEncoderOnlyTransformerOutput output paddingMask, Generator generatorOutputDevice) Source #

(HasForward initialLayerNorm (Tensor queryGradient queryLayout queryDevice queryDataType queryShape) generatorDevice tensor0 generatorDevice0, HasForward multiHeadAttention (tensor0, Tensor keyGradient keyLayout keyDevice keyDataType keyShape, Tensor keyGradient keyLayout keyDevice keyDataType keyShape, Tensor attentionBiasGradient attentionBiasLayout attentionBiasDevice attentionBiasDataType attentionBiasShape) generatorDevice0 tensor1 generatorDevice1, HasForward dropout tensor1 generatorDevice1 (Tensor gradient2 layout2 device2 dataType2 shape2) generatorDevice2, HasForward finalLayerNorm (Tensor (queryGradient <|> gradient2) (queryLayout <+> layout2) (queryDevice <+> device2) (queryDataType <+> dataType2) (BroadcastShapesF queryShape shape2)) generatorDevice2 output generatorOutputDevice, Catch (BroadcastShapesF queryShape shape2)) => HasForward (GCrossAttention initialLayerNorm multiHeadAttention dropout finalLayerNorm) (Tensor queryGradient queryLayout queryDevice queryDataType queryShape, Tensor keyGradient keyLayout keyDevice keyDataType keyShape, Tensor attentionBiasGradient attentionBiasLayout attentionBiasDevice attentionBiasDataType attentionBiasShape) generatorDevice output generatorOutputDevice Source #

HasForward instance for GCrossAttention.

       ┌───────┐    ┌─────┐    ┌───────────────┐
       │ query │    │ key │    │ attentionBias │
       └───┬───┘    └──┬──┘    └───────┬───────┘
           │           │               │
┌──────────┤           │               │
│          │           │               │
│          ▼           │               │
│ (caInitialLayerNorm) │               │
│          │           │               │
│          │       ┌───┴───┐           │
│          │       │       │           │
│          ▼       ▼       ▼           │
│        caMultiheadAttention◄─────────┘
│                  │
│                  ▼
│              caDropout
│                  │
└──────►add◄───────┘
         │
         ▼
 (caFinalLayerNorm)
         │
         ▼
     ┌───────┐
     │ query │
     └───────┘
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GCrossAttention

Methods

forward :: MonadThrow m => GCrossAttention initialLayerNorm multiHeadAttention dropout finalLayerNorm -> (Tensor queryGradient queryLayout queryDevice queryDataType queryShape, Tensor keyGradient keyLayout keyDevice keyDataType keyShape, Tensor attentionBiasGradient attentionBiasLayout attentionBiasDevice attentionBiasDataType attentionBiasShape) -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

(HasForward a input generatorDevice outputA generatorOutputADevice, HasForward b outputA generatorOutputADevice outputB generatorOutputBDevice, HasForward c outputB generatorOutputBDevice outputC generatorOutputCDevice, HasForward d outputC generatorOutputCDevice outputD generatorOutputDDevice, HasForward e outputD generatorOutputDDevice output generatorOutputDevice) => HasForward (a, b, c, d, e) input generatorDevice output generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

forward :: MonadThrow m => (a, b, c, d, e) -> input -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

(HasForward sharedEmbedding input generatorDevice embeddingOutput embeddingGeneratorOutputDevice, embeddingOutput ~ Tensor requiresGradient' layout' device' dataType' shape', HasForward encoder (embeddingOutput, pos, attentionMask) embeddingGeneratorOutputDevice encoderOutput generatorOutputDevice) => HasForward (GEncoderDecoderTransformer inputEmbedDim encoder decoder sharedEmbedding head) (EncoderDecoderTransformerInput' input pos attentionMask) generatorDevice (EncoderDecoderTransformerOutput' encoderOutput) generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GEncoderDecoder

Methods

forward :: MonadThrow m => GEncoderDecoderTransformer inputEmbedDim encoder decoder sharedEmbedding head -> EncoderDecoderTransformerInput' input pos attentionMask -> Generator generatorDevice -> m (EncoderDecoderTransformerOutput' encoderOutput, Generator generatorOutputDevice) Source #

(HasForward encoderEmbedding input generatorDevice embeddingOutput embeddingGeneratorOutputDevice, embeddingOutput ~ Tensor gradient' layout' device' dataType' shape', HasForward encoderTypeEmbedding inputType embeddingGeneratorOutputDevice typeEmbeddingOutput typeEmbeddingGeneratorOutputDevice, typeEmbeddingOutput ~ Tensor gradient'' layout'' device'' dataType'' shape'', HasForward encoder (Tensor (gradient' <|> gradient'') (layout' <+> layout'') (device' <+> device'') (dataType' <+> dataType'') (BroadcastShapesF shape' shape''), pos, attentionMask) typeEmbeddingGeneratorOutputDevice encoderOutput encoderGeneratorOutputDevice, Catch (BroadcastShapesF shape' shape''), HasForward head encoderOutput encoderGeneratorOutputDevice headOutput generatorOutputDevice) => HasForward (GEncoderOnlyTransformer inputEmbedDim encoder encoderEmbedding encoderTypeEmbedding head) (EncoderOnlyTransformerInput input inputType pos attentionMask) generatorDevice (EncoderOnlyTransformerOutput headOutput) generatorOutputDevice Source #

HasForward instance for encoder-only transformers with optional scaling and head.

   ┌───────┐    ┌───────────┐  ┌─────┐  ┌───────────────┐
   │ input │    │ inputType │  │ pos │  │ attentionMask │
   └───┬───┘    └─────┬─────┘  └──┬──┘  └──────┬────────┘
       │              │           │            │
       ▼              ▼           │            │
 eotEmbedding  eotTypeEmbedding   │            │
       ▼              ▼           │            │
(embedScaling)  (embedScaling)    │            │
       │              │           │            │
       └────►add◄─────┘           │            │
              │                   │            │
              ▼                   │            │
         eotEncoder◄──────────────┘◄───────────┘
              ▼
          (eotHead)
              │
              ▼
         ┌────────┐
         │ output │
         └────────┘
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GEncoderOnly

Methods

forward :: MonadThrow m => GEncoderOnlyTransformer inputEmbedDim encoder encoderEmbedding encoderTypeEmbedding head -> EncoderOnlyTransformerInput input inputType pos attentionMask -> Generator generatorDevice -> m (EncoderOnlyTransformerOutput headOutput, Generator generatorOutputDevice) Source #

(SGetShape normalizedShape, output ~ Tensor (gradient <|> gradient') ('Layout 'Dense <+> layout') (device <+> device') (dataType <+> dataType') (LayerNormWithBiasF normalizedShape normalizedShape shape')) => HasForward (LayerNorm 'WithBias gradient device dataType normalizedShape) (Tensor gradient' layout' device' dataType' shape') generatorDevice output generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Normalization

Methods

forward :: MonadThrow m => LayerNorm 'WithBias gradient device dataType normalizedShape -> Tensor gradient' layout' device' dataType' shape' -> Generator generatorDevice -> m (output, Generator generatorDevice) Source #

(SGetShape normalizedShape, SGetShape shape', output ~ Tensor (gradient <|> gradient') ('Layout 'Dense <+> layout') (device <+> device') (dataType <+> dataType') (LayerNormWithoutBiasF normalizedShape shape')) => HasForward (LayerNorm 'WithoutBias gradient device dataType normalizedShape) (Tensor gradient' layout' device' dataType' shape') generatorDevice output generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Normalization

Methods

forward :: MonadThrow m => LayerNorm 'WithoutBias gradient device dataType normalizedShape -> Tensor gradient' layout' device' dataType' shape' -> Generator generatorDevice -> m (output, Generator generatorDevice) Source #

(HasForward sharedEmbedding decoderInput generatorDevice embeddingOutput' embeddingGeneratorOutputDevice', embeddingOutput' ~ Tensor requiresGradient'' layout'' device'' dataType'' shape'', HasForward decoder (embeddingOutput', encoderOutput, decoderPos, decoderAttentionMask, crossAttentionMask) embeddingGeneratorOutputDevice' decoderOutput decoderGeneratorOutputDevice, HasForward head decoderOutput decoderGeneratorOutputDevice headOutput generatorOutputDevice) => HasForward (GEncoderDecoderTransformer inputEmbedDim encoder decoder sharedEmbedding head) (EncoderDecoderTransformerGenerationInput decoderInput encoderOutput decoderPos decoderAttentionMask crossAttentionMask) generatorDevice (EncoderDecoderTransformerOutput headOutput encoderOutput) generatorOutputDevice Source #

HasForward instance for encoder-decoder transformers with optional head. Use this instance for sequence generation once the encoder's output is available.

┌───────────────┐  ┌──────────────┐  ┌────────────┐  ┌──────────────────────┐  ┌────────────────────┐
│ encoderOutput │  │ decoderInput │  │ decoderPos │  │ decoderAttentionMask │  │ crossAttentionMask │
└───────┬───────┘  └───────┬──────┘  └──────┬─────┘  └───────────┬──────────┘  └──────────┬─────────┘
        │                  │                │                    │                        │
        │                  ▼                │                    │                        │
        │          edtSharedEmbedding       │                    │                        │
        │                  ▼                │                    │                        │
        │            (embedScaling)         │                    │                        │
        │                  ▼                │                    │                        │
        ├────────────►edtDecoder◄───────────┘◄───────────────────┘◄───────────────────────┘
        │                  │
        │              (edtHead)
        │                  │
        ▼                  ▼
┌───────────────┐  ┌───────────────┐
│ encoderOutput │  │ decoderOutput │
└───────────────┘  └───────────────┘
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GEncoderDecoder

Methods

forward :: MonadThrow m => GEncoderDecoderTransformer inputEmbedDim encoder decoder sharedEmbedding head -> EncoderDecoderTransformerGenerationInput decoderInput encoderOutput decoderPos decoderAttentionMask crossAttentionMask -> Generator generatorDevice -> m (EncoderDecoderTransformerOutput headOutput encoderOutput, Generator generatorOutputDevice) Source #

(HasForward (GEncoderDecoderTransformer inputEmbedDim encoder decoder sharedEmbedding head) (EncoderDecoderTransformerInput' input pos attentionMask) generatorDevice (EncoderDecoderTransformerOutput' encoderOutput) generatorDevice', HasForward (GEncoderDecoderTransformer inputEmbedDim encoder decoder sharedEmbedding head) (EncoderDecoderTransformerGenerationInput decoderInput encoderOutput decoderPos decoderAttentionMask crossAttentionMask) generatorDevice' (EncoderDecoderTransformerOutput headOutput encoderOutput) generatorOutputDevice) => HasForward (GEncoderDecoderTransformer inputEmbedDim encoder decoder sharedEmbedding head) (EncoderDecoderTransformerInput input decoderInput pos decoderPos attentionMask decoderAttentionMask crossAttentionMask) generatorDevice (EncoderDecoderTransformerOutput headOutput encoderOutput) generatorOutputDevice Source #

HasForward instance for encoder-decoder transformers with optional head.

    ┌───────┐  ┌─────┐  ┌───────────────┐  ┌──────────────┐  ┌────────────┐  ┌──────────────────────┐  ┌────────────────────┐
    │ input │  │ pos │  │ attentionMask │  │ decoderInput │  │ decoderPos │  │ decoderAttentionMask │  │ crossAttentionMask │
    └───┬───┘  └──┬──┘  └──────┬────────┘  └──────┬───────┘  └─────┬──────┘  └──────────┬───────────┘  └─────────┬──────────┘
        │         │            │                  │                │                    │                        │
        ▼         │            │                  │                │                    │                        │
edtSharedEmbedding│            │                  │                │                    │                        │
        ▼         │            │                  │                │                    │                        │
  (embedScaling)  │            │                  │                │                    │                        │
        ▼         │            │                  │                │                    │                        │
    edtEncoder◄───┘◄───────────┘                  ▼                │                    │                        │
        │                                 edtSharedEmbedding       │                    │                        │
        │                                         ▼                │                    │                        │
        │                                   (embedScaling)         │                    │                        │
        │                                         ▼                │                    │                        │
        ├────────────────────────────────────►edtDecoder◄──────────┘◄───────────────────┘◄───────────────────────┘
        │                                         ▼
        │                                     (edtHead)
        │                                         │
        ▼                                         ▼
┌───────────────┐                         ┌───────────────┐
│ encoderOutput │                         │ decoderOutput │
└───────────────┘                         └───────────────┘
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GEncoderDecoder

Methods

forward :: MonadThrow m => GEncoderDecoderTransformer inputEmbedDim encoder decoder sharedEmbedding head -> EncoderDecoderTransformerInput input decoderInput pos decoderPos attentionMask decoderAttentionMask crossAttentionMask -> Generator generatorDevice -> m (EncoderDecoderTransformerOutput headOutput encoderOutput, Generator generatorOutputDevice) Source #

(HasForward a input generatorDevice outputA generatorOutputADevice, HasForward b outputA generatorOutputADevice outputB generatorOutputBDevice, HasForward c outputB generatorOutputBDevice outputC generatorOutputCDevice, HasForward d outputC generatorOutputCDevice outputD generatorOutputDDevice, HasForward e outputD generatorOutputDDevice outputE generatorOutputEDevice, HasForward f outputE generatorOutputEDevice output generatorOutputDevice) => HasForward (a, b, c, d, e, f) input generatorDevice output generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

forward :: MonadThrow m => (a, b, c, d, e, f) -> input -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

(HasForward dense (Tensor gradient layout device dataType shape) generatorDevice tensor0 generatorDevice0, HasForward activation tensor0 generatorDevice0 tensor1 generatorDevice1, HasForward layerNorm tensor1 generatorDevice1 tensor2 generatorDevice2, HasForward decoder tensor2 generatorDevice2 (Tensor gradient3 layout3 device3 dataType3 shape3) generatorDevice3, HasForward bias (Tensor gradient3 layout3 device3 dataType3 shape3) generatorDevice3 output generatorOutputDevice) => HasForward (GLMHead inputEmbedDim dense activation layerNorm decoder bias) (Tensor gradient layout device dataType shape) generatorDevice output generatorOutputDevice Source #

HasForward instance for LMHead.

    ┌───────┐
    │ input │
    └───┬───┘
        │
        ▼
  (lmHeadDense)
        ▼
(lmHeadActivation)
        ▼
(lmHeadLayerNorm)
        ▼
  lmHeadDecoder
        ▼
    (scaling)
        ▼
   (lmHeadBias)
        │
        ▼
┌───────────────┐
│ decoderOutput │
└───────────────┘
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GLMHead

Methods

forward :: MonadThrow m => GLMHead inputEmbedDim dense activation layerNorm decoder bias -> Tensor gradient layout device dataType shape -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

(HasForward a input generatorDevice outputA generatorOutputADevice, HasForward b outputA generatorOutputADevice outputB generatorOutputBDevice, HasForward c outputB generatorOutputBDevice outputC generatorOutputCDevice, HasForward d outputC generatorOutputCDevice outputD generatorOutputDDevice, HasForward e outputD generatorOutputDDevice outputE generatorOutputEDevice, HasForward f outputE generatorOutputEDevice outputF generatorOutputFDevice, HasForward g outputF generatorOutputFDevice output generatorOutputDevice) => HasForward (a, b, c, d, e, f, g) input generatorDevice output generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

forward :: MonadThrow m => (a, b, c, d, e, f, g) -> input -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

(HasForward mkPaddingMask input generatorDevice inputPaddingMask generatorDevice, HasForward mkAttentionMask inputPaddingMask generatorDevice attentionMask generatorDevice, HasForward mkPos input generatorDevice pos generatorDevice, HasForward model (EncoderDecoderTransformerInput' input pos attentionMask) generatorDevice (EncoderDecoderTransformerOutput' encoderOutput) generatorOutputDevice) => HasForward (GSimplifiedEncoderDecoderTransformer model mkPos mkDecoderPos mkPaddingMask mkAttentionMask mkCrossAttentionMask mkDecoderAttentionMask) (SimplifiedEncoderDecoderTransformerInput' input) generatorDevice (SimplifiedEncoderDecoderTransformerOutput' encoderOutput inputPaddingMask) generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GEncoderDecoder

Methods

forward :: MonadThrow m => GSimplifiedEncoderDecoderTransformer model mkPos mkDecoderPos mkPaddingMask mkAttentionMask mkCrossAttentionMask mkDecoderAttentionMask -> SimplifiedEncoderDecoderTransformerInput' input -> Generator generatorDevice -> m (SimplifiedEncoderDecoderTransformerOutput' encoderOutput inputPaddingMask, Generator generatorOutputDevice) Source #

(HasForward (GSimplifiedEncoderDecoderTransformer model mkPos mkDecoderPos mkPaddingMask mkAttentionMask mkCrossAttentionMask mkDecoderAttentionMask) (SimplifiedEncoderDecoderTransformerInput input decoderInput) generatorDevice (SimplifiedEncoderDecoderTransformerOutput decoderOutput encoderOutput decoderInput inputPaddingMask) generatorOutputDevice, decoderInput ~ Tensor targetGradient targetLayout targetDevice targetDataType (IndexDims ('Indices '['SliceAll :: IndexType (Index Natural), 'SliceUpTo ('NegativeIndex 1)]) targetShape), decoderOutput ~ Tensor doGradient doLayout doDevice doDataType doShape, logProbsShape ~ SoftmaxF ('SelectDim ('ByIndex 2 :: By Symbol Natural)) doShape, Catch logProbsShape, unsqueezedTargetShape ~ UnsqueezeF ('SelectDim ('ByIndex 2 :: By Symbol Natural)) targetShape, Catch unsqueezedTargetShape, gatheredLogProbsShape ~ GatherDimF ('SelectDim ('ByIndex 2 :: By Symbol Natural)) unsqueezedTargetShape logProbsShape, Catch gatheredLogProbsShape, Catch (targetDataType <+> 'DataType 'Int64), logLikelihoodShape ~ SqueezeDimF ('SelectDim ('ByIndex 2 :: By Symbol Natural)) gatheredLogProbsShape, Catch logLikelihoodShape, MeanAllCheckF logLikelihoodShape, loss ~ Tensor (targetGradient <|> doGradient) (targetLayout <+> doLayout) (targetDevice <+> doDevice) doDataType ('Shape ('[] :: [Dim (Name Symbol) (Size Nat)])), generatorOutputDevice ~ generatorDevice) => HasForward (GSimplifiedEncoderDecoderTransformer model mkPos mkDecoderPos mkPaddingMask mkAttentionMask mkCrossAttentionMask mkDecoderAttentionMask) (SimplifiedEncoderDecoderTransformerTrainingInput input (Tensor targetGradient targetLayout targetDevice targetDataType targetShape)) generatorDevice (SimplifiedEncoderDecoderTransformerTrainingOutput loss) generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GEncoderDecoder

Methods

forward :: MonadThrow m => GSimplifiedEncoderDecoderTransformer model mkPos mkDecoderPos mkPaddingMask mkAttentionMask mkCrossAttentionMask mkDecoderAttentionMask -> SimplifiedEncoderDecoderTransformerTrainingInput input (Tensor targetGradient targetLayout targetDevice targetDataType targetShape) -> Generator generatorDevice -> m (SimplifiedEncoderDecoderTransformerTrainingOutput loss, Generator generatorOutputDevice) Source #

(HasForward (GSimplifiedEncoderDecoderTransformer model mkPos mkDecoderPos mkPaddingMask mkAttentionMask mkCrossAttentionMask mkDecoderAttentionMask) (SimplifiedEncoderDecoderTransformerInput' input) generatorDevice (SimplifiedEncoderDecoderTransformerOutput' encoderOutput inputPaddingMask) generatorDevice', HasForward (GSimplifiedEncoderDecoderTransformer model mkPos mkDecoderPos mkPaddingMask mkAttentionMask mkCrossAttentionMask mkDecoderAttentionMask) (SimplifiedEncoderDecoderTransformerGenerationInput decoderInput encoderOutput inputPaddingMask) generatorDevice' (SimplifiedEncoderDecoderTransformerOutput decoderOutput encoderOutput decoderInput inputPaddingMask) generatorOutputDevice) => HasForward (GSimplifiedEncoderDecoderTransformer model mkPos mkDecoderPos mkPaddingMask mkAttentionMask mkCrossAttentionMask mkDecoderAttentionMask) (SimplifiedEncoderDecoderTransformerInput input decoderInput) generatorDevice (SimplifiedEncoderDecoderTransformerOutput decoderOutput encoderOutput decoderInput inputPaddingMask) generatorOutputDevice Source #

HasForward instance for simplified encoder-decoder models.

Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GEncoderDecoder

Methods

forward :: MonadThrow m => GSimplifiedEncoderDecoderTransformer model mkPos mkDecoderPos mkPaddingMask mkAttentionMask mkCrossAttentionMask mkDecoderAttentionMask -> SimplifiedEncoderDecoderTransformerInput input decoderInput -> Generator generatorDevice -> m (SimplifiedEncoderDecoderTransformerOutput decoderOutput encoderOutput decoderInput inputPaddingMask, Generator generatorOutputDevice) Source #

(HasForward initialLayerNorm (Tensor inputGradient inputLayout inputDevice inputDataType inputShape) generatorDevice tensor0 generatorDevice0, HasForward initialDropout tensor0 generatorDevice0 tensor1 generatorDevice1, HasForward relPosEnc (Tensor relPosGradient relPosLayout relPosDevice relPosDataType relPosShape) generatorDevice1 (Tensor relPosEncGradient relPosEncLayout relPosEncDevice relPosEncDataType relPosEncShape) generatorDevice2, HasForward stack (tensor1, Tensor (relPosEncGradient <|> attentionMaskGradient) (relPosEncLayout <+> attentionMaskLayout) (relPosEncDevice <+> attentionMaskDevice) (relPosEncDataType <+> attentionMaskDataType) (BroadcastShapesF doubleTransposedRelPosEncShape unsqueezedAttentionMaskShape)) generatorDevice2 tensor3 generatorDevice3, transposedRelPosEncShape ~ TransposeF ('SelectDim ('ByIndex 2 :: By Symbol Natural)) ('SelectDim ('ByIndex 3 :: By Symbol Natural)) relPosEncShape, Catch transposedRelPosEncShape, doubleTransposedRelPosEncShape ~ TransposeF ('SelectDim ('ByIndex 1 :: By Symbol Natural)) ('SelectDim ('ByIndex 2 :: By Symbol Natural)) transposedRelPosEncShape, Catch doubleTransposedRelPosEncShape, unsqueezedAttentionMaskShape ~ UnsqueezeF ('SelectDim ('ByIndex 1 :: By Symbol Natural)) attentionMaskShape, Catch unsqueezedAttentionMaskShape, Catch (BroadcastShapesF doubleTransposedRelPosEncShape unsqueezedAttentionMaskShape), HasForward finalLayerNorm tensor3 generatorDevice3 tensor4 generatorDevice4, HasForward finalDropout tensor4 generatorDevice4 output generatorOutputDevice) => HasForward (GTransformer () relPosEnc initialLayerNorm initialDropout stack finalLayerNorm finalDropout) (Tensor inputGradient inputLayout inputDevice inputDataType inputShape, Tensor relPosGradient relPosLayout relPosDevice relPosDataType relPosShape, Tensor attentionMaskGradient attentionMaskLayout attentionMaskDevice attentionMaskDataType attentionMaskShape) generatorDevice output generatorOutputDevice Source #

HasForward instance for GTransformer in an encoder configuration with relative positional encoding rather than absolute positional encoding.

     ┌───────┐  ┌────────┐  ┌───────────────┐
     │ input │  │ relPos │  │ attentionMask │
     └───┬───┘  └───┬────┘  └───────┬───────┘
         │          │               │
         │          ▼               │
         │     tRelPosEnc           │
         │          ▼               │
         │      transpose           │
         │          ▼               ▼
         │      transpose       unsqueeze
         ▼          │               │
(tInitialLayerNorm) │               │
         ▼          └─────►add◄─────┘
 (tInitialDropout)          │
         ▼                  │
      tStack◄───────────────┘
         ▼
 (tFinalLayerNorm)
         ▼
  (tFinalDropout)
         │
         ▼
    ┌────────┐
    │ output │
    └────────┘
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GTransformer

Methods

forward :: MonadThrow m => GTransformer () relPosEnc initialLayerNorm initialDropout stack finalLayerNorm finalDropout -> (Tensor inputGradient inputLayout inputDevice inputDataType inputShape, Tensor relPosGradient relPosLayout relPosDevice relPosDataType relPosShape, Tensor attentionMaskGradient attentionMaskLayout attentionMaskDevice attentionMaskDataType attentionMaskShape) -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

(HasForward posEnc (Tensor posGradient posLayout posDevice posDataType posShape) generatorDevice (Tensor posEncGradient posEncLayout posEncDevice posEncDataType posEncShape) generatorDevice0, HasForward initialLayerNorm (Tensor (inputGradient <|> posEncGradient) (inputLayout <+> posEncLayout) (inputDevice <+> posEncDevice) (inputDataType <+> posEncDataType) (BroadcastShapesF inputShape posEncShape)) generatorDevice0 tensor1 generatorDevice1, Catch (BroadcastShapesF inputShape posEncShape), HasForward initialDropout tensor1 generatorDevice1 tensor2 generatorDevice2, HasForward stack (tensor2, Tensor attentionMaskGradient attentionMaskLayout attentionMaskDevice attentionMaskDataType (UnsqueezeF ('SelectDim ('ByIndex 1 :: By Symbol Natural)) attentionMaskShape)) generatorDevice2 tensor3 generatorDevice3, Catch (UnsqueezeF ('SelectDim ('ByIndex 1 :: By Symbol Natural)) attentionMaskShape), HasForward finalLayerNorm tensor3 generatorDevice3 tensor4 generatorDevice4, HasForward finalDropout tensor4 generatorDevice4 output generatorOutputDevice) => HasForward (GTransformer posEnc () initialLayerNorm initialDropout stack finalLayerNorm finalDropout) (Tensor inputGradient inputLayout inputDevice inputDataType inputShape, Tensor posGradient posLayout posDevice posDataType posShape, Tensor attentionMaskGradient attentionMaskLayout attentionMaskDevice attentionMaskDataType attentionMaskShape) generatorDevice output generatorOutputDevice Source #

HasForward instance for GTransformer in an encoder configuration with absolute positional encoding rather than relative positional encoding.

┌───────┐  ┌─────┐  ┌───────────────┐
│ input │  │ pos │  │ attentionMask │
└───┬───┘  └─────┘  └───────┬───────┘
    │         │             │
    │         ▼             │
    │      tPosEnc          │
    │         │             │
    └──►add◄──┘             │
         │                  │
         ▼                  │
(tInitialLayerNorm)         │
         ▼                  ▼
 (tInitialDropout)     unsqueeze
         ▼                  │
      tStack◄───────────────┘
         ▼
 (tFinalLayerNorm)
         ▼
  (tFinalDropout)
         │
         ▼
    ┌────────┐
    │ output │
    └────────┘
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GTransformer

Methods

forward :: MonadThrow m => GTransformer posEnc () initialLayerNorm initialDropout stack finalLayerNorm finalDropout -> (Tensor inputGradient inputLayout inputDevice inputDataType inputShape, Tensor posGradient posLayout posDevice posDataType posShape, Tensor attentionMaskGradient attentionMaskLayout attentionMaskDevice attentionMaskDataType attentionMaskShape) -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

(HasForward mkPaddingMask decoderInput generatorDevice decoderInputPaddingMask generatorDevice, HasForward mkCrossAttentionMask (rightShiftedDecoderInput, inputPaddingMask) generatorDevice crossAttentionMask generatorDevice, HasForward mkDecoderAttentionMask rightShiftedDecoderInputPaddingMask generatorDevice decoderAttentionMask generatorDevice, HasForward (ShiftRight Int) decoderInput generatorDevice rightShiftedDecoderInput generatorDevice, HasForward (ShiftRight Int) decoderInputPaddingMask generatorDevice rightShiftedDecoderInputPaddingMask generatorDevice, HasForward mkDecoderPos rightShiftedDecoderInput generatorDevice decoderPos generatorDevice, HasForward model (EncoderDecoderTransformerGenerationInput rightShiftedDecoderInput encoderOutput decoderPos decoderAttentionMask crossAttentionMask) generatorDevice (EncoderDecoderTransformerOutput decoderOutput encoderOutput) generatorOutputDevice) => HasForward (GSimplifiedEncoderDecoderTransformer model mkPos mkDecoderPos mkPaddingMask mkAttentionMask mkCrossAttentionMask mkDecoderAttentionMask) (SimplifiedEncoderDecoderTransformerGenerationInput decoderInput encoderOutput inputPaddingMask) generatorDevice (SimplifiedEncoderDecoderTransformerOutput decoderOutput encoderOutput decoderInput inputPaddingMask) generatorOutputDevice Source #

HasForward instance for simplified encoder-decoder models. Use this instance for sequence generation once the encoder's output is available.

Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GEncoderDecoder

Methods

forward :: MonadThrow m => GSimplifiedEncoderDecoderTransformer model mkPos mkDecoderPos mkPaddingMask mkAttentionMask mkCrossAttentionMask mkDecoderAttentionMask -> SimplifiedEncoderDecoderTransformerGenerationInput decoderInput encoderOutput inputPaddingMask -> Generator generatorDevice -> m (SimplifiedEncoderDecoderTransformerOutput decoderOutput encoderOutput decoderInput inputPaddingMask, Generator generatorOutputDevice) Source #

(SGetLayout layout, KnownNat paddingIdx, Catch (dataType' <+> 'DataType 'Int64), output ~ Tensor (gradient <|> gradient') (layout <+> layout') (device <+> device') dataType (EmbeddingF ('Shape '[embedNumDim, embedDim]) shape')) => HasForward (Embedding gradient layout device dataType embedNumDim embedDim ('Just paddingIdx)) (Tensor gradient' layout' device' dataType' shape') generatorDevice output generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Sparse

Methods

forward :: MonadThrow m => Embedding gradient layout device dataType embedNumDim embedDim ('Just paddingIdx) -> Tensor gradient' layout' device' dataType' shape' -> Generator generatorDevice -> m (output, Generator generatorDevice) Source #

(SGetLayout layout, Catch (dataType' <+> 'DataType 'Int64), output ~ Tensor (gradient <|> gradient') (layout <+> layout') (device <+> device') dataType (EmbeddingF ('Shape '[embedNumDim, embedDim]) shape')) => HasForward (Embedding gradient layout device dataType embedNumDim embedDim ('Nothing :: Maybe Nat)) (Tensor gradient' layout' device' dataType' shape') generatorDevice output generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Sparse

Methods

forward :: MonadThrow m => Embedding gradient layout device dataType embedNumDim embedDim 'Nothing -> Tensor gradient' layout' device' dataType' shape' -> Generator generatorDevice -> m (output, Generator generatorDevice) Source #

(HasForward inputLayerNorm (Tensor queryGradient queryLayout queryDevice queryDataType queryShape) generatorDevice tensor0 generatorDevice0, HasForward inputTransformation tensor0 generatorDevice0 tensor1 generatorDevice1, HasForward activation tensor1 generatorDevice1 tensor2 generatorDevice2, HasForward activationDropout tensor2 generatorDevice2 tensor3 generatorDevice3, HasForward outputProjection tensor3 generatorDevice3 tensor4 generatorDevice4, HasForward outputDropout tensor4 generatorDevice4 (Tensor queryGradient5 queryLayout5 queryDevice5 queryDataType5 queryShape5) generatorDevice5, HasForward outputLayerNorm (Tensor (queryGradient <|> queryGradient5) (queryLayout <+> queryLayout5) (queryDevice <+> queryDevice5) (queryDataType <+> queryDataType5) (BroadcastShapesF queryShape queryShape5)) generatorDevice5 output generatorOutputDevice, Catch (BroadcastShapesF queryShape queryShape5)) => HasForward (GTransformerFeedForwardNetwork inputLayerNorm inputTransformation activation activationDropout outputProjection outputDropout outputLayerNorm) (Tensor queryGradient queryLayout queryDevice queryDataType queryShape) generatorDevice output generatorOutputDevice Source #

HasForward instance for GTransformerFeedForwardNetwork.

      ┌───────┐
      │ query ├────────┐
      └───┬───┘        │
          │            │
          ▼            │
 (ffnInputLayerNorm)   │
          ▼            │
ffnInputTransformation │
          ▼            │
    ffnActivation      │
          ▼            │
(ffnActivationDropout) │
          ▼            │
  ffnOutputProjecton   │
          ▼            │
   ffnOutputDropout    │
          │            │
          ▼            │
         add◄──────────┘
          │
          ▼
 (ffnOutputLayerNorm)
          │
          ▼
      ┌───────┐
      │ query │
      └───────┘
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GFeedForwardNetwork

Methods

forward :: MonadThrow m => GTransformerFeedForwardNetwork inputLayerNorm inputTransformation activation activationDropout outputProjection outputDropout outputLayerNorm -> Tensor queryGradient queryLayout queryDevice queryDataType queryShape -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

(HasForward initialLayerNorm (Tensor decoderInputGradient decoderInputLayout decoderInputDevice decoderInputDataType decoderInputShape) generatorDevice tensor0 generatorDevice0, HasForward initialDropout tensor0 generatorDevice0 tensor1 generatorDevice1, HasForward relPosEnc (Tensor decoderRelPosGradient decoderRelPosLayout decoderRelPosDevice decoderRelPosDataType decoderRelPosShape) generatorDevice1 (Tensor decoderRelPosEncGradient decoderRelPosEncLayout decoderRelPosEncDevice decoderRelPosEncDataType decoderRelPosEncShape) generatorDevice2, HasForward stack (tensor1, Tensor encoderOutputGradient encoderOutputLayout encoderOutputDevice encoderOutputDataType encoderOutputShape, Tensor (decoderRelPosEncGradient <|> decoderAttentionMaskGradient) (decoderRelPosEncLayout <+> decoderAttentionMaskLayout) (decoderRelPosEncDevice <+> decoderAttentionMaskDevice) (decoderRelPosEncDataType <+> decoderAttentionMaskDataType) (BroadcastShapesF doubleTransposedDecoderRelPosEncShape unsqueezedDecoderAttentionMaskShape), Tensor crossAttentionMaskGradient crossAttentionMaskLayout crossAttentionMaskDevice crossAttentionMaskDataType unsqueezedCrossAttentionMaskShape) generatorDevice2 tensor3 generatorDevice3, transposedDecoderRelPosEncShape ~ TransposeF ('SelectDim ('ByIndex 2 :: By Symbol Natural)) ('SelectDim ('ByIndex 3 :: By Symbol Natural)) decoderRelPosEncShape, Catch transposedDecoderRelPosEncShape, doubleTransposedDecoderRelPosEncShape ~ TransposeF ('SelectDim ('ByIndex 1 :: By Symbol Natural)) ('SelectDim ('ByIndex 2 :: By Symbol Natural)) transposedDecoderRelPosEncShape, Catch doubleTransposedDecoderRelPosEncShape, unsqueezedDecoderAttentionMaskShape ~ UnsqueezeF ('SelectDim ('ByIndex 1 :: By Symbol Natural)) decoderAttentionMaskShape, Catch unsqueezedDecoderAttentionMaskShape, unsqueezedCrossAttentionMaskShape ~ UnsqueezeF ('SelectDim ('ByIndex 1 :: By Symbol Natural)) crossAttentionMaskShape, Catch unsqueezedCrossAttentionMaskShape, Catch (BroadcastShapesF doubleTransposedDecoderRelPosEncShape unsqueezedDecoderAttentionMaskShape), HasForward finalLayerNorm tensor3 generatorDevice3 tensor4 generatorDevice4, HasForward finalDropout tensor4 generatorDevice4 output generatorOutputDevice) => HasForward (GTransformer () relPosEnc initialLayerNorm initialDropout stack finalLayerNorm finalDropout) (Tensor decoderInputGradient decoderInputLayout decoderInputDevice decoderInputDataType decoderInputShape, Tensor encoderOutputGradient encoderOutputLayout encoderOutputDevice encoderOutputDataType encoderOutputShape, Tensor decoderRelPosGradient decoderRelPosLayout decoderRelPosDevice decoderRelPosDataType decoderRelPosShape, Tensor decoderAttentionMaskGradient decoderAttentionMaskLayout decoderAttentionMaskDevice decoderAttentionMaskDataType decoderAttentionMaskShape, Tensor crossAttentionMaskGradient crossAttentionMaskLayout crossAttentionMaskDevice crossAttentionMaskDataType crossAttentionMaskShape) generatorDevice output generatorOutputDevice Source #

HasForward instance for GTransformer in a decoder configuration with relative positional encoding rather than absolute positional encoding.

  ┌──────────────┐  ┌───────────────┐  ┌───────────────┐  ┌──────────────────────┐  ┌────────────────────┐
  │ decoderInput │  │ encoderOutput │  │ decoderRelPos │  │ decoderAttentionMask │  │ crossAttentionMask │
  └──────┬───────┘  └───────┬───────┘  └───────┬───────┘  └──────────┬───────────┘  └─────────┬──────────┘
         │                  │                  │                     │                        │
         │                  │                  ▼                     │                        │
         │                  │             tdRelPosEnc                │                        │
         │                  │                  ▼                     │                        │
         │                  │              transpose                 │                        │
         │                  │                  ▼                     ▼                        ▼
         │                  │              transpose             unsqueeze                unsqueeze
         ▼                  │                  │                     │                        │
(tInitialLayerNorm)         │                  │                     │                        │
         ▼                  │                  └────────►add◄────────┘                        │
 (tInitialDropout)          │                             │                                   │
         ▼                  │                             │                                   │
      tStack◄───────────────┘◄────────────────────────────┘◄──────────────────────────────────┘
         ▼
 (tFinalLayerNorm)
         ▼
  (tFinalDropout)
         │
         ▼
    ┌────────┐
    │ output │
    └────────┘
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GTransformer

Methods

forward :: MonadThrow m => GTransformer () relPosEnc initialLayerNorm initialDropout stack finalLayerNorm finalDropout -> (Tensor decoderInputGradient decoderInputLayout decoderInputDevice decoderInputDataType decoderInputShape, Tensor encoderOutputGradient encoderOutputLayout encoderOutputDevice encoderOutputDataType encoderOutputShape, Tensor decoderRelPosGradient decoderRelPosLayout decoderRelPosDevice decoderRelPosDataType decoderRelPosShape, Tensor decoderAttentionMaskGradient decoderAttentionMaskLayout decoderAttentionMaskDevice decoderAttentionMaskDataType decoderAttentionMaskShape, Tensor crossAttentionMaskGradient crossAttentionMaskLayout crossAttentionMaskDevice crossAttentionMaskDataType crossAttentionMaskShape) -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

(HasForward posEnc (Tensor decoderPosGradient decoderPosLayout decoderPosDevice decoderPosDataType decoderPosShape) generatorDevice (Tensor decoderPosEncGradient decoderPosEncLayout decoderPosEncDevice decoderPosEncDataType decoderPosEncShape) generatorDevice0, HasForward initialLayerNorm (Tensor (decoderInputGradient <|> decoderPosEncGradient) (decoderInputLayout <+> decoderPosEncLayout) (decoderInputDevice <+> decoderPosEncDevice) (decoderInputDataType <+> decoderPosEncDataType) (BroadcastShapesF decoderInputShape decoderPosEncShape)) generatorDevice0 tensor1 generatorDevice1, HasForward initialDropout tensor1 generatorDevice1 tensor2 generatorDevice2, HasForward stack (tensor2, Tensor encoderOutputGradient encoderOutputLayout encoderOutputDevice encoderOutputDataType encoderOutputShape, Tensor decoderAttentionMaskGradient decoderAttentionMaskLayout decoderAttentionMaskDevice decoderAttentionMaskDataType (UnsqueezeF ('SelectDim ('ByIndex 1 :: By Symbol Natural)) decoderAttentionMaskShape), Tensor crossAttentionMaskGradient crossAttentionMaskLayout crossAttentionMaskDevice crossAttentionMaskDataType (UnsqueezeF ('SelectDim ('ByIndex 1 :: By Symbol Natural)) crossAttentionMaskShape)) generatorDevice2 tensor3 generatorDevice3, Catch (UnsqueezeF ('SelectDim ('ByIndex 1 :: By Symbol Natural)) decoderAttentionMaskShape), Catch (UnsqueezeF ('SelectDim ('ByIndex 1 :: By Symbol Natural)) crossAttentionMaskShape), Catch (BroadcastShapesF decoderInputShape decoderPosEncShape), HasForward finalLayerNorm tensor3 generatorDevice3 tensor4 generatorDevice4, HasForward finalDropout tensor4 generatorDevice4 output generatorOutputDevice) => HasForward (GTransformer posEnc () initialLayerNorm initialDropout stack finalLayerNorm finalDropout) (Tensor decoderInputGradient decoderInputLayout decoderInputDevice decoderInputDataType decoderInputShape, Tensor encoderOutputGradient encoderOutputLayout encoderOutputDevice encoderOutputDataType encoderOutputShape, Tensor decoderPosGradient decoderPosLayout decoderPosDevice decoderPosDataType decoderPosShape, Tensor decoderAttentionMaskGradient decoderAttentionMaskLayout decoderAttentionMaskDevice decoderAttentionMaskDataType decoderAttentionMaskShape, Tensor crossAttentionMaskGradient crossAttentionMaskLayout crossAttentionMaskDevice crossAttentionMaskDataType crossAttentionMaskShape) generatorDevice output generatorOutputDevice Source #

HasForward instance for GTransformer in a decoder configuration with absolute positional encoding rather than relative positional encoding.

┌──────────────┐  ┌────────────┐  ┌───────────────┐  ┌──────────────────────┐  ┌────────────────────┐
│ decoderInput │  │ decoderPos │  │ encoderOutput │  │ decoderAttentionMask │  │ crossAttentionMask │
└──────┬───────┘  └──────┬─────┘  └───────┬───────┘  └──────────┬───────────┘  └──────────┬─────────┘
       │                 │                │                     │                         │
       │                 ▼                │                     │                         │
       │             tdPosEnc             │                     │                         │
       │                 │                │                     │                         │
       └──────►add◄──────┘                │                     │                         │
                │                         │                     │                         │
                ▼                         │                     │                         │
       (tInitialLayerNorm)                │                     │                         │
                ▼                         │                     ▼                         ▼
        (tInitialDropout)                 │                 unsqueeze                 unsqueeze
                ▼                         │                     │                         │
             tStack◄──────────────────────┘◄────────────────────┘◄────────────────────────┘
                ▼
        (tFinalLayerNorm)
                ▼
         (tFinalDropout)
                │
                ▼
           ┌────────┐
           │ output │
           └────────┘
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GTransformer

Methods

forward :: MonadThrow m => GTransformer posEnc () initialLayerNorm initialDropout stack finalLayerNorm finalDropout -> (Tensor decoderInputGradient decoderInputLayout decoderInputDevice decoderInputDataType decoderInputShape, Tensor encoderOutputGradient encoderOutputLayout encoderOutputDevice encoderOutputDataType encoderOutputShape, Tensor decoderPosGradient decoderPosLayout decoderPosDevice decoderPosDataType decoderPosShape, Tensor decoderAttentionMaskGradient decoderAttentionMaskLayout decoderAttentionMaskDevice decoderAttentionMaskDataType decoderAttentionMaskShape, Tensor crossAttentionMaskGradient crossAttentionMaskLayout crossAttentionMaskDevice crossAttentionMaskDataType crossAttentionMaskShape) -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

(HasForward qInProj (Tensor queryRequiresGradient queryLayout queryDevice queryDataType queryShape) generatorDevice (Tensor qRequiresGradient qLayout qDevice qDataType qShape0) qGeneratorOutputDevice, reshapedQShape0 ~ ReshapeF qShape0 ('Shape '[batchDim, querySeqDim, headDim, headEmbedDim]), Catch reshapedQShape0, qShape ~ TransposeF ('SelectDim ('ByIndex 1 :: By Symbol Natural)) ('SelectDim ('ByIndex 2 :: By Symbol Natural)) reshapedQShape0, Catch qShape, HasForward kInProj (Tensor keyRequiresGradient keyLayout keyDevice keyDataType keyShape) qGeneratorOutputDevice (Tensor qRequiresGradient kLayout kDevice kDataType kShape0) kGeneratorOutputDevice, reshapedKShape0 ~ ReshapeF kShape0 ('Shape '[batchDim, keySeqDim, headDim, headEmbedDim]), Catch reshapedKShape0, transposedReshapedKShape0 ~ TransposeF ('SelectDim ('ByIndex 1 :: By Symbol Natural)) ('SelectDim ('ByIndex 2 :: By Symbol Natural)) reshapedKShape0, Catch transposedReshapedKShape0, doubleTransposedReshapedKShape0 ~ TransposeF ('SelectDim ('ByIndex 2 :: By Symbol Natural)) ('SelectDim ('ByIndex 3 :: By Symbol Natural)) transposedReshapedKShape0, Catch doubleTransposedReshapedKShape0, multipliedQDoubleTransposedReshapedKShape0 ~ MatmulF qShape doubleTransposedReshapedKShape0, Catch multipliedQDoubleTransposedReshapedKShape0, weightsShape0 ~ SoftmaxF ('SelectDim ('ByIndex 3 :: By Symbol Natural)) (BroadcastShapesF multipliedQDoubleTransposedReshapedKShape0 attentionBiasShape), Catch (BroadcastShapesF multipliedQDoubleTransposedReshapedKShape0 attentionBiasShape), Catch weightsShape0, HasForward dropout (Tensor (qRequiresGradient <|> attentionBiasRequiresGradient) (qLayout <+> (kLayout <+> attentionBiasLayout)) (qDevice <+> (kDevice <+> attentionBiasDevice)) (qDataType <+> (kDataType <+> attentionBiasDataType)) weightsShape0) kGeneratorOutputDevice (Tensor weightsRequiresGradient weightsLayout weightsDevice weightsDataType weightsShape) weightsGeneratorOutputDevice, HasForward vInProj (Tensor valueRequiresGradient valueLayout valueDevice valueDataType valueShape) weightsGeneratorOutputDevice (Tensor weightsRequiresGradient vLayout vDevice vDataType vShape0) vGeneratorOutputDevice, reshapedVShape0 ~ ReshapeF vShape0 ('Shape '[batchDim, keySeqDim, headDim, headEmbedDim]), Catch reshapedVShape0, transposedReshapedVShape ~ TransposeF ('SelectDim ('ByIndex 1 :: By Symbol Natural)) ('SelectDim ('ByIndex 2 :: By Symbol Natural)) reshapedVShape0, Catch transposedReshapedVShape, multipliedWeightsTransposedReshapedVShape ~ MatmulF weightsShape transposedReshapedVShape, Catch multipliedWeightsTransposedReshapedVShape, outputQueryShape0 ~ TransposeF ('SelectDim ('ByIndex 1 :: By Symbol Natural)) ('SelectDim ('ByIndex 2 :: By Symbol Natural)) multipliedWeightsTransposedReshapedVShape, Catch outputQueryShape0, HasForward outProj (Tensor weightsRequiresGradient (weightsLayout <+> vLayout) (weightsDevice <+> vDevice) (weightsDataType <+> vDataType) reshapedOutputQueryShape0) vGeneratorOutputDevice output generatorOutputDevice, reshapedOutputQueryShape0 ~ ReshapeF outputQueryShape0 ('Shape '[batchDim, querySeqDim, embedDim]), Catch reshapedOutputQueryShape0, SGetShape queryShape, SGetShape keyShape, SGetShape valueShape, batchDim ~ BatchDim queryShape keyShape valueShape, querySeqDim ~ QuerySeqDim queryShape, keySeqDim ~ KeySeqDim keyShape valueShape) => HasForward (GMultiHeadAttention headDim headEmbedDim embedDim qInProj kInProj vInProj outProj dropout) (Tensor queryRequiresGradient queryLayout queryDevice queryDataType queryShape, Tensor keyRequiresGradient keyLayout keyDevice keyDataType keyShape, Tensor valueRequiresGradient valueLayout valueDevice valueDataType valueShape, Tensor attentionBiasRequiresGradient attentionBiasLayout attentionBiasDevice attentionBiasDataType attentionBiasShape) generatorDevice output generatorOutputDevice Source #

HasForward instance for GMultiHeadAttention.

┌───────────────┐        ┌───────┐       ┌─────┐       ┌───────┐
│ attentionBias │        │ query │       │ key │       │ value │
└───────┬───────┘        └───┬───┘       └──┬──┘       └───┬───┘
        │                    │              │              │
        │                    ▼              ▼              ▼
        │                mhaQInProj     mhaKInProj     mhaVInProj
        │                    ▼              │              │
        │                (scaling)          │              │
        │                    ▼              ▼              ▼
        │                 reshape        reshape        reshape
        │                    ▼              ▼              ▼
        │                transpose      transpose      transpose
        │                    │              ▼              │
        │                    │          transpose          │
        │                    │              │              │
        │                    └───►matmul◄───┘              │
        │                           ▼                      │
        │                       (scaling)                  │
        │                           │                      │
        └──────────►add◄────────────┘                      │
                     ▼                                     │
                  softmax                                  │
                     ▼                                     │
                 mhaDropout                                │
                     │                                     │
                     └──────────────►matmul◄───────────────┘
                                       ▼
                                   transpose
                                       ▼
                                    reshape
                                       ▼
                                   mhaOutProj
                                       │
                                       ▼
                                   ┌───────┐
                                   │ query │
                                   └───────┘
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GMultiHeadAttention

Methods

forward :: MonadThrow m => GMultiHeadAttention headDim headEmbedDim embedDim qInProj kInProj vInProj outProj dropout -> (Tensor queryRequiresGradient queryLayout queryDevice queryDataType queryShape, Tensor keyRequiresGradient keyLayout keyDevice keyDataType keyShape, Tensor valueRequiresGradient valueLayout valueDevice valueDataType valueShape, Tensor attentionBiasRequiresGradient attentionBiasLayout attentionBiasDevice attentionBiasDataType attentionBiasShape) -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

class GHasForward gModel input generatorDevice output generatorOutputDevice | gModel input generatorDevice -> output, gModel input generatorDevice -> generatorOutputDevice where Source #

Methods

gForward :: forall m c. MonadThrow m => gModel c -> input -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

Instances

Instances details
GHasForward (U1 :: Type -> Type) input generatorDevice input generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

gForward :: MonadThrow m => U1 c -> input -> Generator generatorDevice -> m (input, Generator generatorDevice) Source #

(GHasForward gModelA inputA generatorDevice outputA generatorOutputADevice, GHasForward gModelB outputA generatorOutputADevice outputB generatorOutputDevice) => GHasForward (gModelA :*: gModelB) inputA generatorDevice outputB generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

gForward :: MonadThrow m => (gModelA :*: gModelB) c -> inputA -> Generator generatorDevice -> m (outputB, Generator generatorOutputDevice) Source #

HasForward model input generatorDevice output generatorOutputDevice => GHasForward (K1 i model :: Type -> Type) input generatorDevice output generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

gForward :: MonadThrow m => K1 i model c -> input -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

GHasForward gModel input generatorDevice output generatorOutputDevice => GHasForward (M1 i t gModel) input generatorDevice output generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

gForward :: MonadThrow m => M1 i t gModel c -> input -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

newtype Wrap a Source #

Constructors

Wrap a 

Instances

Instances details
Generic (Wrap a) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Associated Types

type Rep (Wrap a) :: Type -> Type Source #

Methods

from :: Wrap a -> Rep (Wrap a) x Source #

to :: Rep (Wrap a) x -> Wrap a Source #

Show a => Show (Wrap a) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

showsPrec :: Int -> Wrap a -> ShowS Source #

show :: Wrap a -> String Source #

showList :: [Wrap a] -> ShowS Source #

Eq a => Eq (Wrap a) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

(==) :: Wrap a -> Wrap a -> Bool Source #

(/=) :: Wrap a -> Wrap a -> Bool Source #

Ord a => Ord (Wrap a) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

compare :: Wrap a -> Wrap a -> Ordering Source #

(<) :: Wrap a -> Wrap a -> Bool Source #

(<=) :: Wrap a -> Wrap a -> Bool Source #

(>) :: Wrap a -> Wrap a -> Bool Source #

(>=) :: Wrap a -> Wrap a -> Bool Source #

max :: Wrap a -> Wrap a -> Wrap a Source #

min :: Wrap a -> Wrap a -> Wrap a Source #

HasStateDict a => HasStateDict (Wrap a) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

HasForward a input generatorDevice output generatorOutputDevice => HasForward (Wrap a) input generatorDevice output generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

forward :: MonadThrow m => Wrap a -> input -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

HasInitialize a generatorDevice a' generatorOutputDevice => HasInitialize (Wrap a) generatorDevice (Wrap a') generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

initialize :: MonadThrow m => ModelSpec (Wrap a) -> Generator generatorDevice -> m (Wrap a', Generator generatorOutputDevice) Source #

type Rep (Wrap a) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type Rep (Wrap a) = D1 ('MetaData "Wrap" "Torch.GraduallyTyped.NN.Class" "hasktorch-gradually-typed-0.2.0.0-1KV1aIPzzbp6JpSr37tC1K" 'True) (C1 ('MetaCons "Wrap" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))
type ModelSpec (Wrap a) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type ModelSpec (Wrap a) = Wrap (ModelSpec a)

type family ListToTuple xs = tuple | tuple -> xs where ... Source #

Equations

ListToTuple '[] = () 
ListToTuple '[a] = Wrap a 
ListToTuple '[a, b] = (a, b) 
ListToTuple '[a, b, c] = (a, b, c) 
ListToTuple '[a, b, c, d] = (a, b, c, d) 
ListToTuple '[a, b, c, d, e] = (a, b, c, d, e) 
ListToTuple '[a, b, c, d, e, f] = (a, b, c, d, e, f) 
ListToTuple '[a, b, c, d, e, f, g] = (a, b, c, d, e, f, g) 

newtype ModelStack models Source #

Constructors

ModelStack (ListToTuple models) 

Instances

Instances details
Generic (ModelStack models) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Associated Types

type Rep (ModelStack models) :: Type -> Type Source #

Methods

from :: ModelStack models -> Rep (ModelStack models) x Source #

to :: Rep (ModelStack models) x -> ModelStack models Source #

HasStateDict (a, b, c, d, e, f, g) => HasStateDict (ModelStack '[a, b, c, d, e, f, g]) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

fromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec (ModelStack '[a, b, c, d, e, f, g]) -> StateDictKey -> m (ModelStack '[a, b, c, d, e, f, g]) Source #

toStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> ModelStack '[a, b, c, d, e, f, g] -> m () Source #

HasStateDict (a, b, c, d, e, f) => HasStateDict (ModelStack '[a, b, c, d, e, f]) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

fromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec (ModelStack '[a, b, c, d, e, f]) -> StateDictKey -> m (ModelStack '[a, b, c, d, e, f]) Source #

toStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> ModelStack '[a, b, c, d, e, f] -> m () Source #

HasStateDict (a, b, c, d, e) => HasStateDict (ModelStack '[a, b, c, d, e]) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

fromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec (ModelStack '[a, b, c, d, e]) -> StateDictKey -> m (ModelStack '[a, b, c, d, e]) Source #

toStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> ModelStack '[a, b, c, d, e] -> m () Source #

HasStateDict (a, b, c, d) => HasStateDict (ModelStack '[a, b, c, d]) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

fromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec (ModelStack '[a, b, c, d]) -> StateDictKey -> m (ModelStack '[a, b, c, d]) Source #

toStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> ModelStack '[a, b, c, d] -> m () Source #

HasStateDict (a, b, c) => HasStateDict (ModelStack '[a, b, c]) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

HasStateDict (a, b) => HasStateDict (ModelStack '[a, b]) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

HasStateDict a => HasStateDict (ModelStack '[a]) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

HasStateDict (ModelStack ('[] :: [Type])) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

HasForward (ListToTuple models) input generatorDevice output generatorOutputDevice => HasForward (ModelStack models) input generatorDevice output generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

forward :: MonadThrow m => ModelStack models -> input -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

HasInitialize (a, b, c, d, e, f, g) generatorDevice (a', b', c', d', e', f', g') generatorOutputDevice => HasInitialize (ModelStack '[a, b, c, d, e, f, g]) generatorDevice (ModelStack '[a', b', c', d', e', f', g']) generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

initialize :: MonadThrow m => ModelSpec (ModelStack '[a, b, c, d, e, f, g]) -> Generator generatorDevice -> m (ModelStack '[a', b', c', d', e', f', g'], Generator generatorOutputDevice) Source #

HasInitialize (a, b, c, d, e, f) generatorDevice (a', b', c', d', e', f') generatorOutputDevice => HasInitialize (ModelStack '[a, b, c, d, e, f]) generatorDevice (ModelStack '[a', b', c', d', e', f']) generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

initialize :: MonadThrow m => ModelSpec (ModelStack '[a, b, c, d, e, f]) -> Generator generatorDevice -> m (ModelStack '[a', b', c', d', e', f'], Generator generatorOutputDevice) Source #

HasInitialize (a, b, c, d, e) generatorDevice (a', b', c', d', e') generatorOutputDevice => HasInitialize (ModelStack '[a, b, c, d, e]) generatorDevice (ModelStack '[a', b', c', d', e']) generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

initialize :: MonadThrow m => ModelSpec (ModelStack '[a, b, c, d, e]) -> Generator generatorDevice -> m (ModelStack '[a', b', c', d', e'], Generator generatorOutputDevice) Source #

HasInitialize (a, b, c, d) generatorDevice (a', b', c', d') generatorOutputDevice => HasInitialize (ModelStack '[a, b, c, d]) generatorDevice (ModelStack '[a', b', c', d']) generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

initialize :: MonadThrow m => ModelSpec (ModelStack '[a, b, c, d]) -> Generator generatorDevice -> m (ModelStack '[a', b', c', d'], Generator generatorOutputDevice) Source #

HasInitialize (a, b, c) generatorDevice (a', b', c') generatorOutputDevice => HasInitialize (ModelStack '[a, b, c]) generatorDevice (ModelStack '[a', b', c']) generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

initialize :: MonadThrow m => ModelSpec (ModelStack '[a, b, c]) -> Generator generatorDevice -> m (ModelStack '[a', b', c'], Generator generatorOutputDevice) Source #

HasInitialize (a, b) generatorDevice (a', b') generatorOutputDevice => HasInitialize (ModelStack '[a, b]) generatorDevice (ModelStack '[a', b']) generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

initialize :: MonadThrow m => ModelSpec (ModelStack '[a, b]) -> Generator generatorDevice -> m (ModelStack '[a', b'], Generator generatorOutputDevice) Source #

HasInitialize a generatorDevice a' generatorOutputDevice => HasInitialize (ModelStack '[a]) generatorDevice (ModelStack '[a']) generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

initialize :: MonadThrow m => ModelSpec (ModelStack '[a]) -> Generator generatorDevice -> m (ModelStack '[a'], Generator generatorOutputDevice) Source #

HasInitialize (ModelStack ('[] :: [Type])) generatorDevice (ModelStack ('[] :: [Type])) generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

initialize :: MonadThrow m => ModelSpec (ModelStack '[]) -> Generator generatorDevice -> m (ModelStack '[], Generator generatorDevice) Source #

type Rep (ModelStack models) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type Rep (ModelStack models) = D1 ('MetaData "ModelStack" "Torch.GraduallyTyped.NN.Class" "hasktorch-gradually-typed-0.2.0.0-1KV1aIPzzbp6JpSr37tC1K" 'True) (C1 ('MetaCons "ModelStack" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ListToTuple models))))
type ModelSpec (ModelStack '[a, b, c, d, e, f, g]) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type ModelSpec (ModelStack '[a, b, c, d, e, f, g]) = ModelStack '[ModelSpec a, ModelSpec b, ModelSpec c, ModelSpec d, ModelSpec e, ModelSpec f, ModelSpec g]
type ModelSpec (ModelStack '[a, b, c, d, e, f]) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type ModelSpec (ModelStack '[a, b, c, d, e, f]) = ModelStack '[ModelSpec a, ModelSpec b, ModelSpec c, ModelSpec d, ModelSpec e, ModelSpec f]
type ModelSpec (ModelStack '[a, b, c, d, e]) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type ModelSpec (ModelStack '[a, b, c, d, e]) = ModelStack '[ModelSpec a, ModelSpec b, ModelSpec c, ModelSpec d, ModelSpec e]
type ModelSpec (ModelStack '[a, b, c, d]) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type ModelSpec (ModelStack '[a, b, c]) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type ModelSpec (ModelStack '[a, b]) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type ModelSpec (ModelStack '[a]) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type ModelSpec (ModelStack ('[] :: [Type])) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type ModelSpec (ModelStack ('[] :: [Type])) = ModelStack ('[] :: [Type])

type family ModelSpec model = spec | spec -> model Source #

Instances

Instances details
type ModelSpec Gelu Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Activation

type ModelSpec GeluNew Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Activation

type ModelSpec Relu Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Activation

type ModelSpec Tanh Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Activation

type ModelSpec Dropout Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Dropout

type ModelSpec MSELoss Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Loss

type ModelSpec EncoderDecoderTransformerHasEmbedScaling Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GEncoderDecoder

type ModelSpec EncoderOnlyTransformerHasEmbedScaling Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GEncoderOnly

type ModelSpec LMHeadHasScaling Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GLMHead

type ModelSpec MultiHeadAttentionHasScaling Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GMultiHeadAttention

type ModelSpec MkAbsPos Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.Type

type ModelSpec MkTransformerPaddingMask Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.Type

type ModelSpec () Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type ModelSpec () = ()
type ModelSpec (LogSoftmax selectDim) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Activation

type ModelSpec (LogSoftmax selectDim) = LogSoftmax selectDim
type ModelSpec (Softmax selectDim) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Activation

type ModelSpec (Softmax selectDim) = Softmax selectDim
type ModelSpec (ModelStack '[a, b, c, d, e, f, g]) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type ModelSpec (ModelStack '[a, b, c, d, e, f, g]) = ModelStack '[ModelSpec a, ModelSpec b, ModelSpec c, ModelSpec d, ModelSpec e, ModelSpec f, ModelSpec g]
type ModelSpec (ModelStack '[a, b, c, d, e, f]) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type ModelSpec (ModelStack '[a, b, c, d, e, f]) = ModelStack '[ModelSpec a, ModelSpec b, ModelSpec c, ModelSpec d, ModelSpec e, ModelSpec f]
type ModelSpec (ModelStack '[a, b, c, d, e]) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type ModelSpec (ModelStack '[a, b, c, d, e]) = ModelStack '[ModelSpec a, ModelSpec b, ModelSpec c, ModelSpec d, ModelSpec e]
type ModelSpec (ModelStack '[a, b, c, d]) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type ModelSpec (ModelStack '[a, b, c]) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type ModelSpec (ModelStack '[a, b]) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type ModelSpec (ModelStack '[a]) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type ModelSpec (ModelStack ('[] :: [Type])) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type ModelSpec (ModelStack ('[] :: [Type])) = ModelStack ('[] :: [Type])
type ModelSpec (NamedModel model) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type ModelSpec (NamedModel model) = NamedModel (ModelSpec model)
type ModelSpec (Wrap a) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type ModelSpec (Wrap a) = Wrap (ModelSpec a)
type ModelSpec (GBias bias) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GLMHead

type ModelSpec (GBias bias) = GBias (ModelSpec bias)
type ModelSpec (GTransformerStack stack) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GStack

type ModelSpec (MkRelPos relPosEncBucketDim) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.Type

type ModelSpec (MkRelPos relPosEncBucketDim) = MkRelPos relPosEncBucketDim
type ModelSpec (MkTransformerAttentionMask dataType) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.Type

type ModelSpec (MkTransformerCrossAttentionMask dataType) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.Type

type ModelSpec (MkTransformerDecoderAttentionMask dataType) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.Type

type ModelSpec (ShiftRight fillValue) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.Type

type ModelSpec (ShiftRight fillValue) = ShiftRight fillValue
type ModelSpec (SDim dim) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type ModelSpec (SDim dim) = SDim dim
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 ModelSpec (GPooler dense activation) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GPooler

type ModelSpec (GPooler dense activation) = GPooler (ModelSpec dense) (ModelSpec activation)
type ModelSpec (Vector n a) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type ModelSpec (Vector n a) = VectorSpec n a
type ModelSpec (a, b) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type ModelSpec (a, b) = (ModelSpec a, ModelSpec b)
type ModelSpec (GTransformerBlock selfAttention crossAttention feedForwardNetwork) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GBlock

type ModelSpec (GTransformerBlock selfAttention crossAttention feedForwardNetwork) = GTransformerBlock (ModelSpec selfAttention) (ModelSpec crossAttention) (ModelSpec feedForwardNetwork)
type ModelSpec (GGate layer0 activation layer1) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GFeedForwardNetwork

type ModelSpec (GGate layer0 activation layer1) = GGate (ModelSpec layer0) (ModelSpec activation) (ModelSpec layer1)
type ModelSpec (a, b, c) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type ModelSpec (a, b, c) = (ModelSpec a, ModelSpec b, ModelSpec c)
type ModelSpec (GCrossAttention initialLayerNorm mha dropout finalLayerNorm) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GCrossAttention

type ModelSpec (GCrossAttention initialLayerNorm mha dropout finalLayerNorm) = GCrossAttention (ModelSpec initialLayerNorm) (ModelSpec mha) (ModelSpec dropout) (ModelSpec finalLayerNorm)
type ModelSpec (GSimplifiedEncoderOnlyTransformer model mkPos mkPaddingMask mkAttentionMask) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GEncoderOnly

type ModelSpec (GSimplifiedEncoderOnlyTransformer model mkPos mkPaddingMask mkAttentionMask) = GSimplifiedEncoderOnlyTransformer (ModelSpec model) (ModelSpec mkPos) (ModelSpec mkPaddingMask) (ModelSpec mkAttentionMask)
type ModelSpec (GSelfAttention initialLayerNorm mha dropout finalLayerNorm) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GSelfAttention

type ModelSpec (GSelfAttention initialLayerNorm mha dropout finalLayerNorm) = GSelfAttention (ModelSpec initialLayerNorm) (ModelSpec mha) (ModelSpec dropout) (ModelSpec finalLayerNorm)
type ModelSpec (a, b, c, d) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type ModelSpec (a, b, c, d) = (ModelSpec a, ModelSpec b, ModelSpec c, ModelSpec d)
type ModelSpec (LayerNorm hasBias gradient device dataType normalizedShape) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Normalization

type ModelSpec (LayerNorm hasBias gradient device dataType normalizedShape) = LayerNormSpec hasBias gradient device dataType normalizedShape
type ModelSpec (GEncoderDecoderTransformer inputEmbedDim encoder decoder sharedEmbedding head) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GEncoderDecoder

type ModelSpec (GEncoderDecoderTransformer inputEmbedDim encoder decoder sharedEmbedding head) = GEncoderDecoderTransformer inputEmbedDim (ModelSpec encoder) (ModelSpec decoder) (ModelSpec sharedEmbedding) (ModelSpec head)
type ModelSpec (GEncoderOnlyTransformer inputEmbedDim encoder encoderEmbedding encoderTypeEmbedding head) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GEncoderOnly

type ModelSpec (GEncoderOnlyTransformer inputEmbedDim encoder encoderEmbedding encoderTypeEmbedding head) = GEncoderOnlyTransformer inputEmbedDim (ModelSpec encoder) (ModelSpec encoderEmbedding) (ModelSpec encoderTypeEmbedding) (ModelSpec head)
type ModelSpec (Tensor gradient layout device dataType shape) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type ModelSpec (Tensor gradient layout device dataType shape) = TensorSpec gradient layout device dataType shape
type ModelSpec (a, b, c, d, e) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type ModelSpec (a, b, c, d, e) = (ModelSpec a, ModelSpec b, ModelSpec c, ModelSpec d, ModelSpec e)
type ModelSpec (GLMHead inputEmbedDim dense activation layerNorm decoder bias) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GLMHead

type ModelSpec (GLMHead inputEmbedDim dense activation layerNorm decoder bias) = GLMHead inputEmbedDim (ModelSpec dense) (ModelSpec activation) (ModelSpec layerNorm) (ModelSpec decoder) (ModelSpec bias)
type ModelSpec (a, b, c, d, e, f) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type ModelSpec (a, b, c, d, e, f) = (ModelSpec a, ModelSpec b, ModelSpec c, ModelSpec d, ModelSpec e, ModelSpec f)
type ModelSpec (Embedding gradient layout device dataType embedNumDim embedDim paddingIdx) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Sparse

type ModelSpec (Embedding gradient layout device dataType embedNumDim embedDim paddingIdx) = EmbeddingSpec gradient layout device dataType embedNumDim embedDim paddingIdx
type ModelSpec (GSimplifiedEncoderDecoderTransformer model mkPos mkDecoderPos mkPaddingMask mkAttentionMask mkCrossAttentionMask mkDecoderAttentionMask) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GEncoderDecoder

type ModelSpec (GSimplifiedEncoderDecoderTransformer model mkPos mkDecoderPos mkPaddingMask mkAttentionMask mkCrossAttentionMask mkDecoderAttentionMask) = GSimplifiedEncoderDecoderTransformer (ModelSpec model) (ModelSpec mkPos) (ModelSpec mkDecoderPos) (ModelSpec mkPaddingMask) (ModelSpec mkAttentionMask) (ModelSpec mkCrossAttentionMask) (ModelSpec mkDecoderAttentionMask)
type ModelSpec (GTransformerFeedForwardNetwork inputLayerNorm inputTransformation activation activationDropout outputProjection outputDropout outputLayerNorm) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GFeedForwardNetwork

type ModelSpec (GTransformerFeedForwardNetwork inputLayerNorm inputTransformation activation activationDropout outputProjection outputDropout outputLayerNorm) = GTransformerFeedForwardNetwork (ModelSpec inputLayerNorm) (ModelSpec inputTransformation) (ModelSpec activation) (ModelSpec activationDropout) (ModelSpec outputProjection) (ModelSpec outputDropout) (ModelSpec outputLayerNorm)
type ModelSpec (GTransformer posEnc relPosEnc initialLayerNorm initialDropout stack finalLayerNorm finalDropout) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GTransformer

type ModelSpec (GTransformer posEnc relPosEnc initialLayerNorm initialDropout stack finalLayerNorm finalDropout) = GTransformer (ModelSpec posEnc) (ModelSpec relPosEnc) (ModelSpec initialLayerNorm) (ModelSpec initialDropout) (ModelSpec stack) (ModelSpec finalLayerNorm) (ModelSpec finalDropout)
type ModelSpec (a, b, c, d, e, f, g) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

type ModelSpec (a, b, c, d, e, f, g) = (ModelSpec a, ModelSpec b, ModelSpec c, ModelSpec d, ModelSpec e, ModelSpec f, ModelSpec g)
type ModelSpec (GMultiHeadAttention headDim headEmbedDim embedDim qInProj kInProj vInProj outProj dropout) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GMultiHeadAttention

type ModelSpec (GMultiHeadAttention headDim headEmbedDim embedDim qInProj kInProj vInProj outProj dropout) = GMultiHeadAttention headDim headEmbedDim embedDim (ModelSpec qInProj) (ModelSpec kInProj) (ModelSpec vInProj) (ModelSpec outProj) (ModelSpec dropout)

class HasInitialize model generatorDevice output generatorOutputDevice | model generatorDevice -> output, model generatorDevice -> generatorOutputDevice where Source #

Minimal complete definition

Nothing

Methods

initialize :: forall m. MonadThrow m => ModelSpec model -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

default initialize :: forall m. (MonadThrow m, Generic (ModelSpec model), Generic output, GHasInitialize (Rep (ModelSpec model)) generatorDevice (Rep output) generatorOutputDevice) => ModelSpec model -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

Instances

Instances details
HasInitialize Gelu generatorDevice Gelu generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Activation

Methods

initialize :: MonadThrow m => ModelSpec Gelu -> Generator generatorDevice -> m (Gelu, Generator generatorDevice) Source #

HasInitialize GeluNew generator GeluNew generator Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Activation

Methods

initialize :: MonadThrow m => ModelSpec GeluNew -> Generator generator -> m (GeluNew, Generator generator) Source #

HasInitialize Relu generatorDevice Relu generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Activation

Methods

initialize :: MonadThrow m => ModelSpec Relu -> Generator generatorDevice -> m (Relu, Generator generatorDevice) Source #

HasInitialize Tanh generator Tanh generator Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Activation

Methods

initialize :: MonadThrow m => ModelSpec Tanh -> Generator generator -> m (Tanh, Generator generator) Source #

HasInitialize Dropout generatorDevice Dropout generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Dropout

Methods

initialize :: MonadThrow m => ModelSpec Dropout -> Generator generatorDevice -> m (Dropout, Generator generatorDevice) Source #

HasInitialize MSELoss generatorDevice MSELoss generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Loss

Methods

initialize :: MonadThrow m => ModelSpec MSELoss -> Generator generatorDevice -> m (MSELoss, Generator generatorDevice) Source #

HasInitialize EncoderDecoderTransformerHasEmbedScaling generatorDevice EncoderDecoderTransformerHasEmbedScaling generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GEncoderDecoder

HasInitialize EncoderOnlyTransformerHasEmbedScaling generatorDevice EncoderOnlyTransformerHasEmbedScaling generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GEncoderOnly

HasInitialize LMHeadHasScaling generatorDevice LMHeadHasScaling generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GLMHead

Methods

initialize :: MonadThrow m => ModelSpec LMHeadHasScaling -> Generator generatorDevice -> m (LMHeadHasScaling, Generator generatorDevice) Source #

HasInitialize MultiHeadAttentionHasScaling generatorDevice MultiHeadAttentionHasScaling generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GMultiHeadAttention

HasInitialize MkAbsPos generatorDevice MkAbsPos generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.Type

Methods

initialize :: MonadThrow m => ModelSpec MkAbsPos -> Generator generatorDevice -> m (MkAbsPos, Generator generatorDevice) Source #

HasInitialize MkTransformerPaddingMask generatorDevice MkTransformerPaddingMask generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.Type

HasInitialize () generatorDevice () generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

initialize :: MonadThrow m => ModelSpec () -> Generator generatorDevice -> m ((), Generator generatorDevice) Source #

HasInitialize (LogSoftmax selectDim) generatorDevice (LogSoftmax selectDim) generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Activation

Methods

initialize :: MonadThrow m => ModelSpec (LogSoftmax selectDim) -> Generator generatorDevice -> m (LogSoftmax selectDim, Generator generatorDevice) Source #

HasInitialize (Softmax selectDim) generatorDevice (Softmax selectDim) generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Activation

Methods

initialize :: MonadThrow m => ModelSpec (Softmax selectDim) -> Generator generatorDevice -> m (Softmax selectDim, Generator generatorDevice) Source #

HasInitialize (a, b, c, d, e, f, g) generatorDevice (a', b', c', d', e', f', g') generatorOutputDevice => HasInitialize (ModelStack '[a, b, c, d, e, f, g]) generatorDevice (ModelStack '[a', b', c', d', e', f', g']) generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

initialize :: MonadThrow m => ModelSpec (ModelStack '[a, b, c, d, e, f, g]) -> Generator generatorDevice -> m (ModelStack '[a', b', c', d', e', f', g'], Generator generatorOutputDevice) Source #

HasInitialize (a, b, c, d, e, f) generatorDevice (a', b', c', d', e', f') generatorOutputDevice => HasInitialize (ModelStack '[a, b, c, d, e, f]) generatorDevice (ModelStack '[a', b', c', d', e', f']) generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

initialize :: MonadThrow m => ModelSpec (ModelStack '[a, b, c, d, e, f]) -> Generator generatorDevice -> m (ModelStack '[a', b', c', d', e', f'], Generator generatorOutputDevice) Source #

HasInitialize (a, b, c, d, e) generatorDevice (a', b', c', d', e') generatorOutputDevice => HasInitialize (ModelStack '[a, b, c, d, e]) generatorDevice (ModelStack '[a', b', c', d', e']) generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

initialize :: MonadThrow m => ModelSpec (ModelStack '[a, b, c, d, e]) -> Generator generatorDevice -> m (ModelStack '[a', b', c', d', e'], Generator generatorOutputDevice) Source #

HasInitialize (a, b, c, d) generatorDevice (a', b', c', d') generatorOutputDevice => HasInitialize (ModelStack '[a, b, c, d]) generatorDevice (ModelStack '[a', b', c', d']) generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

initialize :: MonadThrow m => ModelSpec (ModelStack '[a, b, c, d]) -> Generator generatorDevice -> m (ModelStack '[a', b', c', d'], Generator generatorOutputDevice) Source #

HasInitialize (a, b, c) generatorDevice (a', b', c') generatorOutputDevice => HasInitialize (ModelStack '[a, b, c]) generatorDevice (ModelStack '[a', b', c']) generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

initialize :: MonadThrow m => ModelSpec (ModelStack '[a, b, c]) -> Generator generatorDevice -> m (ModelStack '[a', b', c'], Generator generatorOutputDevice) Source #

HasInitialize (a, b) generatorDevice (a', b') generatorOutputDevice => HasInitialize (ModelStack '[a, b]) generatorDevice (ModelStack '[a', b']) generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

initialize :: MonadThrow m => ModelSpec (ModelStack '[a, b]) -> Generator generatorDevice -> m (ModelStack '[a', b'], Generator generatorOutputDevice) Source #

HasInitialize a generatorDevice a' generatorOutputDevice => HasInitialize (ModelStack '[a]) generatorDevice (ModelStack '[a']) generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

initialize :: MonadThrow m => ModelSpec (ModelStack '[a]) -> Generator generatorDevice -> m (ModelStack '[a'], Generator generatorOutputDevice) Source #

HasInitialize (ModelStack ('[] :: [Type])) generatorDevice (ModelStack ('[] :: [Type])) generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

initialize :: MonadThrow m => ModelSpec (ModelStack '[]) -> Generator generatorDevice -> m (ModelStack '[], Generator generatorDevice) Source #

HasInitialize model generatorDevice output generatorOutputDevice => HasInitialize (NamedModel model) generatorDevice (NamedModel output) generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

initialize :: MonadThrow m => ModelSpec (NamedModel model) -> Generator generatorDevice -> m (NamedModel output, Generator generatorOutputDevice) Source #

HasInitialize a generatorDevice a' generatorOutputDevice => HasInitialize (Wrap a) generatorDevice (Wrap a') generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

initialize :: MonadThrow m => ModelSpec (Wrap a) -> Generator generatorDevice -> m (Wrap a', Generator generatorOutputDevice) Source #

HasInitialize (GBias (NamedModel (Tensor biasGradient biasLayout biasDevice biasDataType biasShape))) generatorDevice (GBias (NamedModel (Tensor biasGradient biasLayout biasDevice biasDataType biasShape))) generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GLMHead

Methods

initialize :: MonadThrow m => ModelSpec (GBias (NamedModel (Tensor biasGradient biasLayout biasDevice biasDataType biasShape))) -> Generator generatorDevice -> m (GBias (NamedModel (Tensor biasGradient biasLayout biasDevice biasDataType biasShape)), Generator generatorDevice) Source #

HasInitialize (GBias (Tensor biasGradient biasLayout biasDevice biasDataType biasShape)) generatorDevice (GBias (Tensor biasGradient biasLayout biasDevice biasDataType biasShape)) generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GLMHead

Methods

initialize :: MonadThrow m => ModelSpec (GBias (Tensor biasGradient biasLayout biasDevice biasDataType biasShape)) -> Generator generatorDevice -> m (GBias (Tensor biasGradient biasLayout biasDevice biasDataType biasShape), Generator generatorDevice) Source #

HasInitialize (GBias ()) generatorDevice (GBias ()) generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GLMHead

Methods

initialize :: MonadThrow m => ModelSpec (GBias ()) -> Generator generatorDevice -> m (GBias (), Generator generatorDevice) Source #

(HasInitialize block generatorDevice block' generatorDevice, numLayers' ~ (numLayers + 1)) => HasInitialize (GTransformerStack (Vector numLayers' block)) generatorDevice (GTransformerStack (Vector numLayers' block')) generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GStack

Methods

initialize :: MonadThrow m => ModelSpec (GTransformerStack (Vector numLayers' block)) -> Generator generatorDevice -> m (GTransformerStack (Vector numLayers' block'), Generator generatorDevice) Source #

HasInitialize (MkRelPos relPosEncBucketDim) generatorDevice (MkRelPos relPosEncBucketDim) generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.Type

Methods

initialize :: MonadThrow m => ModelSpec (MkRelPos relPosEncBucketDim) -> Generator generatorDevice -> m (MkRelPos relPosEncBucketDim, Generator generatorDevice) Source #

HasInitialize (MkTransformerAttentionMask dataType) generatorDevice (MkTransformerAttentionMask dataType) generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.Type

Methods

initialize :: MonadThrow m => ModelSpec (MkTransformerAttentionMask dataType) -> Generator generatorDevice -> m (MkTransformerAttentionMask dataType, Generator generatorDevice) Source #

HasInitialize (MkTransformerCrossAttentionMask dataType) generatorDevice (MkTransformerCrossAttentionMask dataType) generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.Type

Methods

initialize :: MonadThrow m => ModelSpec (MkTransformerCrossAttentionMask dataType) -> Generator generatorDevice -> m (MkTransformerCrossAttentionMask dataType, Generator generatorDevice) Source #

HasInitialize (MkTransformerDecoderAttentionMask dataType) generatorDevice (MkTransformerDecoderAttentionMask dataType) generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.Type

Methods

initialize :: MonadThrow m => ModelSpec (MkTransformerDecoderAttentionMask dataType) -> Generator generatorDevice -> m (MkTransformerDecoderAttentionMask dataType, Generator generatorDevice) Source #

HasInitialize (ShiftRight fillValue) generatorDevice (ShiftRight fillValue) generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.Type

Methods

initialize :: MonadThrow m => ModelSpec (ShiftRight fillValue) -> Generator generatorDevice -> m (ShiftRight fillValue, Generator generatorDevice) Source #

HasInitialize (SDim dim) generatorDevice (SDim dim) generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

initialize :: MonadThrow m => ModelSpec (SDim dim) -> Generator generatorDevice -> m (SDim dim, Generator generatorDevice) 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 #

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 #

(HasInitialize a generatorDevice output generatorOutputDevice, HasInitialize a generatorOutputDevice output generatorOutputDevice, n' ~ (n + 1)) => HasInitialize (Vector n' a) generatorDevice (Vector n' output) generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

initialize :: MonadThrow m => ModelSpec (Vector n' a) -> Generator generatorDevice -> m (Vector n' output, Generator generatorOutputDevice) Source #

(HasInitialize a generatorDevice outputA generatorOutputADevice, HasInitialize b generatorOutputADevice outputB generatorOutputDevice) => HasInitialize (a, b) generatorDevice (outputA, outputB) generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

initialize :: MonadThrow m => ModelSpec (a, b) -> Generator generatorDevice -> m ((outputA, outputB), Generator generatorOutputDevice) Source #

(HasInitialize selfAttention generatorDevice selfAttention' generatorDevice0, HasInitialize crossAttention generatorDevice0 crossAttention' generatorDevice1, HasInitialize feedForwardNetwork generatorDevice1 feedForwardNetwork' generatorOutputDevice) => HasInitialize (GTransformerBlock selfAttention crossAttention feedForwardNetwork) generatorDevice (GTransformerBlock selfAttention' crossAttention' feedForwardNetwork') generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GBlock

Methods

initialize :: MonadThrow m => ModelSpec (GTransformerBlock selfAttention crossAttention feedForwardNetwork) -> Generator generatorDevice -> m (GTransformerBlock selfAttention' crossAttention' feedForwardNetwork', Generator generatorOutputDevice) Source #

(HasInitialize layer0 generatorDevice layer0' generatorDevice0, HasInitialize activation generatorDevice0 activation' generatorDevice1, HasInitialize layer1 generatorDevice1 layer1' generatorOutputDevice) => HasInitialize (GGate layer0 activation layer1) generatorDevice (GGate layer0' activation' layer1') generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GFeedForwardNetwork

Methods

initialize :: MonadThrow m => ModelSpec (GGate layer0 activation layer1) -> Generator generatorDevice -> m (GGate layer0' activation' layer1', Generator generatorOutputDevice) Source #

(HasInitialize a generatorDevice outputA generatorOutputADevice, HasInitialize b generatorOutputADevice outputB generatorOutputBDevice, HasInitialize c generatorOutputBDevice outputC generatorOutputDevice) => HasInitialize (a, b, c) generatorDevice (outputA, outputB, outputC) generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

initialize :: MonadThrow m => ModelSpec (a, b, c) -> Generator generatorDevice -> m ((outputA, outputB, outputC), Generator generatorOutputDevice) Source #

(HasInitialize initialLayerNorm generatorDevice initialLayerNorm' generatorDevice0, HasInitialize multiHeadAttention generatorDevice0 multiHeadAttention' generatorDevice1, HasInitialize dropout generatorDevice1 dropout' generatorDevice2, HasInitialize finalLayerNorm generatorDevice2 finalLayerNorm' generatorOutputDevice) => HasInitialize (GCrossAttention initialLayerNorm multiHeadAttention dropout finalLayerNorm) generatorDevice (GCrossAttention initialLayerNorm' multiHeadAttention' dropout' finalLayerNorm') generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GCrossAttention

Methods

initialize :: MonadThrow m => ModelSpec (GCrossAttention initialLayerNorm multiHeadAttention dropout finalLayerNorm) -> Generator generatorDevice -> m (GCrossAttention initialLayerNorm' multiHeadAttention' dropout' finalLayerNorm', Generator generatorOutputDevice) Source #

(HasInitialize model generatorDevice model' generatorDevice0, HasInitialize mkPos generatorDevice0 mkPos' generatorDevice1, HasInitialize mkPaddingMask generatorDevice1 mkPaddingMask' generatorDevice2, HasInitialize mkAttentionMask generatorDevice2 mkAttentionMask' generatorOutputDevice) => HasInitialize (GSimplifiedEncoderOnlyTransformer model mkPos mkPaddingMask mkAttentionMask) generatorDevice (GSimplifiedEncoderOnlyTransformer model' mkPos' mkPaddingMask' mkAttentionMask') generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GEncoderOnly

Methods

initialize :: MonadThrow m => ModelSpec (GSimplifiedEncoderOnlyTransformer model mkPos mkPaddingMask mkAttentionMask) -> Generator generatorDevice -> m (GSimplifiedEncoderOnlyTransformer model' mkPos' mkPaddingMask' mkAttentionMask', Generator generatorOutputDevice) Source #

(HasInitialize initialLayerNorm generatorDevice initialLayerNorm' generatorDevice0, HasInitialize multiHeadAttention generatorDevice0 multiHeadAttention' generatorDevice1, HasInitialize dropout generatorDevice1 dropout' generatorDevice2, HasInitialize finalLayerNorm generatorDevice2 finalLayerNorm' generatorOutputDevice) => HasInitialize (GSelfAttention initialLayerNorm multiHeadAttention dropout finalLayerNorm) generatorDevice (GSelfAttention initialLayerNorm' multiHeadAttention' dropout' finalLayerNorm') generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GSelfAttention

Methods

initialize :: MonadThrow m => ModelSpec (GSelfAttention initialLayerNorm multiHeadAttention dropout finalLayerNorm) -> Generator generatorDevice -> m (GSelfAttention initialLayerNorm' multiHeadAttention' dropout' finalLayerNorm', Generator generatorOutputDevice) Source #

(HasInitialize a generatorDevice outputA generatorOutputADevice, HasInitialize b generatorOutputADevice outputB generatorOutputBDevice, HasInitialize c generatorOutputBDevice outputC generatorOutputCDevice, HasInitialize d generatorOutputCDevice outputD generatorOutputDevice) => HasInitialize (a, b, c, d) generatorDevice (outputA, outputB, outputC, outputD) generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

initialize :: MonadThrow m => ModelSpec (a, b, c, d) -> Generator generatorDevice -> m ((outputA, outputB, outputC, outputD), Generator generatorOutputDevice) Source #

HasInitialize (LayerNorm hasBias gradient device dataType normalizedShape) generatorDevice (LayerNorm hasBias gradient device dataType normalizedShape) generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Normalization

Methods

initialize :: MonadThrow m => ModelSpec (LayerNorm hasBias gradient device dataType normalizedShape) -> Generator generatorDevice -> m (LayerNorm hasBias gradient device dataType normalizedShape, Generator generatorDevice) Source #

(HasInitialize encoder generatorDevice encoder' generatorDevice0, HasInitialize decoder generatorDevice0 decoder' generatorDevice1, HasInitialize sharedEmbedding generatorDevice1 sharedEmbedding' generatorDevice2, HasInitialize head generatorDevice2 head' generatorOutputDevice) => HasInitialize (GEncoderDecoderTransformer inputEmbedDim encoder decoder sharedEmbedding head) generatorDevice (GEncoderDecoderTransformer inputEmbedDim encoder' decoder' sharedEmbedding' head') generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GEncoderDecoder

Methods

initialize :: MonadThrow m => ModelSpec (GEncoderDecoderTransformer inputEmbedDim encoder decoder sharedEmbedding head) -> Generator generatorDevice -> m (GEncoderDecoderTransformer inputEmbedDim encoder' decoder' sharedEmbedding' head', Generator generatorOutputDevice) Source #

(HasInitialize encoder generatorDevice encoder' generatorDevice0, HasInitialize encoderEmbedding generatorDevice0 encoderEmbedding' generatorDevice1, HasInitialize encoderTypeEmbedding generatorDevice1 encoderTypeEmbedding' generatorDevice2, HasInitialize head generatorDevice2 head' generatorOutputDevice) => HasInitialize (GEncoderOnlyTransformer inputEmbedDim encoder encoderEmbedding encoderTypeEmbedding head) generatorDevice (GEncoderOnlyTransformer inputEmbedDim encoder' encoderEmbedding' encoderTypeEmbedding' head') generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GEncoderOnly

Methods

initialize :: MonadThrow m => ModelSpec (GEncoderOnlyTransformer inputEmbedDim encoder encoderEmbedding encoderTypeEmbedding head) -> Generator generatorDevice -> m (GEncoderOnlyTransformer inputEmbedDim encoder' encoderEmbedding' encoderTypeEmbedding' head', Generator generatorOutputDevice) Source #

(HasInitialize a generatorDevice outputA generatorOutputADevice, HasInitialize b generatorOutputADevice outputB generatorOutputBDevice, HasInitialize c generatorOutputBDevice outputC generatorOutputCDevice, HasInitialize d generatorOutputCDevice outputD generatorOutputDDevice, HasInitialize e generatorOutputDDevice outputE generatorOutputDevice) => HasInitialize (a, b, c, d, e) generatorDevice (outputA, outputB, outputC, outputD, outputE) generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

initialize :: MonadThrow m => ModelSpec (a, b, c, d, e) -> Generator generatorDevice -> m ((outputA, outputB, outputC, outputD, outputE), Generator generatorOutputDevice) Source #

(HasInitialize dense generatorDevice dense' generatorDevice0, HasInitialize activation generatorDevice0 activation' generatorDevice1, HasInitialize layerNorm generatorDevice1 layerNorm' generatorDevice2, HasInitialize decoder generatorDevice2 decoder' generatorDevice3, HasInitialize bias generatorDevice3 bias' generatorOutputDevice) => HasInitialize (GLMHead inputEmbedDim dense activation layerNorm decoder bias) generatorDevice (GLMHead inputEmbedDim dense' activation' layerNorm' decoder' bias') generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GLMHead

Methods

initialize :: MonadThrow m => ModelSpec (GLMHead inputEmbedDim dense activation layerNorm decoder bias) -> Generator generatorDevice -> m (GLMHead inputEmbedDim dense' activation' layerNorm' decoder' bias', Generator generatorOutputDevice) Source #

(HasInitialize a generatorDevice outputA generatorOutputADevice, HasInitialize b generatorOutputADevice outputB generatorOutputBDevice, HasInitialize c generatorOutputBDevice outputC generatorOutputCDevice, HasInitialize d generatorOutputCDevice outputD generatorOutputDDevice, HasInitialize e generatorOutputDDevice outputE generatorOutputEDevice, HasInitialize f generatorOutputEDevice outputF generatorOutputDevice) => HasInitialize (a, b, c, d, e, f) generatorDevice (outputA, outputB, outputC, outputD, outputE, outputF) generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

initialize :: MonadThrow m => ModelSpec (a, b, c, d, e, f) -> Generator generatorDevice -> m ((outputA, outputB, outputC, outputD, outputE, outputF), Generator generatorOutputDevice) Source #

(output ~ Embedding gradient layout (device <+> generatorDevice) dataType embedNumDim embedDim paddingIdx, generatorOutputDevice ~ (device <+> generatorDevice), SGetGeneratorDevice generatorDevice) => HasInitialize (Embedding gradient layout device dataType embedNumDim embedDim paddingIdx) generatorDevice output generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Sparse

Methods

initialize :: MonadThrow m => ModelSpec (Embedding gradient layout device dataType embedNumDim embedDim paddingIdx) -> Generator generatorDevice -> m (output, Generator generatorOutputDevice) Source #

(HasInitialize model generatorDevice model' generatorDevice0, HasInitialize mkPos generatorDevice0 mkPos' generatorDevice1, HasInitialize mkDecoderPos generatorDevice1 mkDecoderPos' generatorDevice2, HasInitialize mkPaddingMask generatorDevice2 mkPaddingMask' generatorDevice3, HasInitialize mkAttentionMask generatorDevice3 mkAttentionMask' generatorDevice4, HasInitialize mkCrossAttentionMask generatorDevice4 mkCrossAttentionMask' generatorDevice5, HasInitialize mkDecoderAttentionMask generatorDevice5 mkDecoderAttentionMask' generatorOutputDevice) => HasInitialize (GSimplifiedEncoderDecoderTransformer model mkPos mkDecoderPos mkPaddingMask mkAttentionMask mkCrossAttentionMask mkDecoderAttentionMask) generatorDevice (GSimplifiedEncoderDecoderTransformer model' mkPos' mkDecoderPos' mkPaddingMask' mkAttentionMask' mkCrossAttentionMask' mkDecoderAttentionMask') generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GEncoderDecoder

Methods

initialize :: MonadThrow m => ModelSpec (GSimplifiedEncoderDecoderTransformer model mkPos mkDecoderPos mkPaddingMask mkAttentionMask mkCrossAttentionMask mkDecoderAttentionMask) -> Generator generatorDevice -> m (GSimplifiedEncoderDecoderTransformer model' mkPos' mkDecoderPos' mkPaddingMask' mkAttentionMask' mkCrossAttentionMask' mkDecoderAttentionMask', Generator generatorOutputDevice) Source #

(HasInitialize inputLayerNorm generatorDevice inputLayerNorm' generatorDevice0, HasInitialize inputTransformation generatorDevice0 inputTransformation' generatorDevice1, HasInitialize activation generatorDevice1 activation' generatorDevice2, HasInitialize activationDropout generatorDevice2 activationDropout' generatorDevice3, HasInitialize outputProjection generatorDevice3 outputProjection' generatorDevice4, HasInitialize outputDropout generatorDevice4 outputDropout' generatorDevice5, HasInitialize outputLayerNorm generatorDevice5 outputLayerNorm' generatorOutputDevice) => HasInitialize (GTransformerFeedForwardNetwork inputLayerNorm inputTransformation activation activationDropout outputProjection outputDropout outputLayerNorm) generatorDevice (GTransformerFeedForwardNetwork inputLayerNorm' inputTransformation' activation' activationDropout' outputProjection' outputDropout' outputLayerNorm') generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GFeedForwardNetwork

Methods

initialize :: MonadThrow m => ModelSpec (GTransformerFeedForwardNetwork inputLayerNorm inputTransformation activation activationDropout outputProjection outputDropout outputLayerNorm) -> Generator generatorDevice -> m (GTransformerFeedForwardNetwork inputLayerNorm' inputTransformation' activation' activationDropout' outputProjection' outputDropout' outputLayerNorm', Generator generatorOutputDevice) Source #

(HasInitialize posEnc generatorDevice posEnc' generatorDevice0, HasInitialize relPosEnc generatorDevice0 relPosEnc' generatorDevice1, HasInitialize initialLayerNorm generatorDevice1 initialLayerNorm' generatorDevice2, HasInitialize initialDropout generatorDevice2 initialDropout' generatorDevice3, HasInitialize stack generatorDevice3 stack' generatorDevice4, HasInitialize finalLayerNorm generatorDevice4 finalLayerNorm' generatorDevice5, HasInitialize finalDropout generatorDevice5 finalDropout' generatorOutputDevice) => HasInitialize (GTransformer posEnc relPosEnc initialLayerNorm initialDropout stack finalLayerNorm finalDropout) generatorDevice (GTransformer posEnc' relPosEnc' initialLayerNorm' initialDropout' stack' finalLayerNorm' finalDropout') generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GTransformer

Methods

initialize :: MonadThrow m => ModelSpec (GTransformer posEnc relPosEnc initialLayerNorm initialDropout stack finalLayerNorm finalDropout) -> Generator generatorDevice -> m (GTransformer posEnc' relPosEnc' initialLayerNorm' initialDropout' stack' finalLayerNorm' finalDropout', Generator generatorOutputDevice) Source #

(HasInitialize a generatorDevice outputA generatorOutputADevice, HasInitialize b generatorOutputADevice outputB generatorOutputBDevice, HasInitialize c generatorOutputBDevice outputC generatorOutputCDevice, HasInitialize d generatorOutputCDevice outputD generatorOutputDDevice, HasInitialize e generatorOutputDDevice outputE generatorOutputEDevice, HasInitialize f generatorOutputEDevice outputF generatorOutputFDevice, HasInitialize g generatorOutputFDevice outputG generatorOutputDevice) => HasInitialize (a, b, c, d, e, f, g) generatorDevice (outputA, outputB, outputC, outputD, outputE, outputF, outputG) generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

initialize :: MonadThrow m => ModelSpec (a, b, c, d, e, f, g) -> Generator generatorDevice -> m ((outputA, outputB, outputC, outputD, outputE, outputF, outputG), Generator generatorOutputDevice) Source #

(HasInitialize qInProj generatorDevice qInProj' generatorDevice0, HasInitialize kInProj generatorDevice0 kInProj' generatorDevice1, HasInitialize vInProj generatorDevice1 vInProj' generatorDevice2, HasInitialize outProj generatorDevice2 outProj' generatorDevice3, HasInitialize dropout generatorDevice3 dropout' generatorOutputDevice) => HasInitialize (GMultiHeadAttention headDim headEmbedDim embedDim qInProj kInProj vInProj outProj dropout) generatorDevice (GMultiHeadAttention headDim headEmbedDim embedDim qInProj' kInProj' vInProj' outProj' dropout') generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GMultiHeadAttention

Methods

initialize :: MonadThrow m => ModelSpec (GMultiHeadAttention headDim headEmbedDim embedDim qInProj kInProj vInProj outProj dropout) -> Generator generatorDevice -> m (GMultiHeadAttention headDim headEmbedDim embedDim qInProj' kInProj' vInProj' outProj' dropout', Generator generatorOutputDevice) Source #

class GHasInitialize gModelSpec generatorDevice gOutput generatorOutputDevice | gModelSpec generatorDevice -> gOutput, gModelSpec generatorDevice -> generatorOutputDevice where Source #

Methods

gInitialize :: forall m c. MonadThrow m => gModelSpec c -> Generator generatorDevice -> m (gOutput c, Generator generatorOutputDevice) Source #

Instances

Instances details
GHasInitialize (U1 :: Type -> Type) generatorDevice (U1 :: Type -> Type) generatorDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

gInitialize :: MonadThrow m => U1 c -> Generator generatorDevice -> m (U1 c, Generator generatorDevice) Source #

(GHasInitialize gModelSpecA generatorDevice gOutputA generatorOutputADevice, GHasInitialize gModelSpecB generatorOutputADevice gOutputB generatorOutputDevice) => GHasInitialize (gModelSpecA :*: gModelSpecB) generatorDevice (gOutputA :*: gOutputB) generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

gInitialize :: MonadThrow m => (gModelSpecA :*: gModelSpecB) c -> Generator generatorDevice -> m ((gOutputA :*: gOutputB) c, Generator generatorOutputDevice) Source #

(HasInitialize model generatorDevice output generatorOutputDevice, ModelSpec model ~ modelSpec) => GHasInitialize (K1 i modelSpec :: Type -> Type) generatorDevice (K1 i output :: Type -> Type) generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

gInitialize :: MonadThrow m => K1 i modelSpec c -> Generator generatorDevice -> m (K1 i output c, Generator generatorOutputDevice) Source #

GHasInitialize gModelSpec generatorDevice gOutput generatorOutputDevice => GHasInitialize (M1 i t gModelSpec) generatorDevice (M1 i t gOutput) generatorOutputDevice Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

gInitialize :: MonadThrow m => M1 i t gModelSpec c -> Generator generatorDevice -> m (M1 i t gOutput c, Generator generatorOutputDevice) Source #

data VectorSpec (n :: Nat) (a :: Type) where Source #

Constructors

VectorSpec :: forall n a. SNat n -> Vector n (ModelSpec a) -> VectorSpec n a 

Instances

Instances details
Show (ModelSpec a) => Show (VectorSpec n a) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

class HasStateDict model where Source #

Minimal complete definition

Nothing

Methods

fromStateDict :: forall m. (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec model -> StateDictKey -> m model Source #

default fromStateDict :: forall m. (MonadIO m, MonadThrow m, MonadState StateDict m, Generic model, Generic (ModelSpec model), GHasStateDict (Rep model) (Rep (ModelSpec model))) => ModelSpec model -> StateDictKey -> m model Source #

toStateDict :: forall m. (MonadThrow m, MonadState StateDict m) => StateDictKey -> model -> m () Source #

default toStateDict :: forall m. (MonadThrow m, MonadState StateDict m, Generic model, GHasStateDict (Rep model) (Rep (ModelSpec model))) => StateDictKey -> model -> m () Source #

Instances

Instances details
HasStateDict Gelu Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Activation

HasStateDict GeluNew Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Activation

HasStateDict Relu Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Activation

HasStateDict Tanh Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Activation

HasStateDict Dropout Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Dropout

HasStateDict MSELoss Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Loss

HasStateDict EncoderDecoderTransformerHasEmbedScaling Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GEncoderDecoder

HasStateDict EncoderOnlyTransformerHasEmbedScaling Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GEncoderOnly

HasStateDict LMHeadHasScaling Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GLMHead

HasStateDict MultiHeadAttentionHasScaling Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GMultiHeadAttention

HasStateDict MkAbsPos Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.Type

HasStateDict MkTransformerPaddingMask Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.Type

HasStateDict () Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

HasStateDict (LogSoftmax selectDim) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Activation

HasStateDict (Softmax selectDim) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Activation

Methods

fromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec (Softmax selectDim) -> StateDictKey -> m (Softmax selectDim) Source #

toStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> Softmax selectDim -> m () Source #

HasStateDict (a, b, c, d, e, f, g) => HasStateDict (ModelStack '[a, b, c, d, e, f, g]) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

fromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec (ModelStack '[a, b, c, d, e, f, g]) -> StateDictKey -> m (ModelStack '[a, b, c, d, e, f, g]) Source #

toStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> ModelStack '[a, b, c, d, e, f, g] -> m () Source #

HasStateDict (a, b, c, d, e, f) => HasStateDict (ModelStack '[a, b, c, d, e, f]) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

fromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec (ModelStack '[a, b, c, d, e, f]) -> StateDictKey -> m (ModelStack '[a, b, c, d, e, f]) Source #

toStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> ModelStack '[a, b, c, d, e, f] -> m () Source #

HasStateDict (a, b, c, d, e) => HasStateDict (ModelStack '[a, b, c, d, e]) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

fromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec (ModelStack '[a, b, c, d, e]) -> StateDictKey -> m (ModelStack '[a, b, c, d, e]) Source #

toStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> ModelStack '[a, b, c, d, e] -> m () Source #

HasStateDict (a, b, c, d) => HasStateDict (ModelStack '[a, b, c, d]) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

fromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec (ModelStack '[a, b, c, d]) -> StateDictKey -> m (ModelStack '[a, b, c, d]) Source #

toStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> ModelStack '[a, b, c, d] -> m () Source #

HasStateDict (a, b, c) => HasStateDict (ModelStack '[a, b, c]) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

HasStateDict (a, b) => HasStateDict (ModelStack '[a, b]) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

HasStateDict a => HasStateDict (ModelStack '[a]) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

HasStateDict (ModelStack ('[] :: [Type])) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

HasStateDict model => HasStateDict (NamedModel model) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

HasStateDict a => HasStateDict (Wrap a) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

HasStateDict bias => HasStateDict (GBias bias) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GLMHead

HasStateDict block => HasStateDict (GTransformerStack (Vector numLayers block)) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GStack

HasStateDict (MkRelPos relPosEncBucketDim) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.Type

Methods

fromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec (MkRelPos relPosEncBucketDim) -> StateDictKey -> m (MkRelPos relPosEncBucketDim) Source #

toStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> MkRelPos relPosEncBucketDim -> m () Source #

HasStateDict (MkTransformerAttentionMask dataType) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.Type

HasStateDict (MkTransformerCrossAttentionMask dataType) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.Type

HasStateDict (MkTransformerDecoderAttentionMask dataType) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.Type

HasStateDict (ShiftRight fillValue) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.Type

HasStateDict (SDim dim) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

(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 #

HasStateDict a => HasStateDict (Vector n a) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

(HasStateDict a, HasStateDict b) => HasStateDict (a, b) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

(HasStateDict selfAttention, HasStateDict crossAttention, HasStateDict feedForwardNetwork) => HasStateDict (GTransformerBlock selfAttention crossAttention feedForwardNetwork) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GBlock

Methods

fromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec (GTransformerBlock selfAttention crossAttention feedForwardNetwork) -> StateDictKey -> m (GTransformerBlock selfAttention crossAttention feedForwardNetwork) Source #

toStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> GTransformerBlock selfAttention crossAttention feedForwardNetwork -> m () Source #

(HasStateDict layer0, HasStateDict activation, HasStateDict layer1) => HasStateDict (GGate layer0 activation layer1) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GFeedForwardNetwork

Methods

fromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec (GGate layer0 activation layer1) -> StateDictKey -> m (GGate layer0 activation layer1) Source #

toStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> GGate layer0 activation layer1 -> m () Source #

(HasStateDict a, HasStateDict b, HasStateDict c) => HasStateDict (a, b, c) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

fromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec (a, b, c) -> StateDictKey -> m (a, b, c) Source #

toStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> (a, b, c) -> m () Source #

(HasStateDict initialLayerNorm, HasStateDict multiHeadAttention, HasStateDict dropout, HasStateDict finalLayerNorm) => HasStateDict (GCrossAttention initialLayerNorm multiHeadAttention dropout finalLayerNorm) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GCrossAttention

Methods

fromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec (GCrossAttention initialLayerNorm multiHeadAttention dropout finalLayerNorm) -> StateDictKey -> m (GCrossAttention initialLayerNorm multiHeadAttention dropout finalLayerNorm) Source #

toStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> GCrossAttention initialLayerNorm multiHeadAttention dropout finalLayerNorm -> m () Source #

(HasStateDict model, HasStateDict mkPos, HasStateDict mkPaddingMask, HasStateDict mkAttentionMask) => HasStateDict (GSimplifiedEncoderOnlyTransformer model mkPos mkPaddingMask mkAttentionMask) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GEncoderOnly

Methods

fromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec (GSimplifiedEncoderOnlyTransformer model mkPos mkPaddingMask mkAttentionMask) -> StateDictKey -> m (GSimplifiedEncoderOnlyTransformer model mkPos mkPaddingMask mkAttentionMask) Source #

toStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> GSimplifiedEncoderOnlyTransformer model mkPos mkPaddingMask mkAttentionMask -> m () Source #

(HasStateDict initialLayerNorm, HasStateDict multiHeadAttention, HasStateDict dropout, HasStateDict finalLayerNorm) => HasStateDict (GSelfAttention initialLayerNorm multiHeadAttention dropout finalLayerNorm) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GSelfAttention

Methods

fromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec (GSelfAttention initialLayerNorm multiHeadAttention dropout finalLayerNorm) -> StateDictKey -> m (GSelfAttention initialLayerNorm multiHeadAttention dropout finalLayerNorm) Source #

toStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> GSelfAttention initialLayerNorm multiHeadAttention dropout finalLayerNorm -> m () Source #

(HasStateDict a, HasStateDict b, HasStateDict c, HasStateDict d) => HasStateDict (a, b, c, d) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

fromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec (a, b, c, d) -> StateDictKey -> m (a, b, c, d) Source #

toStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> (a, b, c, d) -> m () Source #

HasStateDict (LayerNorm hasBias gradient device dataType normalizedShape) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Normalization

Methods

fromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec (LayerNorm hasBias gradient device dataType normalizedShape) -> StateDictKey -> m (LayerNorm hasBias gradient device dataType normalizedShape) Source #

toStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> LayerNorm hasBias gradient device dataType normalizedShape -> m () Source #

(HasStateDict encoder, HasStateDict decoder, HasStateDict sharedEmbedding, HasStateDict head) => HasStateDict (GEncoderDecoderTransformer inputEmbedDim encoder decoder sharedEmbedding head) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GEncoderDecoder

Methods

fromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec (GEncoderDecoderTransformer inputEmbedDim encoder decoder sharedEmbedding head) -> StateDictKey -> m (GEncoderDecoderTransformer inputEmbedDim encoder decoder sharedEmbedding head) Source #

toStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> GEncoderDecoderTransformer inputEmbedDim encoder decoder sharedEmbedding head -> m () Source #

(HasStateDict encoder, HasStateDict encoderEmbedding, HasStateDict encoderTypeEmbedding, HasStateDict head) => HasStateDict (GEncoderOnlyTransformer inputEmbedDim encoder encoderEmbedding encoderTypeEmbedding head) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GEncoderOnly

Methods

fromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec (GEncoderOnlyTransformer inputEmbedDim encoder encoderEmbedding encoderTypeEmbedding head) -> StateDictKey -> m (GEncoderOnlyTransformer inputEmbedDim encoder encoderEmbedding encoderTypeEmbedding head) Source #

toStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> GEncoderOnlyTransformer inputEmbedDim encoder encoderEmbedding encoderTypeEmbedding head -> m () Source #

HasStateDict (Tensor gradient layout device dataType shape) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

fromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec (Tensor gradient layout device dataType shape) -> StateDictKey -> m (Tensor gradient layout device dataType shape) Source #

toStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> Tensor gradient layout device dataType shape -> m () Source #

(HasStateDict a, HasStateDict b, HasStateDict c, HasStateDict d, HasStateDict e) => HasStateDict (a, b, c, d, e) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

fromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec (a, b, c, d, e) -> StateDictKey -> m (a, b, c, d, e) Source #

toStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> (a, b, c, d, e) -> m () Source #

(HasStateDict dense, HasStateDict activation, HasStateDict layerNorm, HasStateDict decoder, HasStateDict bias) => HasStateDict (GLMHead inputEmbedDim dense activation layerNorm decoder bias) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GLMHead

Methods

fromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec (GLMHead inputEmbedDim dense activation layerNorm decoder bias) -> StateDictKey -> m (GLMHead inputEmbedDim dense activation layerNorm decoder bias) Source #

toStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> GLMHead inputEmbedDim dense activation layerNorm decoder bias -> m () Source #

(HasStateDict a, HasStateDict b, HasStateDict c, HasStateDict d, HasStateDict e, HasStateDict f) => HasStateDict (a, b, c, d, e, f) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

fromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec (a, b, c, d, e, f) -> StateDictKey -> m (a, b, c, d, e, f) Source #

toStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> (a, b, c, d, e, f) -> m () Source #

HasStateDict (Embedding gradient layout device dataType embedNumDim embedDim paddingIdx) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Sparse

Methods

fromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec (Embedding gradient layout device dataType embedNumDim embedDim paddingIdx) -> StateDictKey -> m (Embedding gradient layout device dataType embedNumDim embedDim paddingIdx) Source #

toStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> Embedding gradient layout device dataType embedNumDim embedDim paddingIdx -> m () Source #

(HasStateDict model, HasStateDict mkPos, HasStateDict mkDecoderPos, HasStateDict mkPaddingMask, HasStateDict mkAttentionMask, HasStateDict mkCrossAttentionMask, HasStateDict mkDecoderAttentionMask) => HasStateDict (GSimplifiedEncoderDecoderTransformer model mkPos mkDecoderPos mkPaddingMask mkAttentionMask mkCrossAttentionMask mkDecoderAttentionMask) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GEncoderDecoder

Methods

fromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec (GSimplifiedEncoderDecoderTransformer model mkPos mkDecoderPos mkPaddingMask mkAttentionMask mkCrossAttentionMask mkDecoderAttentionMask) -> StateDictKey -> m (GSimplifiedEncoderDecoderTransformer model mkPos mkDecoderPos mkPaddingMask mkAttentionMask mkCrossAttentionMask mkDecoderAttentionMask) Source #

toStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> GSimplifiedEncoderDecoderTransformer model mkPos mkDecoderPos mkPaddingMask mkAttentionMask mkCrossAttentionMask mkDecoderAttentionMask -> m () Source #

(HasStateDict inputLayerNorm, HasStateDict inputTransformation, HasStateDict activation, HasStateDict activationDropout, HasStateDict outputProjection, HasStateDict outputDropout, HasStateDict outputLayerNorm) => HasStateDict (GTransformerFeedForwardNetwork inputLayerNorm inputTransformation activation activationDropout outputProjection outputDropout outputLayerNorm) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GFeedForwardNetwork

Methods

fromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec (GTransformerFeedForwardNetwork inputLayerNorm inputTransformation activation activationDropout outputProjection outputDropout outputLayerNorm) -> StateDictKey -> m (GTransformerFeedForwardNetwork inputLayerNorm inputTransformation activation activationDropout outputProjection outputDropout outputLayerNorm) Source #

toStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> GTransformerFeedForwardNetwork inputLayerNorm inputTransformation activation activationDropout outputProjection outputDropout outputLayerNorm -> m () Source #

(HasStateDict posEnc, HasStateDict relPosEnc, HasStateDict initialLayerNorm, HasStateDict initialDropout, HasStateDict stack, HasStateDict finalLayerNorm, HasStateDict finalDropout) => HasStateDict (GTransformer posEnc relPosEnc initialLayerNorm initialDropout stack finalLayerNorm finalDropout) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GTransformer

Methods

fromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec (GTransformer posEnc relPosEnc initialLayerNorm initialDropout stack finalLayerNorm finalDropout) -> StateDictKey -> m (GTransformer posEnc relPosEnc initialLayerNorm initialDropout stack finalLayerNorm finalDropout) Source #

toStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> GTransformer posEnc relPosEnc initialLayerNorm initialDropout stack finalLayerNorm finalDropout -> m () Source #

(HasStateDict a, HasStateDict b, HasStateDict c, HasStateDict d, HasStateDict e, HasStateDict f, HasStateDict g) => HasStateDict (a, b, c, d, e, f, g) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

fromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec (a, b, c, d, e, f, g) -> StateDictKey -> m (a, b, c, d, e, f, g) Source #

toStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> (a, b, c, d, e, f, g) -> m () Source #

(HasStateDict qInProj, HasStateDict vInProj, HasStateDict kInProj, HasStateDict outProj, HasStateDict dropout) => HasStateDict (GMultiHeadAttention headDim headEmbedDim embedDim qInProj kInProj vInProj outProj dropout) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.GMultiHeadAttention

Methods

fromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => ModelSpec (GMultiHeadAttention headDim headEmbedDim embedDim qInProj kInProj vInProj outProj dropout) -> StateDictKey -> m (GMultiHeadAttention headDim headEmbedDim embedDim qInProj kInProj vInProj outProj dropout) Source #

toStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> GMultiHeadAttention headDim headEmbedDim embedDim qInProj kInProj vInProj outProj dropout -> m () Source #

class GHasStateDict gModel gModelSpec | gModelSpec -> gModel, gModel -> gModelSpec where Source #

Methods

gFromStateDict :: forall m c. (MonadIO m, MonadThrow m, MonadState StateDict m) => gModelSpec c -> StateDictKey -> m (gModel c) Source #

gToStateDict :: forall m c. (MonadThrow m, MonadState StateDict m) => StateDictKey -> gModel c -> m () Source #

Instances

Instances details
GHasStateDict (U1 :: Type -> Type) (U1 :: Type -> Type) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

(GHasStateDict gModelA gModelSpecA, GHasStateDict gModelB gModelSpecB) => GHasStateDict (gModelA :*: gModelB) (gModelSpecA :*: gModelSpecB) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

gFromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => (gModelSpecA :*: gModelSpecB) c -> StateDictKey -> m ((gModelA :*: gModelB) c) Source #

gToStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> (gModelA :*: gModelB) c -> m () Source #

(HasStateDict model, modelSpec ~ ModelSpec model) => GHasStateDict (K1 i model :: Type -> Type) (K1 i modelSpec :: Type -> Type) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

gFromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => K1 i modelSpec c -> StateDictKey -> m (K1 i model c) Source #

gToStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> K1 i model c -> m () Source #

GHasStateDict gModel gModelSpec => GHasStateDict (M1 i t gModel) (M1 i t gModelSpec) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Class

Methods

gFromStateDict :: (MonadIO m, MonadThrow m, MonadState StateDict m) => M1 i t gModelSpec c -> StateDictKey -> m (M1 i t gModel c) Source #

gToStateDict :: (MonadThrow m, MonadState StateDict m) => StateDictKey -> M1 i t gModel c -> m () Source #

stateDictFromFile :: FilePath -> IO StateDict Source #

Load a state dictionary from a TorchScript file.

stateDictToFile :: StateDict -> FilePath -> IO () Source #

Save a state dictionary to a TorchScript file.