Safe Haskell | None |
---|---|
Language | Haskell2010 |
Torch.Typed.Tensor
Contents
Synopsis
- class KnownShape (shape :: [Nat]) where
- getFiniteI :: forall (n :: Nat). 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 :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]). IsUnnamed t device dtype shape => t -> Tensor device dtype shape
- fromUnnamed :: forall (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]). IsUnnamed t device dtype shape => Tensor device dtype shape -> t
- toDynamic :: t -> Tensor
- type family IsUnnamed t (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]) where ...
- data Tensor (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]) where
- UnsafeMkTensor :: forall (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]). Tensor -> Tensor device dtype shape
- type CPUTensor = Tensor '('CPU, 0)
- type CUDATensor (deviceIndex :: Nat) = Tensor '('CUDA, deviceIndex)
- type MPSTensor (deviceIndex :: k) = Tensor '('MPS, 0)
- data UnknownShapeTensor (device :: (DeviceType, Nat)) (dtype :: DType) = UnknownShapeTensor (Tensor device dtype shape)
- type family ComputeHaskellType (dtype :: DType) where ...
- type family ComputeItemType ty (shape :: [Nat]) where ...
- class TensorOptions (shape :: [Nat]) (dtype :: DType) (device :: (DeviceType, Nat)) where
- type family All (pred :: a -> Constraint) (l :: [a]) 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 :: [Nat]) (dtype :: DType) (device :: (DeviceType, Nat)). (KnownDevice device, KnownDType dtype, KnownShape shape) => Tensor device dtype shape -> r) -> r
- withTensorShape :: forall (device :: (DeviceType, Nat)) (dtype :: DType) r. (KnownDevice device, KnownDType dtype) => Tensor -> (forall (shape :: [Nat]). 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 :: [Nat]) (shape' :: [Nat]) = CheckBroadcast shape shape' (ComputeBroadcast (Reverse shape) (Reverse shape'))
- type family BasicArithmeticDTypeIsValid (device :: (DeviceType, Nat)) (dtype :: DType) where ...
- add :: forall (shape'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (dtype'' :: DType) (device :: (DeviceType, Nat)). (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'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (dtype'' :: DType) (device :: (DeviceType, Nat)). (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'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (dtype'' :: DType) (device :: (DeviceType, Nat)). (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'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (dtype'' :: DType) (device :: (DeviceType, Nat)). (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) where ...
- gt :: forall (shape'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (device :: (DeviceType, Nat)). (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'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (device :: (DeviceType, Nat)). (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'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (device :: (DeviceType, Nat)). (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'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (device :: (DeviceType, Nat)). (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'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (device :: (DeviceType, Nat)). (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'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (device :: (DeviceType, Nat)). (shape'' ~ Broadcast shape shape', ComparisonDTypeIsValid device dtype, ComparisonDTypeIsValid device dtype') => Tensor device dtype shape -> Tensor device dtype' shape' -> Tensor device 'Bool shape''
- (>.) :: forall (shape'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (device :: (DeviceType, Nat)). (shape'' ~ Broadcast shape shape', ComparisonDTypeIsValid device dtype, ComparisonDTypeIsValid device dtype') => Tensor device dtype shape -> Tensor device dtype' shape' -> Tensor device 'Bool shape''
- (<.) :: forall (shape'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (device :: (DeviceType, Nat)). (shape'' ~ Broadcast shape shape', ComparisonDTypeIsValid device dtype, ComparisonDTypeIsValid device dtype') => Tensor device dtype shape -> Tensor device dtype' shape' -> Tensor device 'Bool shape''
- (>=.) :: forall (shape'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (device :: (DeviceType, Nat)). (shape'' ~ Broadcast shape shape', ComparisonDTypeIsValid device dtype, ComparisonDTypeIsValid device dtype') => Tensor device dtype shape -> Tensor device dtype' shape' -> Tensor device 'Bool shape''
- (<=.) :: forall (shape'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (device :: (DeviceType, Nat)). (shape'' ~ Broadcast shape shape', ComparisonDTypeIsValid device dtype, ComparisonDTypeIsValid device dtype') => Tensor device dtype shape -> Tensor device dtype' shape' -> Tensor device 'Bool shape''
- (==.) :: forall (shape'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (device :: (DeviceType, Nat)). (shape'' ~ Broadcast shape shape', ComparisonDTypeIsValid device dtype, ComparisonDTypeIsValid device dtype') => Tensor device dtype shape -> Tensor device dtype' shape' -> Tensor device 'Bool shape''
- (/=.) :: forall (shape'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (device :: (DeviceType, Nat)). (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 :: [Nat]) (shape' :: [Nat]) = CheckMatMul shape shape' (ComputeMatMul (Reverse shape) (Reverse shape'))
- type family MatMulDTypeIsValid (device :: (DeviceType, Nat)) (dtype :: DType) where ...
- matmul :: forall (shape'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (device :: (DeviceType, Nat)). (shape'' ~ MatMul shape shape', MatMulDTypeIsValid device dtype) => Tensor device dtype shape -> Tensor device dtype shape' -> Tensor device dtype shape''
- select :: forall (dim :: Nat) (idx :: Nat) (shape' :: [Nat]) (shape :: [Nat]) (dtype :: DType) (device :: (DeviceType, Nat)). (KnownNat dim, KnownNat idx, InRange shape dim idx, shape' ~ Remove shape dim) => Tensor device dtype shape -> Tensor device dtype shape'
- selectIdx :: forall (dim :: Nat) (n :: Nat) (shape' :: [Nat]) (shape :: [Nat]) (dtype :: DType) (device :: (DeviceType, Nat)). (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' :: [Nat]) (shape :: [Nat]) (dtype :: DType) (device :: (DeviceType, Nat)). (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 :: forall (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]). Tensor device dtype shape -> Tensor device dtype shape
- toDense :: forall (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]). Tensor device dtype shape -> Tensor device dtype shape
- toCPU :: forall (device :: (DeviceType, Nat)) (shape :: [Nat]) (dtype :: DType). Tensor device dtype shape -> CPUTensor dtype shape
- toCUDA :: forall {k} (device' :: k) (device :: (DeviceType, Nat)) (shape :: [Nat]) (dtype :: DType). Tensor device dtype shape -> CUDATensor 0 dtype shape
- toMPS :: forall {k} (device' :: k) (device :: (DeviceType, Nat)) (shape :: [Nat]) (dtype :: DType). Tensor device dtype shape -> MPSTensor 0 dtype shape
- toDevice :: forall (device' :: (DeviceType, Nat)) (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]) t t'. (KnownDevice device', IsUnnamed t device dtype shape, Unnamed t', t' ~ ReplaceDevice'' t device') => t -> t'
- toDType :: forall (dtype' :: DType) (dtype :: DType) (device :: (DeviceType, Nat)) (shape :: [Nat]) t t'. (KnownDType dtype', IsUnnamed t device dtype shape, Unnamed t', t' ~ ReplaceDType'' t dtype') => t -> t'
- dim :: forall (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]) t. (TensorOptions shape dtype device, IsUnnamed t device dtype shape) => t -> Int
- shape :: forall (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]) t. (TensorOptions shape dtype device, IsUnnamed t device dtype shape) => t -> [Int]
- dtype :: forall (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]) t. (TensorOptions shape dtype device, IsUnnamed t device dtype shape) => t -> DType
- device :: forall (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]) t. (TensorOptions shape dtype device, IsUnnamed t device dtype shape) => t -> Device
- toInt :: forall (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]). Tensor device dtype shape -> Int
- toFloat :: forall (device :: (DeviceType, Nat)). Tensor device 'Float ('[] :: [Nat]) -> Float
- toDouble :: forall (device :: (DeviceType, Nat)). Tensor device 'Double ('[] :: [Nat]) -> Double
- toBool :: forall (device :: (DeviceType, Nat)). Tensor device 'Bool ('[] :: [Nat]) -> 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 :: (DeviceType, Nat)) (dtype :: DType) (shape :: Shape) (shape1 :: [Nat]). shape1 ~ ToNats shape => Tensor device dtype shape1 -> 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 |
class KnownDType (dtype :: DType) where Source #
Instances
KnownDType 'Bool Source # | |
Defined in Torch.Typed.Tensor | |
KnownDType 'ComplexDouble Source # | |
Defined in Torch.Typed.Tensor | |
KnownDType 'ComplexFloat Source # | |
Defined in Torch.Typed.Tensor | |
KnownDType 'ComplexHalf 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 #
Equations
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 Half = 'Half | |
ComputeDType 'Half = 'Half | |
ComputeDType Float = 'Float | |
ComputeDType 'Float = 'Float | |
ComputeDType Double = 'Double | |
ComputeDType 'Double = 'Double | |
ComputeDType (Complex Half) = 'ComplexHalf | |
ComputeDType 'ComplexHalf = 'ComplexHalf | |
ComputeDType (Complex Float) = 'ComplexFloat | |
ComputeDType 'ComplexFloat = 'ComplexFloat | |
ComputeDType (Complex Double) = 'ComplexDouble | |
ComputeDType 'ComplexDouble = 'ComplexDouble | |
ComputeDType (dtype' :: t) = TypeError ('Text "Unsupported tensor type " ':<>: 'ShowType dtype') :: 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 | |
KnownNat n => KnownDevice '('MPS, n) Source # | |
Defined in Torch.Typed.Tensor |
type family ToNat (shape :: Size) :: Nat where ... Source #
Equations
ToNat (S1 ('MetaSel _1 _2 _3 _4) f) = ToNat f | |
ToNat (D1 _1 f) = ToNat f | |
ToNat (C1 _1 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 _1) :: Type -> Type) = n | |
ToNat (K1 _1 _2 :: Type -> Type) = 1 | |
ToNat (U1 :: Type -> Type) = 1 | |
ToNat (Vector n) = n | |
ToNat a = ToNat (Rep (a ())) |
class Unnamed t where Source #
Methods
toUnnamed :: forall (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]). IsUnnamed t device dtype shape => t -> Tensor device dtype shape Source #
fromUnnamed :: forall (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]). IsUnnamed t device dtype shape => Tensor device dtype shape -> t Source #
Instances
Unnamed (NamedTensor device dtype shape) Source # | |||||||||||||
Defined in Torch.Typed.Tensor Associated Types
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 # | |||||||||||||
Defined in Torch.Typed.Tensor Associated Types
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 # |
type family IsUnnamed t (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]) where ... Source #
data Tensor (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]) where Source #
Constructors
UnsafeMkTensor :: forall (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]). 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 Methods 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 Associated Types
| |||||||||||||
Castable [Tensor device dtype shape] (ForeignPtr TensorList) Source # | |||||||||||||
Defined in Torch.Typed.Tensor Methods cast :: [Tensor device dtype shape] -> (ForeignPtr TensorList -> IO r) -> IO r # uncast :: ForeignPtr TensorList -> ([Tensor device dtype shape] -> IO r) -> IO r # | |||||||||||||
(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 Methods cast :: Vector n (Tensor device dtype shape) -> (ForeignPtr TensorList -> IO r) -> IO r # uncast :: ForeignPtr TensorList -> (Vector n (Tensor device dtype shape) -> IO r) -> IO r # | |||||||||||||
(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 Methods (+) :: Tensor device dtype shape -> Tensor device dtype shape -> Tensor device dtype shape # (-) :: Tensor device dtype shape -> Tensor device dtype shape -> Tensor device dtype shape # (*) :: Tensor device dtype shape -> Tensor device dtype shape -> Tensor device dtype shape # negate :: Tensor device dtype shape -> Tensor device dtype shape # abs :: Tensor device dtype shape -> Tensor device dtype shape # signum :: Tensor device dtype shape -> Tensor device dtype shape # fromInteger :: Integer -> Tensor device dtype shape # | |||||||||||||
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 Associated Types
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 # | |||||||||||||
Defined in Torch.Typed.Tensor Associated Types
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 # | |||||||||||||
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 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 # | |||||||||||||
Defined in Torch.Typed.NN.Linear | |||||||||||||
(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 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 # | |||||||||||||
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 # | |||||||||||||
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 # | |||||||||||||
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 # | |||||||||||||
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 # | |||||||||||||
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 # | |||||||||||||
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 # | |||||||||||||
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 # | |||||||||||||
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 |
data UnknownShapeTensor (device :: (DeviceType, Nat)) (dtype :: DType) Source #
Constructors
UnknownShapeTensor (Tensor device dtype shape) |
type family ComputeHaskellType (dtype :: DType) where ... Source #
Equations
ComputeHaskellType 'Bool = Bool | |
ComputeHaskellType 'Int64 = Int | |
ComputeHaskellType 'Float = Float | |
ComputeHaskellType 'Double = Double | |
ComputeHaskellType dtype = TypeError ('Text "Unsupported tensor type " ':<>: 'ShowType dtype) :: Type |
type family ComputeItemType ty (shape :: [Nat]) where ... Source #
Equations
ComputeItemType _1 ('[] :: [Nat]) = TypeError ('Text "Scalars are not supported") :: Type | |
ComputeItemType ty '[_1] = ty | |
ComputeItemType ty (_1 ': (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]) where ... Source #
Equations
All (_1 :: a -> Constraint) ('[] :: [a]) = () | |
All (pred :: a -> Constraint) (h ': t :: [a]) = (pred h, All pred t) |
Constructors
SomeShape :: forall (shape :: [Nat]). KnownShape shape => Proxy shape -> SomeShape |
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 |
someDevice :: Device -> SomeDevice Source #
withTensor :: Tensor -> (forall (shape :: [Nat]) (dtype :: DType) (device :: (DeviceType, Nat)). (KnownDevice device, KnownDType dtype, KnownShape shape) => Tensor device dtype shape -> r) -> r Source #
withTensorShape :: forall (device :: (DeviceType, Nat)) (dtype :: DType) r. (KnownDevice device, KnownDType dtype) => Tensor -> (forall (shape :: [Nat]). KnownShape shape => Tensor device dtype shape -> r) -> r Source #
type family ComputeBroadcast (reversedShape :: [Nat]) (reversedShape' :: [Nat]) :: Maybe [Nat] where ... Source #
Equations
ComputeBroadcast ('[] :: [Nat]) reversedShape = 'Just reversedShape | |
ComputeBroadcast reversedShape ('[] :: [Nat]) = '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 _1 _2 = 'Nothing :: Maybe [Nat] |
type family CheckBroadcast (shape :: [Nat]) (shape' :: [Nat]) (result :: Maybe [Nat]) :: [Nat] where ... Source #
type Broadcast (shape :: [Nat]) (shape' :: [Nat]) = CheckBroadcast shape shape' (ComputeBroadcast (Reverse shape) (Reverse shape')) Source #
type family BasicArithmeticDTypeIsValid (device :: (DeviceType, Nat)) (dtype :: DType) where ... Source #
Equations
BasicArithmeticDTypeIsValid '('CPU, 0) dtype = (DTypeIsNotBool '('CPU, 0) dtype, DTypeIsNotHalf '('CPU, 0) dtype) | |
BasicArithmeticDTypeIsValid '('CUDA, _1) dtype = () | |
BasicArithmeticDTypeIsValid '('MPS, 0) dtype = () | |
BasicArithmeticDTypeIsValid '(deviceType, _1) dtype = UnsupportedDTypeForDevice deviceType dtype |
add :: forall (shape'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (dtype'' :: DType) (device :: (DeviceType, Nat)). (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'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (dtype'' :: DType) (device :: (DeviceType, Nat)). (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'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (dtype'' :: DType) (device :: (DeviceType, Nat)). (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'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (dtype'' :: DType) (device :: (DeviceType, Nat)). (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) where ... Source #
Equations
ComparisonDTypeIsValid '('CPU, 0) dtype = (DTypeIsNotBool '('CPU, 0) dtype, DTypeIsNotHalf '('CPU, 0) dtype) | |
ComparisonDTypeIsValid '('CUDA, _1) dtype = () | |
ComparisonDTypeIsValid '('MPS, 0) dtype = () | |
ComparisonDTypeIsValid '(deviceType, _1) dtype = UnsupportedDTypeForDevice deviceType dtype |
gt :: forall (shape'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (device :: (DeviceType, Nat)). (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'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (device :: (DeviceType, Nat)). (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'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (device :: (DeviceType, Nat)). (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'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (device :: (DeviceType, Nat)). (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'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (device :: (DeviceType, Nat)). (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'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (device :: (DeviceType, Nat)). (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'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (device :: (DeviceType, Nat)). (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'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (device :: (DeviceType, Nat)). (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'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (device :: (DeviceType, Nat)). (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'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (device :: (DeviceType, Nat)). (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'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (device :: (DeviceType, Nat)). (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'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (dtype' :: DType) (device :: (DeviceType, Nat)). (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 ('[] :: [Nat]) | |
ComputeMatMul '[k] (m ': (k ': reversedBroadcastShape')) = AppendToMaybe m (ComputeBroadcast ('[] :: [Nat]) reversedBroadcastShape') | |
ComputeMatMul (k ': (n ': reversedBroadcastShape)) '[k] = AppendToMaybe n (ComputeBroadcast ('[] :: [Nat]) 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 :: [Nat]) (shape' :: [Nat]) = CheckMatMul shape shape' (ComputeMatMul (Reverse shape) (Reverse shape')) Source #
type family MatMulDTypeIsValid (device :: (DeviceType, Nat)) (dtype :: DType) where ... Source #
Equations
MatMulDTypeIsValid '('CPU, 0) dtype = (DTypeIsNotBool '('CPU, 0) dtype, DTypeIsNotHalf '('CPU, 0) dtype) | |
MatMulDTypeIsValid '('CUDA, deviceIndex) dtype = DTypeIsFloatingPoint '('CUDA, deviceIndex) dtype | |
MatMulDTypeIsValid '('MPS, 0) dtype = DTypeIsFloatingPoint '('MPS, 0) dtype | |
MatMulDTypeIsValid '(deviceType, _1) dtype = UnsupportedDTypeForDevice deviceType dtype |
matmul :: forall (shape'' :: [Nat]) (shape :: [Nat]) (shape' :: [Nat]) (dtype :: DType) (device :: (DeviceType, Nat)). (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 :: Nat) (idx :: Nat) (shape' :: [Nat]) (shape :: [Nat]) (dtype :: DType) (device :: (DeviceType, Nat)). (KnownNat dim, KnownNat idx, InRange shape dim idx, shape' ~ Remove shape dim) => Tensor device dtype shape -> Tensor device dtype shape' Source #
selectIdx :: forall (dim :: Nat) (n :: Nat) (shape' :: [Nat]) (shape :: [Nat]) (dtype :: DType) (device :: (DeviceType, Nat)). (KnownNat dim, n ~ Index shape dim, shape' ~ Remove shape dim) => Tensor device dtype shape -> Finite n -> Tensor device dtype shape' Source #
reshape :: forall (shape' :: [Nat]) (shape :: [Nat]) (dtype :: DType) (device :: (DeviceType, Nat)). (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)
Instances
Unnamed t => Castable (Wrap t) ATenTensor Source # | |
Defined in Torch.Typed.Tensor |
data TensorListFold Source #
Constructors
TensorListFold |
Instances
Castable x ATenTensor => Apply' TensorListFold (x, IO [ATenTensor]) (IO [ATenTensor]) Source # | |
Defined in Torch.Typed.Tensor Methods apply' :: TensorListFold -> (x, IO [ATenTensor]) -> IO [ATenTensor] Source # |
data TensorListUnfold Source #
Constructors
TensorListUnfold |
Instances
Castable x ATenTensor => Apply TensorListUnfold [ATenTensor] (IO (HJust (x, [ATenTensor]))) Source # | |
Defined in Torch.Typed.Tensor Methods apply :: TensorListUnfold -> [ATenTensor] -> IO (HJust (x, [ATenTensor])) Source # | |
Apply TensorListUnfold [ATenTensor] (IO HNothing) Source # | |
Defined in Torch.Typed.Tensor Methods apply :: TensorListUnfold -> [ATenTensor] -> IO HNothing Source # |
toSparse :: forall (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]). Tensor device dtype shape -> Tensor device dtype shape Source #
toDense :: forall (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]). Tensor device dtype shape -> Tensor device dtype shape Source #
toCPU :: forall (device :: (DeviceType, Nat)) (shape :: [Nat]) (dtype :: DType). Tensor device dtype shape -> CPUTensor dtype shape Source #
move tensor to CPU TODO: can this fail?
toCUDA :: forall {k} (device' :: k) (device :: (DeviceType, Nat)) (shape :: [Nat]) (dtype :: DType). Tensor device dtype shape -> CUDATensor 0 dtype shape Source #
move tensor to the first CUDA device TODO: what if this fails?
toMPS :: forall {k} (device' :: k) (device :: (DeviceType, Nat)) (shape :: [Nat]) (dtype :: DType). Tensor device dtype shape -> MPSTensor 0 dtype shape Source #
move tensor to the first MPS device TODO: what if this fails?
toDevice :: forall (device' :: (DeviceType, Nat)) (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]) 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) (dtype :: DType) (device :: (DeviceType, Nat)) (shape :: [Nat]) 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 :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]) t. (TensorOptions shape dtype device, IsUnnamed t device dtype shape) => t -> Int Source #
returns tensor dimension uses compile-time information only
shape :: forall (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]) 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 :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]) 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 :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]) t. (TensorOptions shape dtype device, IsUnnamed t device dtype shape) => t -> Device Source #
returns tensor device uses compile-time information only
toInt :: forall (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]). Tensor device dtype shape -> Int Source #
toFloat :: forall (device :: (DeviceType, Nat)). Tensor device 'Float ('[] :: [Nat]) -> Float Source #
toDouble :: forall (device :: (DeviceType, Nat)). Tensor device 'Double ('[] :: [Nat]) -> Double Source #
data NamedTensor (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: Shape) where Source #
Constructors
FromTensor :: forall (device :: (DeviceType, Nat)) (dtype :: DType) (shape :: Shape) (shape1 :: [Nat]). shape1 ~ ToNats shape => Tensor device dtype shape1 -> NamedTensor device dtype shape |
Instances
KnownDevice device => Num (NamedTensor device dtype shape) Source # | |||||||||||||
Defined in Torch.Typed.Tensor Methods (+) :: NamedTensor device dtype shape -> NamedTensor device dtype shape -> NamedTensor device dtype shape # (-) :: NamedTensor device dtype shape -> NamedTensor device dtype shape -> NamedTensor device dtype shape # (*) :: NamedTensor device dtype shape -> NamedTensor device dtype shape -> NamedTensor device dtype shape # negate :: NamedTensor device dtype shape -> NamedTensor device dtype shape # abs :: NamedTensor device dtype shape -> NamedTensor device dtype shape # signum :: NamedTensor device dtype shape -> NamedTensor device dtype shape # fromInteger :: Integer -> NamedTensor device dtype shape # | |||||||||||||
KnownDevice device => Fractional (NamedTensor device dtype shape) Source # | |||||||||||||
Defined in Torch.Typed.Tensor Methods (/) :: NamedTensor device dtype shape -> NamedTensor device dtype shape -> NamedTensor device dtype shape # recip :: NamedTensor device dtype shape -> NamedTensor device dtype shape # fromRational :: Rational -> NamedTensor device dtype shape # | |||||||||||||
Show (NamedTensor device dtype shape) Source # | |||||||||||||
Defined in Torch.Typed.Tensor Methods showsPrec :: Int -> NamedTensor device dtype shape -> ShowS # show :: NamedTensor device dtype shape -> String # showList :: [NamedTensor device dtype shape] -> ShowS # | |||||||||||||
(TensorOptions shape' dtype device, shape' ~ ToNats shape) => Default (NamedTensor device dtype shape) Source # | |||||||||||||
Defined in Torch.Typed.Factories Methods def :: NamedTensor device dtype shape # | |||||||||||||
Unnamed (NamedTensor device dtype shape) Source # | |||||||||||||
Defined in Torch.Typed.Tensor Associated Types
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 # | |||||||||||||
Defined in Torch.Typed.Tensor Methods cast :: NamedTensor device dtype shape -> (ATenTensor -> IO r) -> IO r # uncast :: ATenTensor -> (NamedTensor device dtype shape -> IO r) -> IO r # | |||||||||||||
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 #
Equations
ReplaceDevice'' (Tensor device0 dtype shape :: Type) device1 = Tensor device1 dtype shape | |
ReplaceDevice'' (NamedTensor device0 dtype shape :: Type) device1 = NamedTensor device1 dtype shape |
type family ReplaceDType'' (tensor :: t) (dtype :: DType) :: t where ... Source #
Equations
ReplaceDType'' (Tensor device dtype0 shape :: Type) dtype1 = Tensor device dtype1 shape | |
ReplaceDType'' (NamedTensor device dtype0 shape :: Type) 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 # | |
Methods cast :: HList l -> (ForeignPtr TensorList -> IO r) -> IO r # uncast :: ForeignPtr TensorList -> (HList l -> IO r) -> IO r # |