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

Torch.GraduallyTyped.Layout

Synopsis

Documentation

data LayoutType Source #

Data type that represents the memory layout of a tensor.

Constructors

Dense

The memory layout of the tensor is dense (strided).

Sparse

The memory layout of the tensor is sparse.

Instances

Instances details
Show LayoutType Source # 
Instance details

Defined in Torch.GraduallyTyped.Layout

Eq LayoutType Source # 
Instance details

Defined in Torch.GraduallyTyped.Layout

SingKind LayoutType Source # 
Instance details

Defined in Torch.GraduallyTyped.Layout

Associated Types

type Demote LayoutType = (r :: Type) Source #

Castable LayoutType Layout Source # 
Instance details

Defined in Torch.GraduallyTyped.Layout

Methods

cast :: LayoutType -> (Layout -> IO r) -> IO r Source #

uncast :: Layout -> (LayoutType -> IO r) -> IO r Source #

SingI 'Dense Source # 
Instance details

Defined in Torch.GraduallyTyped.Layout

Methods

sing :: Sing 'Dense Source #

SingI 'Sparse Source # 
Instance details

Defined in Torch.GraduallyTyped.Layout

Methods

sing :: Sing 'Sparse 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 #

KnownLayout ('UncheckedLayout :: Layout LayoutType) Source # 
Instance details

Defined in Torch.GraduallyTyped.Layout

SGetLayout ('UncheckedLayout :: Layout LayoutType) Source # 
Instance details

Defined in Torch.GraduallyTyped.Tensor.Type

Methods

sGetLayout :: forall (gradient :: Gradient RequiresGradient) (device :: Device (DeviceType Nat)) (dataType :: DataType DType) (shape :: Shape [Dim (Name Symbol) (Size Nat)]). Tensor gradient 'UncheckedLayout device dataType shape -> SLayout 'UncheckedLayout Source #

getLayoutType :: forall (gradient :: Gradient RequiresGradient) (device :: Device (DeviceType Nat)) (dataType :: DataType DType) (shape :: Shape [Dim (Name Symbol) (Size Nat)]). Tensor gradient 'UncheckedLayout device dataType shape -> LayoutType Source #

SingKind (Layout LayoutType) Source # 
Instance details

Defined in Torch.GraduallyTyped.Layout

Associated Types

type Demote (Layout LayoutType) = (r :: Type) Source #

SingI layoutType => SingI ('Layout layoutType :: Layout LayoutType) Source # 
Instance details

Defined in Torch.GraduallyTyped.Layout

Methods

sing :: Sing ('Layout layoutType) 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 #

KnownLayoutType layoutType => KnownLayout ('Layout layoutType) Source # 
Instance details

Defined in Torch.GraduallyTyped.Layout

SGetLayout ('Layout 'Dense) Source # 
Instance details

Defined in Torch.GraduallyTyped.Tensor.Type

Methods

sGetLayout :: forall (gradient :: Gradient RequiresGradient) (device :: Device (DeviceType Nat)) (dataType :: DataType DType) (shape :: Shape [Dim (Name Symbol) (Size Nat)]). Tensor gradient ('Layout 'Dense) device dataType shape -> SLayout ('Layout 'Dense) Source #

getLayoutType :: forall (gradient :: Gradient RequiresGradient) (device :: Device (DeviceType Nat)) (dataType :: DataType DType) (shape :: Shape [Dim (Name Symbol) (Size Nat)]). Tensor gradient ('Layout 'Dense) device dataType shape -> LayoutType Source #

SGetLayout ('Layout 'Sparse) Source # 
Instance details

Defined in Torch.GraduallyTyped.Tensor.Type

Methods

sGetLayout :: forall (gradient :: Gradient RequiresGradient) (device :: Device (DeviceType Nat)) (dataType :: DataType DType) (shape :: Shape [Dim (Name Symbol) (Size Nat)]). Tensor gradient ('Layout 'Sparse) device dataType shape -> SLayout ('Layout 'Sparse) Source #

getLayoutType :: forall (gradient :: Gradient RequiresGradient) (device :: Device (DeviceType Nat)) (dataType :: DataType DType) (shape :: Shape [Dim (Name Symbol) (Size Nat)]). Tensor gradient ('Layout 'Sparse) device dataType shape -> LayoutType 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 #

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

Defined in Torch.GraduallyTyped.NN.Linear

Methods

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

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

Defined in Torch.GraduallyTyped.NN.Linear

Methods

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

type Demote LayoutType Source # 
Instance details

Defined in Torch.GraduallyTyped.Layout

type Sing Source # 
Instance details

Defined in Torch.GraduallyTyped.Layout

type Demote (Layout LayoutType) Source # 
Instance details

Defined in Torch.GraduallyTyped.Layout

type Sing Source # 
Instance details

Defined in Torch.GraduallyTyped.Layout

type Sing = SLayout

type family DenseSym0 :: LayoutType where ... Source #

Equations

DenseSym0 = 'Dense 

type family SparseSym0 :: LayoutType where ... Source #

Equations

SparseSym0 = 'Sparse 

data SLayoutType :: LayoutType -> Type where Source #

Instances

Instances details
Show (SLayoutType layoutType) Source # 
Instance details

Defined in Torch.GraduallyTyped.Layout

Methods

showsPrec :: Int -> SLayoutType layoutType -> ShowS Source #

show :: SLayoutType layoutType -> String Source #

showList :: [SLayoutType layoutType] -> ShowS Source #

class KnownLayoutType (layoutType :: LayoutType) where Source #

Instances

Instances details
KnownLayoutType 'Dense Source # 
Instance details

Defined in Torch.GraduallyTyped.Layout

KnownLayoutType 'Sparse Source # 
Instance details

Defined in Torch.GraduallyTyped.Layout

data Layout (layoutType :: Type) where Source #

Data type to represent whether or not the tensor's memory layout is checked, that is, known to the compiler.

Constructors

UncheckedLayout :: forall layoutType. Layout layoutType

The tensor's memory layout is unknown to the compiler.

Layout :: forall layoutType. layoutType -> Layout layoutType

The tensor's memory layout is known to the compiler.

Instances

Instances details
Show layoutType => Show (Layout layoutType) Source # 
Instance details

Defined in Torch.GraduallyTyped.Layout

Methods

showsPrec :: Int -> Layout layoutType -> ShowS Source #

show :: Layout layoutType -> String Source #

showList :: [Layout layoutType] -> ShowS Source #

SingKind (Layout LayoutType) Source # 
Instance details

Defined in Torch.GraduallyTyped.Layout

Associated Types

type Demote (Layout LayoutType) = (r :: Type) Source #

SingI layoutType => SingI ('Layout layoutType :: Layout LayoutType) Source # 
Instance details

Defined in Torch.GraduallyTyped.Layout

Methods

sing :: Sing ('Layout layoutType) Source #

type Demote (Layout LayoutType) Source # 
Instance details

Defined in Torch.GraduallyTyped.Layout

type Sing Source # 
Instance details

Defined in Torch.GraduallyTyped.Layout

type Sing = SLayout

data SLayout (layout :: Layout LayoutType) where Source #

Constructors

SUncheckedLayout :: LayoutType -> SLayout 'UncheckedLayout 
SLayout :: forall layoutType. SLayoutType layoutType -> SLayout ('Layout layoutType) 

Instances

Instances details
Show (SLayout layout) Source # 
Instance details

Defined in Torch.GraduallyTyped.Layout

Methods

showsPrec :: Int -> SLayout layout -> ShowS Source #

show :: SLayout layout -> String Source #

showList :: [SLayout layout] -> ShowS Source #

class KnownLayout (layout :: Layout LayoutType) where Source #

Instances

Instances details
KnownLayout ('UncheckedLayout :: Layout LayoutType) Source # 
Instance details

Defined in Torch.GraduallyTyped.Layout

KnownLayoutType layoutType => KnownLayout ('Layout layoutType) Source # 
Instance details

Defined in Torch.GraduallyTyped.Layout

type family GetLayouts f where ... Source #

Equations

GetLayouts (a :: Layout LayoutType) = '[a] 
GetLayouts (f g) = Concat (GetLayouts f) (GetLayouts g) 
GetLayouts _ = '[]