hasktorch-0.2.0.0: Functional differentiable programming in Haskell
Safe HaskellSafe-Inferred
LanguageHaskell2010

Torch.Typed.Tensor

Synopsis

Documentation

class KnownShape (shape :: [Nat]) where Source #

Methods

shapeVal :: [Int] Source #

Instances

Instances details
KnownShape ('[] :: [Nat]) Source # 
Instance details

Defined in Torch.Typed.Tensor

Methods

shapeVal :: [Int] Source #

(KnownNat h, KnownShape t) => KnownShape (h ': t) Source # 
Instance details

Defined in Torch.Typed.Tensor

Methods

shapeVal :: [Int] Source #

class KnownDType (dtype :: DType) where Source #

Instances

Instances details
KnownDType 'Bool Source # 
Instance details

Defined in Torch.Typed.Tensor

KnownDType 'Double Source # 
Instance details

Defined in Torch.Typed.Tensor

KnownDType 'Float Source # 
Instance details

Defined in Torch.Typed.Tensor

KnownDType 'Half Source # 
Instance details

Defined in Torch.Typed.Tensor

KnownDType 'Int16 Source # 
Instance details

Defined in Torch.Typed.Tensor

KnownDType 'Int32 Source # 
Instance details

Defined in Torch.Typed.Tensor

KnownDType 'Int64 Source # 
Instance details

Defined in Torch.Typed.Tensor

KnownDType 'Int8 Source # 
Instance details

Defined in Torch.Typed.Tensor

KnownDType 'UInt8 Source # 
Instance details

Defined in Torch.Typed.Tensor

class KnownDevice (device :: (DeviceType, Nat)) where Source #

Instances

Instances details
KnownNat n => KnownDevice '('CPU, n) Source # 
Instance details

Defined in Torch.Typed.Tensor

KnownNat n => KnownDevice '('CUDA, n) Source # 
Instance details

Defined in Torch.Typed.Tensor

type Size = Type -> Type Source #

type Shape = [Type -> Type] Source #

type family ToNat (shape :: Size) :: Nat where ... Source #

Equations

ToNat (S1 ('MetaSel _ _ _ _) f) = ToNat f 
ToNat (D1 _ f) = ToNat f 
ToNat (C1 _ f) = ToNat f 
ToNat (l :*: r) = ToNat l + ToNat r 
ToNat (l :+: r) = If (ToNat l <=? ToNat r) (ToNat r) (ToNat l) 
ToNat (K1 R (Vector n _)) = n 
ToNat (K1 _ _) = 1 
ToNat U1 = 1 
ToNat (Vector n) = n 
ToNat a = ToNat (Rep (a ())) 

type family ToNats (shape :: Shape) :: [Nat] where ... Source #

Equations

ToNats '[] = '[] 
ToNats (x ': xs) = ToNat x ': ToNats xs 

type family FromNat (shape :: Nat) :: Size where ... Source #

Equations

FromNat n = Vector n 

type family FromNats (shape :: [Nat]) :: Shape where ... Source #

Equations

FromNats '[] = '[] 
FromNats (x ': xs) = FromNat x ': FromNats xs 

class Unnamed t where Source #

Associated Types

type UTShape t :: [Nat] Source #

type UTDevice t :: (DeviceType, Nat) Source #

type UTDType t :: DType Source #

Methods

toUnnamed :: forall device dtype shape. IsUnnamed t device dtype shape => t -> Tensor device dtype shape Source #

fromUnnamed :: forall device dtype shape. IsUnnamed t device dtype shape => Tensor device dtype shape -> t Source #

toDynamic :: t -> Tensor Source #

Instances

Instances details
Unnamed (NamedTensor device dtype shape) Source # 
Instance details

Defined in Torch.Typed.Tensor

Associated Types

type UTShape (NamedTensor device dtype shape) :: [Nat] Source #

type UTDevice (NamedTensor device dtype shape) :: (DeviceType, Nat) Source #

type UTDType (NamedTensor device dtype shape) :: DType Source #

Methods

toUnnamed :: forall (device0 :: (DeviceType, Nat)) (dtype0 :: DType) (shape0 :: [Nat]). IsUnnamed (NamedTensor device dtype shape) device0 dtype0 shape0 => NamedTensor device dtype shape -> Tensor device0 dtype0 shape0 Source #

fromUnnamed :: forall (device0 :: (DeviceType, Nat)) (dtype0 :: DType) (shape0 :: [Nat]). IsUnnamed (NamedTensor device dtype shape) device0 dtype0 shape0 => Tensor device0 dtype0 shape0 -> NamedTensor device dtype shape Source #

toDynamic :: NamedTensor device dtype shape -> Tensor Source #

Unnamed (Tensor device dtype shape) Source # 
Instance details

Defined in Torch.Typed.Tensor

Associated Types

type UTShape (Tensor device dtype shape) :: [Nat] Source #

type UTDevice (Tensor device dtype shape) :: (DeviceType, Nat) Source #

type UTDType (Tensor device dtype shape) :: DType Source #

Methods

toUnnamed :: forall (device0 :: (DeviceType, Nat)) (dtype0 :: DType) (shape0 :: [Nat]). IsUnnamed (Tensor device dtype shape) device0 dtype0 shape0 => Tensor device dtype shape -> Tensor device0 dtype0 shape0 Source #

fromUnnamed :: forall (device0 :: (DeviceType, Nat)) (dtype0 :: DType) (shape0 :: [Nat]). IsUnnamed (Tensor device dtype shape) device0 dtype0 shape0 => Tensor device0 dtype0 shape0 -> Tensor device dtype shape Source #

toDynamic :: Tensor device dtype shape -> Tensor0 Source #

type family IsUnnamed t (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]) :: Constraint where ... Source #

Equations

IsUnnamed t device dtype shape = (Unnamed t, device ~ UTDevice t, dtype ~ UTDType t, shape ~ UTShape t) 

data Tensor (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]) where Source #

Constructors

UnsafeMkTensor :: forall device dtype shape. Tensor -> Tensor device dtype shape 

Instances

Instances details
KnownDType dtype' => HasToDType (dtype' :: DType) (dtype :: DType) (Tensor device dtype shape) (Tensor device dtype' shape) Source # 
Instance details

Defined in Torch.Typed.DType

Methods

toDType :: Tensor device dtype shape -> Tensor device dtype' shape Source #

(KnownNat batchSize, KnownDevice device, Applicative m) => Dataset (m :: Type -> Type) (MNIST m device batchSize) Int ((Tensor device 'Float '[batchSize, 784], Tensor device 'Int64 '[batchSize]) :: Type) Source # 
Instance details

Defined in Torch.Typed.Vision

Methods

getItem :: MNIST m device batchSize -> Int -> m (Tensor device 'Float '[batchSize, 784], Tensor device 'Int64 '[batchSize]) Source #

keys :: MNIST m device batchSize -> Set Int Source #

KnownDevice device' => HasToDevice device' device (Tensor device dtype shape) (Tensor device' dtype shape) Source # 
Instance details

Defined in Torch.Typed.Device

Methods

toDevice :: Tensor device dtype shape -> Tensor device' dtype shape Source #

(HasGrad (HList parameters) (HList gradients), Castable (HList gradients) [ATenTensor]) => Apply' GradConcurrentlyF (HList parameters, Loss device dtype) (Concurrently (HList gradients)) Source # 
Instance details

Defined in Torch.Typed.NN.DataParallel

Methods

apply' :: GradConcurrentlyF -> (HList parameters, Loss device dtype) -> Concurrently (HList gradients) Source #

Apply' MakeIndependent (Tensor device dtype shape) (IO (Parameter device dtype shape)) Source # 
Instance details

Defined in Torch.Typed.Parameter

Methods

apply' :: MakeIndependent -> Tensor device dtype shape -> IO (Parameter device dtype shape) Source #

Apply' ToParameter (Tensor dev dtype shape) (Parameter dev dtype shape) Source # 
Instance details

Defined in Torch.Typed.Optim.CppOptim

Methods

apply' :: ToParameter -> Tensor dev dtype shape -> Parameter dev dtype shape Source #

Apply' ToDependent (Parameter device dtype shape) (Tensor device dtype shape) Source # 
Instance details

Defined in Torch.Typed.Parameter

Methods

apply' :: ToDependent -> Parameter device dtype shape -> Tensor device dtype shape Source #

HasForward Dropout (Tensor device dtype shape) (Tensor device dtype shape) Source # 
Instance details

Defined in Torch.Typed.NN.Dropout

Methods

forward :: Dropout -> Tensor device dtype shape -> Tensor device dtype shape Source #

forwardStoch :: Dropout -> Tensor device dtype shape -> IO (Tensor device dtype shape) Source #

(TensorLike [ComputeItemType (ComputeHaskellType dtype) shape], KnownDevice device, KnownShape shape) => IsList (Maybe (Tensor device dtype shape)) Source # 
Instance details

Defined in Torch.Typed.Tensor

Associated Types

type Item (Maybe (Tensor device dtype shape)) Source #

Methods

fromList :: [Item (Maybe (Tensor device dtype shape))] -> Maybe (Tensor device dtype shape) Source #

fromListN :: Int -> [Item (Maybe (Tensor device dtype shape))] -> Maybe (Tensor device dtype shape) Source #

toList :: Maybe (Tensor device dtype shape) -> [Item (Maybe (Tensor device dtype shape))] Source #

Castable [Tensor device dtype shape] (ForeignPtr TensorList) Source # 
Instance details

Defined in Torch.Typed.Tensor

Methods

cast :: [Tensor device dtype shape] -> (ForeignPtr TensorList -> IO r) -> IO r Source #

uncast :: ForeignPtr TensorList -> ([Tensor device dtype shape] -> IO r) -> IO r Source #

(chunks ~ ListLength devices', tensorChunks ~ (Chunk chunks 0 shape dtype device :: [Type]), Castable (HList tensorChunks) [ATenTensor], devices ~ HReplicateR chunks device, HasToDevices devices' devices tensorChunks gs, KnownNat chunks) => HasScatter (devices' :: [(DeviceType, Nat)]) (device :: (DeviceType, Nat)) (Tensor device dtype shape) (gs :: [Type]) Source # 
Instance details

Defined in Torch.Typed.Device

Methods

scatter :: Tensor device dtype shape -> HList gs Source #

KnownNat n => Castable (Vector n (Tensor device dtype shape)) (ForeignPtr TensorList) Source # 
Instance details

Defined in Torch.Typed.Tensor

Methods

cast :: Vector n (Tensor device dtype shape) -> (ForeignPtr TensorList -> IO r) -> IO r Source #

uncast :: ForeignPtr TensorList -> (Vector n (Tensor device dtype shape) -> IO r) -> IO r Source #

(chunks ~ ListLength fs, devices ~ GetDevices fs, devices' ~ HReplicateR chunks device', HasToDevices devices' devices fs tensorChunks, '(shape, dtype, device') ~ Cat 0 tensorChunks, Castable (HList tensorChunks) [ATenTensor]) => HasGather (device' :: (DeviceType, Nat)) (devices :: [(DeviceType, Nat)]) (fs :: [Type]) (Tensor device' dtype shape) Source # 
Instance details

Defined in Torch.Typed.Device

Methods

gather :: HList fs -> Tensor device' dtype shape Source #

KnownDevice device => Num (Tensor device dtype shape) Source # 
Instance details

Defined in Torch.Typed.Tensor

Methods

(+) :: Tensor device dtype shape -> Tensor device dtype shape -> Tensor device dtype shape Source #

(-) :: Tensor device dtype shape -> Tensor device dtype shape -> Tensor device dtype shape Source #

(*) :: Tensor device dtype shape -> Tensor device dtype shape -> Tensor device dtype shape Source #

negate :: Tensor device dtype shape -> Tensor device dtype shape Source #

abs :: Tensor device dtype shape -> Tensor device dtype shape Source #

signum :: Tensor device dtype shape -> Tensor device dtype shape Source #

fromInteger :: Integer -> Tensor device dtype shape Source #

KnownDevice device => Fractional (Tensor device dtype shape) Source # 
Instance details

Defined in Torch.Typed.Tensor

Methods

(/) :: Tensor device dtype shape -> Tensor device dtype shape -> Tensor device dtype shape Source #

recip :: Tensor device dtype shape -> Tensor device dtype shape Source #

fromRational :: Rational -> Tensor device dtype shape Source #

Show (Tensor device dtype shape) Source # 
Instance details

Defined in Torch.Typed.Tensor

Methods

showsPrec :: Int -> Tensor device dtype shape -> ShowS Source #

show :: Tensor device dtype shape -> String Source #

showList :: [Tensor device dtype shape] -> ShowS Source #

TensorOptions shape dtype device => Default (Tensor device dtype shape) Source # 
Instance details

Defined in Torch.Typed.Factories

Methods

def :: Tensor device dtype shape Source #

Parameterized (Tensor device dtype shape) Source # 
Instance details

Defined in Torch.Typed.Parameter

Associated Types

type Parameters (Tensor device dtype shape) :: [Type] Source #

Methods

flattenParameters :: Tensor device dtype shape -> HList (Parameters (Tensor device dtype shape)) Source #

replaceParameters :: Tensor device dtype shape -> HList (Parameters (Tensor device dtype shape)) -> Tensor device dtype shape Source #

Unnamed (Tensor device dtype shape) Source # 
Instance details

Defined in Torch.Typed.Tensor

Associated Types

type UTShape (Tensor device dtype shape) :: [Nat] Source #

type UTDevice (Tensor device dtype shape) :: (DeviceType, Nat) Source #

type UTDType (Tensor device dtype shape) :: DType Source #

Methods

toUnnamed :: forall (device0 :: (DeviceType, Nat)) (dtype0 :: DType) (shape0 :: [Nat]). IsUnnamed (Tensor device dtype shape) device0 dtype0 shape0 => Tensor device dtype shape -> Tensor device0 dtype0 shape0 Source #

fromUnnamed :: forall (device0 :: (DeviceType, Nat)) (dtype0 :: DType) (shape0 :: [Nat]). IsUnnamed (Tensor device dtype shape) device0 dtype0 shape0 => Tensor device0 dtype0 shape0 -> Tensor device dtype shape Source #

toDynamic :: Tensor device dtype shape -> Tensor0 Source #

Castable (Tensor device dtype shape) ATenTensor Source # 
Instance details

Defined in Torch.Typed.Tensor

Methods

cast :: Tensor device dtype shape -> (ATenTensor -> IO r) -> IO r Source #

uncast :: ATenTensor -> (Tensor device dtype shape -> IO r) -> IO r Source #

HasGrad (Parameter device dtype shape) (Tensor device dtype shape) Source # 
Instance details

Defined in Torch.Typed.Autograd

Methods

grad :: forall (dtype0 :: DType) (device0 :: (DeviceType, Nat)). Tensor device0 dtype0 '[] -> Parameter device dtype shape -> Tensor device dtype shape Source #

toDependent :: Parameter device dtype shape -> Tensor device dtype shape

(IsSuffixOf normalizedShape shape, KnownShape normalizedShape) => HasForward (LayerNorm normalizedShape dtype device) (Tensor device dtype shape) (Tensor device dtype shape) Source # 
Instance details

Defined in Torch.Typed.NN.Normalization

Methods

forward :: LayerNorm normalizedShape dtype device -> Tensor device dtype shape -> Tensor device dtype shape Source #

forwardStoch :: LayerNorm normalizedShape dtype device -> Tensor device dtype shape -> IO (Tensor device dtype shape) Source #

(1 <= numHeads, embedDim ~ (headDim * numHeads), All KnownNat '[embedDim, numHeads, seqLen, batchSize, headDim], IsSuffixOf '[embedDim] '[batchSize, seqLen, embedDim], KnownDType dtype, StandardFloatingPointDTypeValidation device dtype, MatMulDTypeIsValid device dtype, BasicArithmeticDTypeIsValid device dtype, dtype ~ SumDType dtype, SumDTypeIsValid device dtype, KnownDevice device) => Apply' (FoldLayers batchSize seqLen dtype device) (TransformerLayer embedDim embedDim embedDim numHeads ffnDim dtype device, IO (Tensor device dtype '[batchSize, seqLen, embedDim])) (IO (Tensor device dtype '[batchSize, seqLen, embedDim])) Source # 
Instance details

Defined in Torch.Typed.NN.Transformer

Methods

apply' :: FoldLayers batchSize seqLen dtype device -> (TransformerLayer embedDim embedDim embedDim numHeads ffnDim dtype device, IO (Tensor device dtype '[batchSize, seqLen, embedDim])) -> IO (Tensor device dtype '[batchSize, seqLen, embedDim]) Source #

(shape'' ~ MatMul shape '[inputFeatures, outputFeatures], shape' ~ Broadcast shape'' shape'') => HasForward (Linear inputFeatures outputFeatures dtype device) (Tensor device dtype shape) (Tensor device dtype shape') Source # 
Instance details

Defined in Torch.Typed.NN.Linear

Methods

forward :: Linear inputFeatures outputFeatures dtype device -> Tensor device dtype shape -> Tensor device dtype shape' Source #

forwardStoch :: Linear inputFeatures outputFeatures dtype device -> Tensor device dtype shape -> IO (Tensor device dtype shape') Source #

(All KnownNat '[stride, padding, inputChannelSize, outputChannelSize, kernelSize, inputSize, batchSize, outputSize], ConvSideCheck inputSize kernelSize stride padding outputSize) => HasForward (Conv1d inputChannelSize outputChannelSize kernelSize dtype device) (Tensor device dtype '[batchSize, inputChannelSize, inputSize], Proxy stride, Proxy padding) (Tensor device dtype '[batchSize, outputChannelSize, outputSize]) Source # 
Instance details

Defined in Torch.Typed.NN.Convolution

Methods

forward :: Conv1d inputChannelSize outputChannelSize kernelSize dtype device -> (Tensor device dtype '[batchSize, inputChannelSize, inputSize], Proxy stride, Proxy padding) -> Tensor device dtype '[batchSize, outputChannelSize, outputSize] Source #

forwardStoch :: Conv1d inputChannelSize outputChannelSize kernelSize dtype device -> (Tensor device dtype '[batchSize, inputChannelSize, inputSize], Proxy stride, Proxy padding) -> IO (Tensor device dtype '[batchSize, outputChannelSize, outputSize]) Source #

(All KnownNat '[stride, padding, inputChannelSize, outputChannelSize, kernelSize, inputSize, batchSize, outputSize], ConvSideCheck inputSize kernelSize stride padding outputSize) => HasForward (ConvTranspose1d inputChannelSize outputChannelSize kernelSize dtype device) (Tensor device dtype '[batchSize, inputChannelSize, inputSize], Proxy stride, Proxy padding) (Tensor device dtype '[batchSize, outputChannelSize, outputSize]) Source # 
Instance details

Defined in Torch.Typed.NN.Convolution

Methods

forward :: ConvTranspose1d inputChannelSize outputChannelSize kernelSize dtype device -> (Tensor device dtype '[batchSize, inputChannelSize, inputSize], Proxy stride, Proxy padding) -> Tensor device dtype '[batchSize, outputChannelSize, outputSize] Source #

forwardStoch :: ConvTranspose1d inputChannelSize outputChannelSize kernelSize dtype device -> (Tensor device dtype '[batchSize, inputChannelSize, inputSize], Proxy stride, Proxy padding) -> IO (Tensor device dtype '[batchSize, outputChannelSize, outputSize]) Source #

(All KnownNat '[Fst stride, Snd stride, Fst padding, Snd padding, inputChannelSize, outputChannelSize, kernelSize0, kernelSize1, inputSize0, inputSize1, batchSize, outputSize0, outputSize1], ConvSideCheck inputSize0 kernelSize0 (Fst stride) (Fst padding) outputSize0, ConvSideCheck inputSize1 kernelSize1 (Snd stride) (Snd padding) outputSize1) => HasForward (Conv2d inputChannelSize outputChannelSize kernelSize0 kernelSize1 dtype device) (Tensor device dtype '[batchSize, inputChannelSize, inputSize0, inputSize1], Proxy stride, Proxy padding) (Tensor device dtype '[batchSize, outputChannelSize, outputSize0, outputSize1]) Source # 
Instance details

Defined in Torch.Typed.NN.Convolution

Methods

forward :: Conv2d inputChannelSize outputChannelSize kernelSize0 kernelSize1 dtype device -> (Tensor device dtype '[batchSize, inputChannelSize, inputSize0, inputSize1], Proxy stride, Proxy padding) -> Tensor device dtype '[batchSize, outputChannelSize, outputSize0, outputSize1] Source #

forwardStoch :: Conv2d inputChannelSize outputChannelSize kernelSize0 kernelSize1 dtype device -> (Tensor device dtype '[batchSize, inputChannelSize, inputSize0, inputSize1], Proxy stride, Proxy padding) -> IO (Tensor device dtype '[batchSize, outputChannelSize, outputSize0, outputSize1]) Source #

(All KnownNat '[Fst stride, Snd stride, Fst padding, Snd padding, inputChannelSize, outputChannelSize, kernelSize0, kernelSize1, inputSize0, inputSize1, batchSize, outputSize0, outputSize1], ConvSideCheck inputSize0 kernelSize0 (Fst stride) (Fst padding) outputSize0, ConvSideCheck inputSize1 kernelSize1 (Snd stride) (Snd padding) outputSize1) => HasForward (ConvTranspose2d inputChannelSize outputChannelSize kernelSize0 kernelSize1 dtype device) (Tensor device dtype '[batchSize, inputChannelSize, inputSize0, inputSize1], Proxy stride, Proxy padding) (Tensor device dtype '[batchSize, outputChannelSize, outputSize0, outputSize1]) Source # 
Instance details

Defined in Torch.Typed.NN.Convolution

Methods

forward :: ConvTranspose2d inputChannelSize outputChannelSize kernelSize0 kernelSize1 dtype device -> (Tensor device dtype '[batchSize, inputChannelSize, inputSize0, inputSize1], Proxy stride, Proxy padding) -> Tensor device dtype '[batchSize, outputChannelSize, outputSize0, outputSize1] Source #

forwardStoch :: ConvTranspose2d inputChannelSize outputChannelSize kernelSize0 kernelSize1 dtype device -> (Tensor device dtype '[batchSize, inputChannelSize, inputSize0, inputSize1], Proxy stride, Proxy padding) -> IO (Tensor device dtype '[batchSize, outputChannelSize, outputSize0, outputSize1]) Source #

(KnownMaybeNat paddingIdx, PaddingIdxCheck paddingIdx numEmbeds, shape' ~ Reverse (embedSize ': Reverse shape)) => HasForward (Embedding paddingIdx numEmbeds embedSize embeddingType dtype device) (Tensor device 'Int64 shape) (Tensor device dtype shape') Source # 
Instance details

Defined in Torch.Typed.NN.Sparse

Methods

forward :: Embedding paddingIdx numEmbeds embedSize embeddingType dtype device -> Tensor device 'Int64 shape -> Tensor device dtype shape' Source #

forwardStoch :: Embedding paddingIdx numEmbeds embedSize embeddingType dtype device -> Tensor device 'Int64 shape -> IO (Tensor device dtype shape') Source #

(All KnownNat '[Fst3 stride, Snd3 stride, Trd3 stride, Fst3 padding, Snd3 padding, Trd3 padding, inputChannelSize, outputChannelSize, kernelSize0, kernelSize1, kernelSize2, inputSize0, inputSize1, inputSize2, batchSize], ConvSideCheck inputSize0 kernelSize0 (Fst3 stride) (Fst3 padding) outputSize0, ConvSideCheck inputSize1 kernelSize1 (Snd3 stride) (Snd3 padding) outputSize1, ConvSideCheck inputSize2 kernelSize2 (Trd3 stride) (Trd3 padding) outputSize2) => HasForward (Conv3d inputChannelSize outputChannelSize kernelSize0 kernelSize1 kernelSize2 dtype device) (Tensor device dtype '[batchSize, inputChannelSize, inputSize0, inputSize1, inputSize2], Proxy stride, Proxy padding) (Tensor device dtype '[batchSize, outputChannelSize, outputSize0, outputSize1, outputSize2]) Source # 
Instance details

Defined in Torch.Typed.NN.Convolution

Methods

forward :: Conv3d inputChannelSize outputChannelSize kernelSize0 kernelSize1 kernelSize2 dtype device -> (Tensor device dtype '[batchSize, inputChannelSize, inputSize0, inputSize1, inputSize2], Proxy stride, Proxy padding) -> Tensor device dtype '[batchSize, outputChannelSize, outputSize0, outputSize1, outputSize2] Source #

forwardStoch :: Conv3d inputChannelSize outputChannelSize kernelSize0 kernelSize1 kernelSize2 dtype device -> (Tensor device dtype '[batchSize, inputChannelSize, inputSize0, inputSize1, inputSize2], Proxy stride, Proxy padding) -> IO (Tensor device dtype '[batchSize, outputChannelSize, outputSize0, outputSize1, outputSize2]) Source #

(All KnownNat '[Fst3 stride, Snd3 stride, Trd3 stride, Fst3 padding, Snd3 padding, Trd3 padding, inputChannelSize, outputChannelSize, kernelSize0, kernelSize1, kernelSize2, inputSize0, inputSize1, inputSize2, batchSize], ConvSideCheck inputSize0 kernelSize0 (Fst3 stride) (Fst3 padding) outputSize0, ConvSideCheck inputSize1 kernelSize1 (Snd3 stride) (Snd3 padding) outputSize1, ConvSideCheck inputSize2 kernelSize2 (Trd3 stride) (Trd3 padding) outputSize2) => HasForward (ConvTranspose3d inputChannelSize outputChannelSize kernelSize0 kernelSize1 kernelSize2 dtype device) (Tensor device dtype '[batchSize, inputChannelSize, inputSize0, inputSize1, inputSize2], Proxy stride, Proxy padding) (Tensor device dtype '[batchSize, outputChannelSize, outputSize0, outputSize1, outputSize2]) Source # 
Instance details

Defined in Torch.Typed.NN.Convolution

Methods

forward :: ConvTranspose3d inputChannelSize outputChannelSize kernelSize0 kernelSize1 kernelSize2 dtype device -> (Tensor device dtype '[batchSize, inputChannelSize, inputSize0, inputSize1, inputSize2], Proxy stride, Proxy padding) -> Tensor device dtype '[batchSize, outputChannelSize, outputSize0, outputSize1, outputSize2] Source #

forwardStoch :: ConvTranspose3d inputChannelSize outputChannelSize kernelSize0 kernelSize1 kernelSize2 dtype device -> (Tensor device dtype '[batchSize, inputChannelSize, inputSize0, inputSize1, inputSize2], Proxy stride, Proxy padding) -> IO (Tensor device dtype '[batchSize, outputChannelSize, outputSize0, outputSize1, outputSize2]) Source #

(All KnownNat '[paddingIdx, embedDim, seqLen, batchSize], (paddingIdx + 1) <= numEmbeds, 1 <= seqLen, HFoldrM IO (FoldLayers batchSize seqLen dtype device) (Tensor device dtype '[batchSize, seqLen, embedDim]) (HReplicateR numAttnLayers (TransformerLayer embedDim embedDim embedDim numHeads ffnDim dtype device)) (Tensor device dtype '[batchSize, seqLen, embedDim]), BasicArithmeticDTypeIsValid device dtype, ComparisonDTypeIsValid device dtype, ComparisonDTypeIsValid device 'Int64, KnownDType dtype, KnownDevice device) => HasForward (TransformerLM numAttnLayers numHeads ffnDim paddingIdx numEmbeds embedDim dtype device) (Tensor device 'Int64 '[batchSize, seqLen]) (Tensor device dtype '[batchSize, seqLen, numEmbeds]) Source # 
Instance details

Defined in Torch.Typed.NN.Transformer

Methods

forward :: TransformerLM numAttnLayers numHeads ffnDim paddingIdx numEmbeds embedDim dtype device -> Tensor device 'Int64 '[batchSize, seqLen] -> Tensor device dtype '[batchSize, seqLen, numEmbeds] Source #

forwardStoch :: TransformerLM numAttnLayers numHeads ffnDim paddingIdx numEmbeds embedDim dtype device -> Tensor device 'Int64 '[batchSize, seqLen] -> IO (Tensor device dtype '[batchSize, seqLen, numEmbeds]) Source #

type Item (Maybe (Tensor device dtype shape)) Source # 
Instance details

Defined in Torch.Typed.Tensor

type Item (Maybe (Tensor device dtype shape)) = ComputeItemType (ComputeHaskellType dtype) shape
type Parameters (Tensor device dtype shape) Source # 
Instance details

Defined in Torch.Typed.Parameter

type Parameters (Tensor device dtype shape) = '[] :: [Type]
type UTDType (Tensor device dtype shape) Source # 
Instance details

Defined in Torch.Typed.Tensor

type UTDType (Tensor device dtype shape) = dtype
type UTDevice (Tensor device dtype shape) Source # 
Instance details

Defined in Torch.Typed.Tensor

type UTDevice (Tensor device dtype shape) = device
type UTShape (Tensor device dtype shape) Source # 
Instance details

Defined in Torch.Typed.Tensor

type UTShape (Tensor device dtype shape) = shape

type CPUTensor = Tensor '('CPU, 0) Source #

type CUDATensor deviceIndex = Tensor '('CUDA, deviceIndex) Source #

data UnknownShapeTensor device dtype Source #

Constructors

forall shape. UnknownShapeTensor (Tensor device dtype shape) 

type family ComputeItemType (ty :: Type) (shape :: [Nat]) :: Type where ... Source #

Equations

ComputeItemType _ '[] = TypeError (Text "Scalars are not supported") 
ComputeItemType ty (_ ': '[]) = ty 
ComputeItemType ty (_ ': (h ': t)) = [ComputeItemType ty (h ': t)] 

class TensorOptions (shape :: [Nat]) (dtype :: DType) (device :: (DeviceType, Nat)) where Source #

Instances

Instances details
(KnownDType dtype, KnownDevice device) => TensorOptions ('[] :: [Nat]) dtype device Source # 
Instance details

Defined in Torch.Typed.Tensor

(KnownNat h, TensorOptions t dtype device) => TensorOptions (h ': t) dtype device Source # 
Instance details

Defined in Torch.Typed.Tensor

type family All (pred :: a -> Constraint) (l :: [a]) :: Constraint where ... Source #

Equations

All _ '[] = () 
All pred (h ': t) = (pred h, All pred t) 

data SomeShape where Source #

Constructors

SomeShape :: forall (shape :: [Nat]). KnownShape shape => Proxy shape -> SomeShape 

data SomeDType where Source #

Constructors

SomeDType :: forall (dtype :: DType). KnownDType dtype => Proxy dtype -> SomeDType 

data SomeDevice where Source #

Constructors

SomeDevice :: forall (device :: (DeviceType, Nat)). KnownDevice device => Proxy device -> SomeDevice 

withTensor :: Tensor -> (forall shape dtype device. (KnownDevice device, KnownDType dtype, KnownShape shape) => Tensor device dtype shape -> r) -> r Source #

withTensorShape :: forall device dtype r. (KnownDevice device, KnownDType dtype) => Tensor -> (forall shape. KnownShape shape => Tensor device dtype shape -> r) -> r Source #

type family ComputeBroadcast (reversedShape :: [Nat]) (reversedShape' :: [Nat]) :: Maybe [Nat] where ... Source #

Equations

ComputeBroadcast '[] reversedShape = Just reversedShape 
ComputeBroadcast reversedShape '[] = Just reversedShape 
ComputeBroadcast (h ': t) (h ': t2) = AppendToMaybe h (ComputeBroadcast t t2) 
ComputeBroadcast (h ': t) (1 ': t2) = AppendToMaybe h (ComputeBroadcast t t2) 
ComputeBroadcast (1 ': t) (h ': t2) = AppendToMaybe h (ComputeBroadcast t t2) 
ComputeBroadcast _ _ = Nothing 

type family CheckBroadcast (shape :: [Nat]) (shape' :: [Nat]) (result :: Maybe [Nat]) :: [Nat] where ... Source #

Equations

CheckBroadcast shape shape' Nothing = TypeError ((((Text "The shapes " :<>: ShowType shape) :<>: Text " and ") :<>: ShowType shape') :<>: Text " cannot be broadcast") 
CheckBroadcast _ _ (Just result) = Reverse result 

type Broadcast shape shape' = CheckBroadcast shape shape' (ComputeBroadcast (Reverse shape) (Reverse shape')) Source #

type family BasicArithmeticDTypeIsValid (device :: (DeviceType, Nat)) (dtype :: DType) :: Constraint where ... Source #

Equations

BasicArithmeticDTypeIsValid '('CPU, 0) dtype = (DTypeIsNotBool '('CPU, 0) dtype, DTypeIsNotHalf '('CPU, 0) dtype) 
BasicArithmeticDTypeIsValid '('CUDA, _) dtype = () 
BasicArithmeticDTypeIsValid '(deviceType, _) dtype = UnsupportedDTypeForDevice deviceType dtype 

add :: forall shape'' shape shape' dtype dtype' dtype'' device. (dtype'' ~ DTypePromotion dtype dtype', shape'' ~ Broadcast shape shape', BasicArithmeticDTypeIsValid device dtype, BasicArithmeticDTypeIsValid device dtype', BasicArithmeticDTypeIsValid device dtype'') => Tensor device dtype shape -> Tensor device dtype' shape' -> Tensor device dtype'' shape'' Source #

sub :: forall shape'' shape shape' dtype dtype' dtype'' device. (dtype'' ~ DTypePromotion dtype dtype', shape'' ~ Broadcast shape shape', BasicArithmeticDTypeIsValid device dtype, BasicArithmeticDTypeIsValid device dtype', BasicArithmeticDTypeIsValid device dtype'') => Tensor device dtype shape -> Tensor device dtype' shape' -> Tensor device dtype'' shape'' Source #

mul :: forall shape'' shape shape' dtype dtype' dtype'' device. (dtype'' ~ DTypePromotion dtype dtype', shape'' ~ Broadcast shape shape', BasicArithmeticDTypeIsValid device dtype, BasicArithmeticDTypeIsValid device dtype', BasicArithmeticDTypeIsValid device dtype'') => Tensor device dtype shape -> Tensor device dtype' shape' -> Tensor device dtype'' shape'' Source #

div :: forall shape'' shape shape' dtype dtype' dtype'' device. (dtype'' ~ DTypePromotion dtype dtype', shape'' ~ Broadcast shape shape', BasicArithmeticDTypeIsValid device dtype, BasicArithmeticDTypeIsValid device dtype', BasicArithmeticDTypeIsValid device dtype'') => Tensor device dtype shape -> Tensor device dtype' shape' -> Tensor device dtype'' shape'' Source #

type family ComparisonDTypeIsValid (device :: (DeviceType, Nat)) (dtype :: DType) :: Constraint where ... Source #

Equations

ComparisonDTypeIsValid '('CPU, 0) dtype = (DTypeIsNotBool '('CPU, 0) dtype, DTypeIsNotHalf '('CPU, 0) dtype) 
ComparisonDTypeIsValid '('CUDA, _) dtype = () 
ComparisonDTypeIsValid '(deviceType, _) dtype = UnsupportedDTypeForDevice deviceType dtype 

gt :: forall shape'' shape shape' dtype dtype' device. (shape'' ~ Broadcast shape shape', ComparisonDTypeIsValid device dtype, ComparisonDTypeIsValid device dtype') => Tensor device dtype shape -> Tensor device dtype' shape' -> Tensor device 'Bool shape'' Source #

lt :: forall shape'' shape shape' dtype dtype' device. (shape'' ~ Broadcast shape shape', ComparisonDTypeIsValid device dtype, ComparisonDTypeIsValid device dtype') => Tensor device dtype shape -> Tensor device dtype' shape' -> Tensor device 'Bool shape'' Source #

ge :: forall shape'' shape shape' dtype dtype' device. (shape'' ~ Broadcast shape shape', ComparisonDTypeIsValid device dtype, ComparisonDTypeIsValid device dtype') => Tensor device dtype shape -> Tensor device dtype' shape' -> Tensor device 'Bool shape'' Source #

le :: forall shape'' shape shape' dtype dtype' device. (shape'' ~ Broadcast shape shape', ComparisonDTypeIsValid device dtype, ComparisonDTypeIsValid device dtype') => Tensor device dtype shape -> Tensor device dtype' shape' -> Tensor device 'Bool shape'' Source #

eq :: forall shape'' shape shape' dtype dtype' device. (shape'' ~ Broadcast shape shape', ComparisonDTypeIsValid device dtype, ComparisonDTypeIsValid device dtype') => Tensor device dtype shape -> Tensor device dtype' shape' -> Tensor device 'Bool shape'' Source #

ne :: forall shape'' shape shape' dtype dtype' device. (shape'' ~ Broadcast shape shape', ComparisonDTypeIsValid device dtype, ComparisonDTypeIsValid device dtype') => Tensor device dtype shape -> Tensor device dtype' shape' -> Tensor device 'Bool shape'' Source #

(>.) :: forall shape'' shape shape' dtype dtype' device. (shape'' ~ Broadcast shape shape', ComparisonDTypeIsValid device dtype, ComparisonDTypeIsValid device dtype') => Tensor device dtype shape -> Tensor device dtype' shape' -> Tensor device 'Bool shape'' Source #

(<.) :: forall shape'' shape shape' dtype dtype' device. (shape'' ~ Broadcast shape shape', ComparisonDTypeIsValid device dtype, ComparisonDTypeIsValid device dtype') => Tensor device dtype shape -> Tensor device dtype' shape' -> Tensor device 'Bool shape'' Source #

(>=.) :: forall shape'' shape shape' dtype dtype' device. (shape'' ~ Broadcast shape shape', ComparisonDTypeIsValid device dtype, ComparisonDTypeIsValid device dtype') => Tensor device dtype shape -> Tensor device dtype' shape' -> Tensor device 'Bool shape'' Source #

(<=.) :: forall shape'' shape shape' dtype dtype' device. (shape'' ~ Broadcast shape shape', ComparisonDTypeIsValid device dtype, ComparisonDTypeIsValid device dtype') => Tensor device dtype shape -> Tensor device dtype' shape' -> Tensor device 'Bool shape'' Source #

(==.) :: forall shape'' shape shape' dtype dtype' device. (shape'' ~ Broadcast shape shape', ComparisonDTypeIsValid device dtype, ComparisonDTypeIsValid device dtype') => Tensor device dtype shape -> Tensor device dtype' shape' -> Tensor device 'Bool shape'' Source #

(/=.) :: forall shape'' shape shape' dtype dtype' device. (shape'' ~ Broadcast shape shape', ComparisonDTypeIsValid device dtype, ComparisonDTypeIsValid device dtype') => Tensor device dtype shape -> Tensor device dtype' shape' -> Tensor device 'Bool shape'' Source #

type family ComputeMatMul (reversedShape :: [Nat]) (reversedShape' :: [Nat]) :: Maybe [Nat] where ... Source #

Equations

ComputeMatMul (k ': '[]) (k ': '[]) = Just '[] 
ComputeMatMul (k ': '[]) (m ': (k ': reversedBroadcastShape')) = AppendToMaybe m (ComputeBroadcast '[] reversedBroadcastShape') 
ComputeMatMul (k ': (n ': reversedBroadcastShape)) (k ': '[]) = AppendToMaybe n (ComputeBroadcast '[] reversedBroadcastShape) 
ComputeMatMul (k ': (n ': reversedBroadcastShape)) (m ': (k ': reversedBroadcastShape')) = AppendToMaybe m (AppendToMaybe n (ComputeBroadcast reversedBroadcastShape reversedBroadcastShape')) 

type family CheckMatMul (shape :: [Nat]) (shape' :: [Nat]) (result :: Maybe [Nat]) :: [Nat] where ... Source #

Equations

CheckMatMul shape shape' Nothing = TypeError ((((Text "The shapes " :<>: ShowType shape) :<>: Text " and ") :<>: ShowType shape') :<>: Text " are not compatible with matrix multiplication") 
CheckMatMul _ _ (Just result) = Reverse result 

type MatMul shape shape' = CheckMatMul shape shape' (ComputeMatMul (Reverse shape) (Reverse shape')) Source #

type family MatMulDTypeIsValid (device :: (DeviceType, Nat)) (dtype :: DType) :: Constraint where ... Source #

Equations

MatMulDTypeIsValid '('CPU, 0) dtype = (DTypeIsNotBool '('CPU, 0) dtype, DTypeIsNotHalf '('CPU, 0) dtype) 
MatMulDTypeIsValid '('CUDA, deviceIndex) dtype = DTypeIsFloatingPoint '('CUDA, deviceIndex) dtype 
MatMulDTypeIsValid '(deviceType, _) dtype = UnsupportedDTypeForDevice deviceType dtype 

matmul :: forall shape'' shape shape' dtype device. (shape'' ~ MatMul shape shape', MatMulDTypeIsValid device dtype) => Tensor device dtype shape -> Tensor device dtype shape' -> Tensor device dtype shape'' Source #

select :: forall dim idx shape' shape dtype device. (KnownNat dim, KnownNat idx, InRange shape dim idx, shape' ~ Remove shape dim) => Tensor device dtype shape -> Tensor device dtype shape' Source #

selectIdx :: forall dim n shape' shape dtype device. (KnownNat dim, n ~ Index shape dim, shape' ~ Remove shape dim) => Tensor device dtype shape -> Finite n -> Tensor device dtype shape' Source #

type family Numel (shape :: [Nat]) :: Nat where ... Source #

Equations

Numel '[] = 1 
Numel (h ': t) = h * Numel t 

reshape :: forall shape' shape dtype device. (KnownShape shape', Numel shape ~ Numel shape') => Tensor device dtype shape -> Tensor device dtype shape' Source #

reshape >>> t :: CPUTensor 'D.Int64 '[2,3,4] = fromJust [[[111,112,113,114],[121,122,123,124],[131,132,133,134]],[[211,212,213,214],[221,222,223,224],[231,232,233,234]]] >>> t' = reshape '[24] t >>> toList . Just $ t' [111,112,113,114,121,122,123,124,131,132,133,134,211,212,213,214,221,222,223,224,231,232,233,234] >>> toList . Just $ reshape '[2,3,4] t' [[[111,112,113,114],[121,122,123,124],[131,132,133,134]],[[211,212,213,214],[221,222,223,224],[231,232,233,234]]]

newtype Wrap a Source #

To avoid overlapped instance for (Unnamed t => Castable t D.ATenTensor)

Constructors

Wrap 

Fields

Instances

Instances details
Unnamed t => Castable (Wrap t) ATenTensor Source # 
Instance details

Defined in Torch.Typed.Tensor

Methods

cast :: Wrap t -> (ATenTensor -> IO r) -> IO r Source #

uncast :: ATenTensor -> (Wrap t -> IO r) -> IO r Source #

data TensorListFold Source #

Constructors

TensorListFold 

Instances

Instances details
Castable x ATenTensor => Apply' TensorListFold (x, IO [ATenTensor]) (IO [ATenTensor]) Source # 
Instance details

Defined in Torch.Typed.Tensor

data TensorListUnfold Source #

Constructors

TensorListUnfold 

Instances

Instances details
Castable x ATenTensor => Apply TensorListUnfold [ATenTensor] (IO (HJust (x, [ATenTensor]))) Source # 
Instance details

Defined in Torch.Typed.Tensor

Apply TensorListUnfold [ATenTensor] (IO HNothing) Source # 
Instance details

Defined in Torch.Typed.Tensor

toSparse :: Tensor device dtype shape -> Tensor device dtype shape Source #

toDense :: Tensor device dtype shape -> Tensor device dtype shape Source #

toCPU :: forall device shape dtype. Tensor device dtype shape -> CPUTensor dtype shape Source #

move tensor to CPU TODO: can this fail?

toCUDA :: forall device' device shape dtype. Tensor device dtype shape -> CUDATensor 0 dtype shape Source #

move tensor to the first CUDA device TODO: what if this fails?

toDevice :: forall device' device dtype shape t t'. (KnownDevice device', IsUnnamed t device dtype shape, Unnamed t', t' ~ ReplaceDevice'' t device') => t -> t' Source #

move tensor to device TODO: what if this fails?

toDType :: forall dtype' dtype device shape t t'. (KnownDType dtype', IsUnnamed t device dtype shape, Unnamed t', t' ~ ReplaceDType'' t dtype') => t -> t' Source #

change tensor data type

dim :: forall device dtype shape t. (TensorOptions shape dtype device, IsUnnamed t device dtype shape) => t -> Int Source #

returns tensor dimension uses compile-time information only

shape :: forall device dtype shape t. (TensorOptions shape dtype device, IsUnnamed t device dtype shape) => t -> [Int] Source #

returns tensor shape as list uses compile-time information only

dtype :: forall device dtype shape t. (TensorOptions shape dtype device, IsUnnamed t device dtype shape) => t -> DType Source #

returns tensor data type uses compile-time information only

device :: forall device dtype shape t. (TensorOptions shape dtype device, IsUnnamed t device dtype shape) => t -> Device Source #

returns tensor device uses compile-time information only

toInt :: Tensor device dtype shape -> Int Source #

toFloat :: forall device. Tensor device 'Float '[] -> Float Source #

toDouble :: forall device. Tensor device 'Double '[] -> Double Source #

toBool :: forall device. Tensor device 'Bool '[] -> Bool Source #

type family ToDType a :: DType where ... Source #

type family ToShape a :: Shape where ... Source #

Equations

ToShape Bool = '[] 
ToShape Int = '[] 
ToShape Float = '[] 
ToShape Double = '[] 
ToShape (f a) = f ': ToShape a 

type family FindDim (a :: Size) (shape :: Shape) :: Nat where ... Source #

Equations

FindDim a (a ': _) = 0 
FindDim a (b ': ax) = 1 + FindDim a ax 
FindDim a _ = TypeError ((Text "Not find a type:" :<>: ShowType a) :<>: Text " in the shape.") 

data NamedTensor (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: Shape) where Source #

Constructors

FromTensor :: forall device dtype shape' shape. shape ~ ToNats shape' => Tensor device dtype shape -> NamedTensor device dtype shape' 

Instances

Instances details
KnownDevice device => Num (NamedTensor device dtype shape) Source # 
Instance details

Defined in Torch.Typed.Tensor

Methods

(+) :: NamedTensor device dtype shape -> NamedTensor device dtype shape -> NamedTensor device dtype shape Source #

(-) :: NamedTensor device dtype shape -> NamedTensor device dtype shape -> NamedTensor device dtype shape Source #

(*) :: NamedTensor device dtype shape -> NamedTensor device dtype shape -> NamedTensor device dtype shape Source #

negate :: NamedTensor device dtype shape -> NamedTensor device dtype shape Source #

abs :: NamedTensor device dtype shape -> NamedTensor device dtype shape Source #

signum :: NamedTensor device dtype shape -> NamedTensor device dtype shape Source #

fromInteger :: Integer -> NamedTensor device dtype shape Source #

KnownDevice device => Fractional (NamedTensor device dtype shape) Source # 
Instance details

Defined in Torch.Typed.Tensor

Methods

(/) :: NamedTensor device dtype shape -> NamedTensor device dtype shape -> NamedTensor device dtype shape Source #

recip :: NamedTensor device dtype shape -> NamedTensor device dtype shape Source #

fromRational :: Rational -> NamedTensor device dtype shape Source #

Show (NamedTensor device dtype shape) Source # 
Instance details

Defined in Torch.Typed.Tensor

Methods

showsPrec :: Int -> NamedTensor device dtype shape -> ShowS Source #

show :: NamedTensor device dtype shape -> String Source #

showList :: [NamedTensor device dtype shape] -> ShowS Source #

(TensorOptions shape' dtype device, shape' ~ ToNats shape) => Default (NamedTensor device dtype shape) Source # 
Instance details

Defined in Torch.Typed.Factories

Methods

def :: NamedTensor device dtype shape Source #

Unnamed (NamedTensor device dtype shape) Source # 
Instance details

Defined in Torch.Typed.Tensor

Associated Types

type UTShape (NamedTensor device dtype shape) :: [Nat] Source #

type UTDevice (NamedTensor device dtype shape) :: (DeviceType, Nat) Source #

type UTDType (NamedTensor device dtype shape) :: DType Source #

Methods

toUnnamed :: forall (device0 :: (DeviceType, Nat)) (dtype0 :: DType) (shape0 :: [Nat]). IsUnnamed (NamedTensor device dtype shape) device0 dtype0 shape0 => NamedTensor device dtype shape -> Tensor device0 dtype0 shape0 Source #

fromUnnamed :: forall (device0 :: (DeviceType, Nat)) (dtype0 :: DType) (shape0 :: [Nat]). IsUnnamed (NamedTensor device dtype shape) device0 dtype0 shape0 => Tensor device0 dtype0 shape0 -> NamedTensor device dtype shape Source #

toDynamic :: NamedTensor device dtype shape -> Tensor Source #

Castable (NamedTensor device dtype shape) ATenTensor Source # 
Instance details

Defined in Torch.Typed.Tensor

Methods

cast :: NamedTensor device dtype shape -> (ATenTensor -> IO r) -> IO r Source #

uncast :: ATenTensor -> (NamedTensor device dtype shape -> IO r) -> IO r Source #

type UTDType (NamedTensor device dtype shape) Source # 
Instance details

Defined in Torch.Typed.Tensor

type UTDType (NamedTensor device dtype shape) = dtype
type UTDevice (NamedTensor device dtype shape) Source # 
Instance details

Defined in Torch.Typed.Tensor

type UTDevice (NamedTensor device dtype shape) = device
type UTShape (NamedTensor device dtype shape) Source # 
Instance details

Defined in Torch.Typed.Tensor

type UTShape (NamedTensor device dtype shape) = ToNats shape

type family ReplaceDevice'' (tensor :: t) (device :: (DeviceType, Nat)) :: t where ... Source #

Equations

ReplaceDevice'' (Tensor device0 dtype shape) device1 = Tensor device1 dtype shape 
ReplaceDevice'' (NamedTensor device0 dtype shape) device1 = NamedTensor device1 dtype shape 

type family ReplaceDType'' (tensor :: t) (dtype :: DType) :: t where ... Source #

Equations

ReplaceDType'' (Tensor device dtype0 shape) dtype1 = Tensor device dtype1 shape 
ReplaceDType'' (NamedTensor device dtype0 shape) dtype1 = NamedTensor device dtype1 shape 

Orphan instances

(HFoldrM IO TensorListFold [ATenTensor] l [ATenTensor], Apply TensorListUnfold [ATenTensor] res, HUnfoldM IO TensorListUnfold res l, res ~ HUnfoldMRes IO [ATenTensor] l) => Castable (HList l) [ATenTensor] Source # 
Instance details

Methods

cast :: HList l -> ([ATenTensor] -> IO r) -> IO r Source #

uncast :: [ATenTensor] -> (HList l -> IO r) -> IO r Source #

Castable (HList l) [ATenTensor] => Castable (HList l) (ForeignPtr TensorList) Source # 
Instance details

Methods

cast :: HList l -> (ForeignPtr TensorList -> IO r) -> IO r Source #

uncast :: ForeignPtr TensorList -> (HList l -> IO r) -> IO r Source #