Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- class KnownShape (shape :: [Nat]) where
- getFiniteI :: Finite n -> Int
- class KnownDType (dtype :: DType) where
- type family ComputeDType (dtype' :: dtype) :: DType where ...
- class KnownDevice (device :: (DeviceType, Nat)) where
- type Size = Type -> Type
- type Shape = [Type -> Type]
- type family ToNat (shape :: Size) :: Nat where ...
- type family ToNats (shape :: Shape) :: [Nat] where ...
- type family FromNat (shape :: Nat) :: Size where ...
- type family FromNats (shape :: [Nat]) :: Shape where ...
- class Unnamed t where
- type UTShape t :: [Nat]
- type UTDevice t :: (DeviceType, Nat)
- type UTDType t :: DType
- toUnnamed :: forall device dtype shape. IsUnnamed t device dtype shape => t -> Tensor device dtype shape
- fromUnnamed :: forall device dtype shape. IsUnnamed t device dtype shape => Tensor device dtype shape -> t
- toDynamic :: t -> Tensor
- type family IsUnnamed t (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]) :: Constraint where ...
- data Tensor (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]) where
- UnsafeMkTensor :: forall device dtype shape. Tensor -> Tensor device dtype shape
- type CPUTensor = Tensor '('CPU, 0)
- type CUDATensor deviceIndex = Tensor '('CUDA, deviceIndex)
- data UnknownShapeTensor device dtype = forall shape. UnknownShapeTensor (Tensor device dtype shape)
- type family ComputeHaskellType (dtype :: DType) :: Type where ...
- type family ComputeItemType (ty :: Type) (shape :: [Nat]) :: Type where ...
- class TensorOptions (shape :: [Nat]) (dtype :: DType) (device :: (DeviceType, Nat)) where
- type family All (pred :: a -> Constraint) (l :: [a]) :: Constraint where ...
- data SomeShape where
- SomeShape :: forall (shape :: [Nat]). KnownShape shape => Proxy shape -> SomeShape
- someShape :: [Int] -> SomeShape
- data SomeDType where
- SomeDType :: forall (dtype :: DType). KnownDType dtype => Proxy dtype -> SomeDType
- someDType :: DType -> SomeDType
- data SomeDevice where
- SomeDevice :: forall (device :: (DeviceType, Nat)). KnownDevice device => Proxy device -> SomeDevice
- someDevice :: Device -> SomeDevice
- withTensor :: Tensor -> (forall shape dtype device. (KnownDevice device, KnownDType dtype, KnownShape shape) => Tensor device dtype shape -> r) -> r
- withTensorShape :: forall device dtype r. (KnownDevice device, KnownDType dtype) => Tensor -> (forall shape. KnownShape shape => Tensor device dtype shape -> r) -> r
- type family ComputeBroadcast (reversedShape :: [Nat]) (reversedShape' :: [Nat]) :: Maybe [Nat] where ...
- type family CheckBroadcast (shape :: [Nat]) (shape' :: [Nat]) (result :: Maybe [Nat]) :: [Nat] where ...
- type Broadcast shape shape' = CheckBroadcast shape shape' (ComputeBroadcast (Reverse shape) (Reverse shape'))
- type family BasicArithmeticDTypeIsValid (device :: (DeviceType, Nat)) (dtype :: DType) :: Constraint where ...
- 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''
- 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''
- 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''
- 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''
- type family ComparisonDTypeIsValid (device :: (DeviceType, Nat)) (dtype :: DType) :: Constraint where ...
- 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''
- 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''
- 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''
- 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''
- 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''
- 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''
- (>.) :: 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''
- (<.) :: 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''
- (>=.) :: 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''
- (<=.) :: 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''
- (==.) :: 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''
- (/=.) :: 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''
- type family ComputeMatMul (reversedShape :: [Nat]) (reversedShape' :: [Nat]) :: Maybe [Nat] where ...
- type family CheckMatMul (shape :: [Nat]) (shape' :: [Nat]) (result :: Maybe [Nat]) :: [Nat] where ...
- type MatMul shape shape' = CheckMatMul shape shape' (ComputeMatMul (Reverse shape) (Reverse shape'))
- type family MatMulDTypeIsValid (device :: (DeviceType, Nat)) (dtype :: DType) :: Constraint where ...
- 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''
- 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'
- 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'
- type family Numel (shape :: [Nat]) :: Nat where ...
- reshape :: forall shape' shape dtype device. (KnownShape shape', Numel shape ~ Numel shape') => Tensor device dtype shape -> Tensor device dtype shape'
- newtype Wrap a = Wrap {
- unWrap :: a
- data TensorListFold = TensorListFold
- data TensorListUnfold = TensorListUnfold
- toSparse :: Tensor device dtype shape -> Tensor device dtype shape
- toDense :: Tensor device dtype shape -> Tensor device dtype shape
- toCPU :: forall device shape dtype. Tensor device dtype shape -> CPUTensor dtype shape
- toCUDA :: forall device' device shape dtype. Tensor device dtype shape -> CUDATensor 0 dtype shape
- toDevice :: forall device' device dtype shape t t'. (KnownDevice device', IsUnnamed t device dtype shape, Unnamed t', t' ~ ReplaceDevice'' t device') => t -> t'
- toDType :: forall dtype' dtype device shape t t'. (KnownDType dtype', IsUnnamed t device dtype shape, Unnamed t', t' ~ ReplaceDType'' t dtype') => t -> t'
- dim :: forall device dtype shape t. (TensorOptions shape dtype device, IsUnnamed t device dtype shape) => t -> Int
- shape :: forall device dtype shape t. (TensorOptions shape dtype device, IsUnnamed t device dtype shape) => t -> [Int]
- dtype :: forall device dtype shape t. (TensorOptions shape dtype device, IsUnnamed t device dtype shape) => t -> DType
- device :: forall device dtype shape t. (TensorOptions shape dtype device, IsUnnamed t device dtype shape) => t -> Device
- toInt :: Tensor device dtype shape -> Int
- toFloat :: forall device. Tensor device 'Float '[] -> Float
- toDouble :: forall device. Tensor device 'Double '[] -> Double
- toBool :: forall device. Tensor device 'Bool '[] -> Bool
- type family ToDType a :: DType where ...
- type family ToShape a :: Shape where ...
- type family FindDim (a :: Size) (shape :: Shape) :: Nat where ...
- data NamedTensor (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: Shape) where
- FromTensor :: forall device dtype shape' shape. shape ~ ToNats shape' => Tensor device dtype shape -> NamedTensor device dtype shape'
- type family ReplaceDevice'' (tensor :: t) (device :: (DeviceType, Nat)) :: t where ...
- type family ReplaceDType'' (tensor :: t) (dtype :: DType) :: t where ...
Documentation
class KnownShape (shape :: [Nat]) where Source #
Instances
KnownShape ('[] :: [Nat]) Source # | |
Defined in Torch.Typed.Tensor | |
(KnownNat h, KnownShape t) => KnownShape (h ': t) Source # | |
Defined in Torch.Typed.Tensor |
getFiniteI :: Finite n -> Int Source #
class KnownDType (dtype :: DType) where Source #
Instances
KnownDType 'Bool Source # | |
Defined in Torch.Typed.Tensor | |
KnownDType 'Double Source # | |
Defined in Torch.Typed.Tensor | |
KnownDType 'Float Source # | |
Defined in Torch.Typed.Tensor | |
KnownDType 'Half Source # | |
Defined in Torch.Typed.Tensor | |
KnownDType 'Int16 Source # | |
Defined in Torch.Typed.Tensor | |
KnownDType 'Int32 Source # | |
Defined in Torch.Typed.Tensor | |
KnownDType 'Int64 Source # | |
Defined in Torch.Typed.Tensor | |
KnownDType 'Int8 Source # | |
Defined in Torch.Typed.Tensor | |
KnownDType 'UInt8 Source # | |
Defined in Torch.Typed.Tensor |
type family ComputeDType (dtype' :: dtype) :: DType where ... Source #
ComputeDType Bool = Bool | |
ComputeDType Bool = Bool | |
ComputeDType UInt8 = UInt8 | |
ComputeDType Int8 = Int8 | |
ComputeDType Int16 = Int16 | |
ComputeDType Int32 = Int32 | |
ComputeDType Int = Int64 | |
ComputeDType Int64 = Int64 | |
ComputeDType Float = Float | |
ComputeDType Float = Float | |
ComputeDType Double = Double | |
ComputeDType Double = Double | |
ComputeDType dtype' = TypeError (Text "Unsupported tensor type " :<>: ShowType dtype') |
class KnownDevice (device :: (DeviceType, Nat)) where Source #
Instances
KnownNat n => KnownDevice '('CPU, n) Source # | |
Defined in Torch.Typed.Tensor | |
KnownNat n => KnownDevice '('CUDA, n) Source # | |
Defined in Torch.Typed.Tensor |
type family ToNat (shape :: Size) :: Nat where ... Source #
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 ())) |
class Unnamed t where Source #
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 #
Instances
Unnamed (NamedTensor device dtype shape) Source # | |
Defined in Torch.Typed.Tensor 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 # 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 # | |
Defined in Torch.Typed.Tensor type UTShape (Tensor device dtype shape) :: [Nat] Source # type UTDevice (Tensor device dtype shape) :: (DeviceType, Nat) Source # 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 # |
type family IsUnnamed t (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]) :: Constraint where ... Source #
data Tensor (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]) where Source #
UnsafeMkTensor :: forall device dtype shape. Tensor -> Tensor device dtype shape |
Instances
KnownDType dtype' => HasToDType (dtype' :: DType) (dtype :: DType) (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 # | |
KnownDevice device' => HasToDevice device' device (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 # | |
Defined in Torch.Typed.NN.DataParallel apply' :: GradConcurrentlyF -> (HList parameters, Loss device dtype) -> Concurrently (HList gradients) Source # | |
Apply' MakeIndependent (Tensor device dtype shape) (IO (Parameter device dtype shape)) Source # | |
Defined in Torch.Typed.Parameter | |
Apply' ToParameter (Tensor dev dtype shape) (Parameter dev dtype shape) Source # | |
Defined in Torch.Typed.Optim.CppOptim | |
Apply' ToDependent (Parameter device dtype shape) (Tensor device dtype shape) Source # | |
Defined in Torch.Typed.Parameter | |
HasForward Dropout (Tensor device dtype shape) (Tensor device dtype shape) Source # | |
(TensorLike [ComputeItemType (ComputeHaskellType dtype) shape], KnownDevice device, KnownShape shape) => IsList (Maybe (Tensor device dtype shape)) Source # | |
Defined in Torch.Typed.Tensor 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 # | |
Defined in Torch.Typed.Tensor 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 # | |
KnownNat n => Castable (Vector n (Tensor device dtype shape)) (ForeignPtr TensorList) Source # | |
Defined in Torch.Typed.Tensor 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 # | |
KnownDevice device => Num (Tensor device dtype shape) Source # | |
Defined in Torch.Typed.Tensor (+) :: 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 # | |
Show (Tensor device dtype shape) Source # | |
TensorOptions shape dtype device => Default (Tensor device dtype shape) Source # | |
Defined in Torch.Typed.Factories | |
Parameterized (Tensor device dtype shape) Source # | |
Defined in Torch.Typed.Parameter type Parameters (Tensor device dtype shape) :: [Type] Source # 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 # | |
Defined in Torch.Typed.Tensor type UTShape (Tensor device dtype shape) :: [Nat] Source # type UTDevice (Tensor device dtype shape) :: (DeviceType, Nat) Source # 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 # | |
Castable (Tensor device dtype shape) ATenTensor Source # | |
Defined in Torch.Typed.Tensor | |
HasGrad (Parameter device dtype shape) (Tensor device dtype shape) Source # | |
Defined in Torch.Typed.Autograd | |
(IsSuffixOf normalizedShape shape, KnownShape normalizedShape) => HasForward (LayerNorm normalizedShape dtype device) (Tensor device dtype shape) (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 # | |
Defined in Torch.Typed.NN.Transformer 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 # | |
(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 # | |
Defined in Torch.Typed.NN.Convolution 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 # | |
Defined in Torch.Typed.NN.Convolution 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 # | |
Defined in Torch.Typed.NN.Convolution 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 # | |
Defined in Torch.Typed.NN.Convolution 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 # | |
Defined in Torch.Typed.NN.Sparse 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 # | |
Defined in Torch.Typed.NN.Convolution 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 # | |
Defined in Torch.Typed.NN.Convolution 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 # | |
Defined in Torch.Typed.NN.Transformer 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 # | |
Defined in Torch.Typed.Tensor | |
type Parameters (Tensor device dtype shape) Source # | |
Defined in Torch.Typed.Parameter | |
type UTDType (Tensor device dtype shape) Source # | |
Defined in Torch.Typed.Tensor | |
type UTDevice (Tensor device dtype shape) Source # | |
Defined in Torch.Typed.Tensor | |
type UTShape (Tensor device dtype shape) Source # | |
Defined in Torch.Typed.Tensor |
type CUDATensor deviceIndex = Tensor '('CUDA, deviceIndex) Source #
data UnknownShapeTensor device dtype Source #
forall shape. UnknownShapeTensor (Tensor device dtype shape) |
type family ComputeHaskellType (dtype :: DType) :: Type where ... Source #
ComputeHaskellType Bool = Bool | |
ComputeHaskellType Int64 = Int | |
ComputeHaskellType Float = Float | |
ComputeHaskellType Double = Double | |
ComputeHaskellType dtype = TypeError (Text "Unsupported tensor type " :<>: ShowType dtype) |
type family ComputeItemType (ty :: Type) (shape :: [Nat]) :: Type where ... Source #
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
(KnownDType dtype, KnownDevice device) => TensorOptions ('[] :: [Nat]) dtype device Source # | |
Defined in Torch.Typed.Tensor | |
(KnownNat h, TensorOptions t dtype device) => TensorOptions (h ': t) dtype device Source # | |
Defined in Torch.Typed.Tensor |
type family All (pred :: a -> Constraint) (l :: [a]) :: Constraint where ... Source #
SomeShape :: forall (shape :: [Nat]). KnownShape shape => Proxy shape -> SomeShape |
SomeDType :: forall (dtype :: DType). KnownDType dtype => Proxy dtype -> SomeDType |
data SomeDevice where Source #
SomeDevice :: forall (device :: (DeviceType, Nat)). KnownDevice device => Proxy device -> SomeDevice |
someDevice :: Device -> SomeDevice Source #
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 #
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 #
type Broadcast shape shape' = CheckBroadcast shape shape' (ComputeBroadcast (Reverse shape) (Reverse shape')) Source #
type family BasicArithmeticDTypeIsValid (device :: (DeviceType, Nat)) (dtype :: DType) :: Constraint where ... Source #
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 #
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 #
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 #
type MatMul shape shape' = CheckMatMul shape shape' (ComputeMatMul (Reverse shape) (Reverse shape')) Source #
type family MatMulDTypeIsValid (device :: (DeviceType, Nat)) (dtype :: DType) :: Constraint where ... Source #
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 #
matrix multiplication See https://pytorch.org/docs/stable/torch.html#torch.matmul.
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 #
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]]]
To avoid overlapped instance for (Unnamed t => Castable t D.ATenTensor)
data TensorListFold Source #
Instances
Castable x ATenTensor => Apply' TensorListFold (x, IO [ATenTensor]) (IO [ATenTensor]) Source # | |
Defined in Torch.Typed.Tensor apply' :: TensorListFold -> (x, IO [ATenTensor]) -> IO [ATenTensor] Source # |
data TensorListUnfold Source #
Instances
Castable x ATenTensor => Apply TensorListUnfold [ATenTensor] (IO (HJust (x, [ATenTensor]))) Source # | |
Defined in Torch.Typed.Tensor apply :: TensorListUnfold -> [ATenTensor] -> IO (HJust (x, [ATenTensor])) Source # | |
Apply TensorListUnfold [ATenTensor] (IO HNothing) Source # | |
Defined in Torch.Typed.Tensor apply :: TensorListUnfold -> [ATenTensor] -> IO HNothing 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
data NamedTensor (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: Shape) where Source #
FromTensor :: forall device dtype shape' shape. shape ~ ToNats shape' => Tensor device dtype shape -> NamedTensor device dtype shape' |
Instances
KnownDevice device => Num (NamedTensor device dtype shape) Source # | |
Defined in Torch.Typed.Tensor (+) :: 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 # | |
Defined in Torch.Typed.Tensor (/) :: 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 # | |
Defined in Torch.Typed.Tensor | |
(TensorOptions shape' dtype device, shape' ~ ToNats shape) => Default (NamedTensor device dtype shape) Source # | |
Defined in Torch.Typed.Factories def :: NamedTensor device dtype shape Source # | |
Unnamed (NamedTensor device dtype shape) Source # | |
Defined in Torch.Typed.Tensor 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 # 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 # | |
Defined in Torch.Typed.Tensor 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 # | |
Defined in Torch.Typed.Tensor | |
type UTDevice (NamedTensor device dtype shape) Source # | |
Defined in Torch.Typed.Tensor | |
type UTShape (NamedTensor device dtype shape) Source # | |
Defined in Torch.Typed.Tensor |
type family ReplaceDevice'' (tensor :: t) (device :: (DeviceType, Nat)) :: t where ... Source #
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 #
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 # | |
Castable (HList l) [ATenTensor] => Castable (HList l) (ForeignPtr TensorList) Source # | |
cast :: HList l -> (ForeignPtr TensorList -> IO r) -> IO r Source # uncast :: ForeignPtr TensorList -> (HList l -> IO r) -> IO r Source # |