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

Torch.GraduallyTyped.NN.Functional.Sparse

Documentation

type EmbedDimsErrorMessage (embedDims :: [Dim (Name Symbol) (Size Nat)]) = "Cannot apply the embedding." % ("The embedding weight tensor must have exactly two dimensions," % ("but the following dimensions were found:" % ("" % (((" " <> embedDims) <> ".") % "")))) Source #

type family EmbeddingF (weightShape :: Shape [Dim (Name Symbol) (Size Nat)]) (inputShape :: Shape [Dim (Name Symbol) (Size Nat)]) :: Shape [Dim (Name Symbol) (Size Nat)] where ... Source #

Equations

EmbeddingF 'UncheckedShape _ = 'UncheckedShape 
EmbeddingF _ 'UncheckedShape = 'UncheckedShape 
EmbeddingF ('Shape '[_embedNumDim, embedDim]) ('Shape inputDims) = 'Shape (Reverse (embedDim ': Reverse inputDims)) 
EmbeddingF ('Shape embedDims) _ = TypeError (EmbedDimsErrorMessage embedDims) 

embedding Source #

Arguments

:: forall gradient layout device dataType shape gradient' layout' device' dataType' shape'. (SGetLayout layout, Catch (dataType' <+> 'DataType 'Int64)) 
=> Maybe Natural

padding index

-> Bool

whether or not to scale gradients by the inverse of frequency of the words in the mini-batch

-> Tensor gradient layout device dataType shape

weight

-> Tensor gradient' layout' device' dataType' shape'

input

-> Tensor (gradient <|> gradient') (layout <+> layout') (device <+> device') dataType (EmbeddingF shape shape')

output