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

Torch.Tensor

Synopsis

Documentation

newtype Tensor Source #

Constructors

Unsafe ATenTensor 

Instances

Instances details
Num Tensor Source # 
Instance details

Defined in Torch.Functional

Fractional Tensor Source # 
Instance details

Defined in Torch.Functional

Show Tensor Source # 
Instance details

Defined in Torch.Tensor

Eq Tensor Source # 
Instance details

Defined in Torch.Functional

Parameterized Tensor Source # 
Instance details

Defined in Torch.NN

RawFile Tensor Source # 
Instance details

Defined in Torch.Serialize

TensorIndex Tensor Source # 
Instance details

Defined in Torch.Tensor

TensorLike Tensor Source # 
Instance details

Defined in Torch.Tensor

TensorOptionLike Tensor Source # 
Instance details

Defined in Torch.Tensor

HasTypes Tensor Tensor Source # 
Instance details

Defined in Torch.Tensor

HasTypes Bool Tensor Source # 
Instance details

Defined in Torch.Tensor

HasTypes Double Tensor Source # 
Instance details

Defined in Torch.Tensor

HasTypes Float Tensor Source # 
Instance details

Defined in Torch.Tensor

HasTypes Int Tensor Source # 
Instance details

Defined in Torch.Tensor

Castable Tensor ATenTensor Source # 
Instance details

Defined in Torch.Tensor

Methods

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

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

HasForward Linear Tensor Tensor Source # 
Instance details

Defined in Torch.NN

HasForward UpSample Tensor Tensor Source # 
Instance details

Defined in Torch.NN

Applicative m => Dataset (m :: Type -> Type) (MNIST m) Int (Tensor, Tensor) Source # 
Instance details

Defined in Torch.Vision

Methods

getItem :: MNIST m -> Int -> m (Tensor, Tensor) Source #

keys :: MNIST m -> Set Int Source #

Monad m => Datastream m Int (MNIST m) (Tensor, Tensor) Source # 
Instance details

Defined in Torch.Vision

Methods

streamSamples :: MNIST m -> Int -> ListT m (Tensor, Tensor) Source #

Castable [Tensor] (ForeignPtr (C10List (C10Optional Tensor))) Source # 
Instance details

Defined in Torch.Tensor

Castable [Tensor] (ForeignPtr (C10List Tensor)) Source # 
Instance details

Defined in Torch.Tensor

Methods

cast :: [Tensor] -> (ForeignPtr (C10List Tensor0) -> IO r) -> IO r Source #

uncast :: ForeignPtr (C10List Tensor0) -> ([Tensor] -> IO r) -> IO r Source #

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

Defined in Torch.Tensor

Methods

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

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

HasTypes (a -> a) Tensor Source # 
Instance details

Defined in Torch.Tensor

Methods

types_ :: Traversal' (a -> a) Tensor Source #

newtype MutableTensor Source #

Constructors

MutableTensor Tensor 

Instances

Instances details
Show MutableTensor Source # 
Instance details

Defined in Torch.Tensor

numel Source #

Arguments

:: Tensor

input

-> Int

number of elements in tensor

Returns the total number of elements in the input tensor.

size Source #

Arguments

:: Int

dimension

-> Tensor

input

-> Int 

Returns the size of a given dimension of the input tensor.

shape Source #

Arguments

:: Tensor

input

-> [Int]

list of integers representing the shape of the tensor

Returns the shape of the tensor

dim Source #

Arguments

:: Tensor

input

-> Int

output

Returns the dimensions of the input tensor

dimUnsafe Source #

Arguments

:: Tensor

input

-> Int

output

Returns the dimensions of the input tensor

dimCUnsafe Source #

Arguments

:: Tensor

input

-> Int

output

Returns the dimensions of the input tensor

device Source #

Arguments

:: Tensor

input

-> Device

object representing the device

Returns the device on which the tensor is currently allocated

dtype Source #

Arguments

:: Tensor

input

-> DType

data type of the input tensor

Returns the data type of the input tensor

_toType Source #

Arguments

:: DType

data type to cast input to

-> Tensor

input

-> Tensor

output

Casts the input tensor to the given data type

toType :: forall a. HasTypes a Tensor => DType -> a -> a Source #

toDevice :: forall a. HasTypes a Tensor => Device -> a -> a Source #

_toDevice Source #

Arguments

:: Device

device to cast input to

-> Tensor

input

-> Tensor

output

Casts the input tensor to given device

select Source #

Arguments

:: Int

dimension to slice along

-> Int

index in the given dimension

-> Tensor

input

-> Tensor

output

Slices the input tensor along the selected dimension at the given index.

indexSelect Source #

Arguments

:: Int

dim

-> Tensor

indexTensor

-> Tensor

input

-> Tensor

output

Returns a new tensor which indexes the input tensor along dimension dim using the entries in index which is a LongTensor.

indexSelect' Source #

Arguments

:: Int

dim

-> [Int]

indexList

-> Tensor

input

-> Tensor

output

sliceDim Source #

Arguments

:: Int

dim

-> Int

start

-> Int

end

-> Int

step

-> Tensor

input

-> Tensor 

Slices the input tensor along the selected dimension at the given range.

reshape :: [Int] -> Tensor -> Tensor Source #

Returns a tensor with the same data and number of elements as input, but with the specified shape.

newtype RawTensorIndex Source #

Instances

Instances details
Castable RawTensorIndex (ForeignPtr TensorIndex) Source # 
Instance details

Defined in Torch.Tensor

data None Source #

Constructors

None 

Instances

Instances details
Show None Source # 
Instance details

Defined in Torch.Tensor

Eq None Source # 
Instance details

Defined in Torch.Tensor

Methods

(==) :: None -> None -> Bool Source #

(/=) :: None -> None -> Bool Source #

TensorIndex None Source # 
Instance details

Defined in Torch.Tensor

Integral a => TensorIndex (Slice (None, a)) Source # 
Instance details

Defined in Torch.Tensor

Integral a => TensorIndex (Slice (a, None)) Source # 
Instance details

Defined in Torch.Tensor

Integral a => TensorIndex (Slice (None, None, a)) Source # 
Instance details

Defined in Torch.Tensor

Integral a => TensorIndex (Slice (None, a, a)) Source # 
Instance details

Defined in Torch.Tensor

Integral a => TensorIndex (Slice (a, None, a)) Source # 
Instance details

Defined in Torch.Tensor

data Ellipsis Source #

Constructors

Ellipsis 

Instances

Instances details
Show Ellipsis Source # 
Instance details

Defined in Torch.Tensor

Eq Ellipsis Source # 
Instance details

Defined in Torch.Tensor

TensorIndex Ellipsis Source # 
Instance details

Defined in Torch.Tensor

newtype Slice a Source #

Constructors

Slice a 

Instances

Instances details
Show a => Show (Slice a) Source # 
Instance details

Defined in Torch.Tensor

Eq a => Eq (Slice a) Source # 
Instance details

Defined in Torch.Tensor

Methods

(==) :: Slice a -> Slice a -> Bool Source #

(/=) :: Slice a -> Slice a -> Bool Source #

TensorIndex (Slice ()) Source # 
Instance details

Defined in Torch.Tensor

Integral a => TensorIndex (Slice (None, a)) Source # 
Instance details

Defined in Torch.Tensor

Integral a => TensorIndex (Slice (a, None)) Source # 
Instance details

Defined in Torch.Tensor

Integral a => TensorIndex (Slice (a, a)) Source # 
Instance details

Defined in Torch.Tensor

Integral a => TensorIndex (Slice (None, None, a)) Source # 
Instance details

Defined in Torch.Tensor

Integral a => TensorIndex (Slice (None, a, a)) Source # 
Instance details

Defined in Torch.Tensor

Integral a => TensorIndex (Slice (a, None, a)) Source # 
Instance details

Defined in Torch.Tensor

Integral a => TensorIndex (Slice (a, a, a)) Source # 
Instance details

Defined in Torch.Tensor

Methods

pushIndex :: [RawTensorIndex] -> Slice (a, a, a) -> [RawTensorIndex] Source #

toLens :: TensorLike b => Slice (a, a, a) -> Lens' Tensor b Source #

Integral a => TensorIndex (Slice a) Source # 
Instance details

Defined in Torch.Tensor

class TensorIndex a where Source #

Minimal complete definition

pushIndex

Methods

pushIndex :: [RawTensorIndex] -> a -> [RawTensorIndex] Source #

toLens :: TensorLike b => a -> Lens' Tensor b Source #

default toLens :: TensorLike b => a -> Lens' Tensor b Source #

Instances

Instances details
TensorIndex Ellipsis Source # 
Instance details

Defined in Torch.Tensor

TensorIndex None Source # 
Instance details

Defined in Torch.Tensor

TensorIndex Tensor Source # 
Instance details

Defined in Torch.Tensor

TensorIndex Integer Source # 
Instance details

Defined in Torch.Tensor

TensorIndex () Source # 
Instance details

Defined in Torch.Tensor

TensorIndex Bool Source # 
Instance details

Defined in Torch.Tensor

TensorIndex Int Source # 
Instance details

Defined in Torch.Tensor

TensorIndex (Slice ()) Source # 
Instance details

Defined in Torch.Tensor

Integral a => TensorIndex (Slice (None, a)) Source # 
Instance details

Defined in Torch.Tensor

Integral a => TensorIndex (Slice (a, None)) Source # 
Instance details

Defined in Torch.Tensor

Integral a => TensorIndex (Slice (a, a)) Source # 
Instance details

Defined in Torch.Tensor

Integral a => TensorIndex (Slice (None, None, a)) Source # 
Instance details

Defined in Torch.Tensor

Integral a => TensorIndex (Slice (None, a, a)) Source # 
Instance details

Defined in Torch.Tensor

Integral a => TensorIndex (Slice (a, None, a)) Source # 
Instance details

Defined in Torch.Tensor

Integral a => TensorIndex (Slice (a, a, a)) Source # 
Instance details

Defined in Torch.Tensor

Methods

pushIndex :: [RawTensorIndex] -> Slice (a, a, a) -> [RawTensorIndex] Source #

toLens :: TensorLike b => Slice (a, a, a) -> Lens' Tensor b Source #

Integral a => TensorIndex (Slice a) Source # 
Instance details

Defined in Torch.Tensor

TensorIndex [Maybe Int] Source # 
Instance details

Defined in Torch.Typed.Lens

(TensorIndex a, TensorIndex b) => TensorIndex (a, b) Source # 
Instance details

Defined in Torch.Tensor

Methods

pushIndex :: [RawTensorIndex] -> (a, b) -> [RawTensorIndex] Source #

toLens :: TensorLike b0 => (a, b) -> Lens' Tensor b0 Source #

(TensorIndex a, TensorIndex b, TensorIndex c) => TensorIndex (a, b, c) Source # 
Instance details

Defined in Torch.Tensor

Methods

pushIndex :: [RawTensorIndex] -> (a, b, c) -> [RawTensorIndex] Source #

toLens :: TensorLike b0 => (a, b, c) -> Lens' Tensor b0 Source #

(TensorIndex a, TensorIndex b, TensorIndex c, TensorIndex d) => TensorIndex (a, b, c, d) Source # 
Instance details

Defined in Torch.Tensor

Methods

pushIndex :: [RawTensorIndex] -> (a, b, c, d) -> [RawTensorIndex] Source #

toLens :: TensorLike b0 => (a, b, c, d) -> Lens' Tensor b0 Source #

(TensorIndex a, TensorIndex b, TensorIndex c, TensorIndex d, TensorIndex e) => TensorIndex (a, b, c, d, e) Source # 
Instance details

Defined in Torch.Tensor

Methods

pushIndex :: [RawTensorIndex] -> (a, b, c, d, e) -> [RawTensorIndex] Source #

toLens :: TensorLike b0 => (a, b, c, d, e) -> Lens' Tensor b0 Source #

class TensorOptionLike a where Source #

Instances

Instances details
TensorOptionLike Tensor Source # 
Instance details

Defined in Torch.Tensor

TensorOptionLike TensorOptions Source # 
Instance details

Defined in Torch.Tensor

class TensorLike a where Source #

Methods

asTensor' :: TensorOptionLike opt => a -> opt -> Tensor Source #

asTensor :: a -> Tensor Source #

_asValue :: Tensor -> a Source #

_dtype :: DType Source #

_dims :: a -> [Int] Source #

_deepDims :: a -> Maybe [Int] Source #

_peekElemOff :: Ptr () -> Int -> [Int] -> IO a Source #

_pokeElemOff :: Ptr () -> Int -> a -> IO () Source #

Instances

Instances details
TensorLike Tensor Source # 
Instance details

Defined in Torch.Tensor

TensorLike Bool Source # 
Instance details

Defined in Torch.Tensor

(Reifies a DType, Storable a) => TensorLike a Source # 
Instance details

Defined in Torch.Tensor

Methods

asTensor' :: TensorOptionLike opt => a -> opt -> Tensor Source #

asTensor :: a -> Tensor Source #

_asValue :: Tensor -> a Source #

_dtype :: DType Source #

_dims :: a -> [Int] Source #

_deepDims :: a -> Maybe [Int] Source #

_peekElemOff :: Ptr () -> Int -> [Int] -> IO a Source #

_pokeElemOff :: Ptr () -> Int -> a -> IO () Source #

TensorLike a => TensorLike [a] Source # 
Instance details

Defined in Torch.Tensor

Methods

asTensor' :: TensorOptionLike opt => [a] -> opt -> Tensor Source #

asTensor :: [a] -> Tensor Source #

_asValue :: Tensor -> [a] Source #

_dtype :: DType Source #

_dims :: [a] -> [Int] Source #

_deepDims :: [a] -> Maybe [Int] Source #

_peekElemOff :: Ptr () -> Int -> [Int] -> IO [a] Source #

_pokeElemOff :: Ptr () -> Int -> [a] -> IO () Source #

TensorLike a => TensorLike (a, a) Source # 
Instance details

Defined in Torch.Tensor

Methods

asTensor' :: TensorOptionLike opt => (a, a) -> opt -> Tensor Source #

asTensor :: (a, a) -> Tensor Source #

_asValue :: Tensor -> (a, a) Source #

_dtype :: DType Source #

_dims :: (a, a) -> [Int] Source #

_deepDims :: (a, a) -> Maybe [Int] Source #

_peekElemOff :: Ptr () -> Int -> [Int] -> IO (a, a) Source #

_pokeElemOff :: Ptr () -> Int -> (a, a) -> IO () Source #

withTensor :: Tensor -> (Ptr () -> IO a) -> IO a Source #

_withTensor :: Tensor -> (Ptr () -> IO a) -> IO a Source #

The internal function of withTensor. It does not check contiguous memory-layout.

class AsTensors as where Source #

Minimal complete definition

Nothing

Methods

toTensors :: as -> Vector Tensor Source #

default toTensors :: (Generic as, GAsTensors (Rep as)) => as -> Vector Tensor Source #

Instances

Instances details
TensorLike a => AsTensors a Source # 
Instance details

Defined in Torch.Tensor

Methods

toTensors :: a -> Vector Tensor Source #

class GAsTensors record where Source #

Methods

gToTensors :: record as -> Vector Tensor Source #

Instances

Instances details
(GAsTensors ls, GAsTensors rs) => GAsTensors (ls :*: rs) Source # 
Instance details

Defined in Torch.Tensor

Methods

gToTensors :: (ls :*: rs) as -> Vector Tensor Source #

(GAsTensors ls, GAsTensors rs) => GAsTensors (ls :+: rs) Source # 
Instance details

Defined in Torch.Tensor

Methods

gToTensors :: (ls :+: rs) as -> Vector Tensor Source #

TensorLike ls => GAsTensors (K1 i ls :: Type -> Type) Source # 
Instance details

Defined in Torch.Tensor

Methods

gToTensors :: K1 i ls as -> Vector Tensor Source #

GAsTensors ls => GAsTensors (M1 i c ls) Source # 
Instance details

Defined in Torch.Tensor

Methods

gToTensors :: M1 i c ls as -> Vector Tensor Source #

Orphan instances

HasTypes Bool Bool Source # 
Instance details

HasTypes Double Double Source # 
Instance details

HasTypes Float Float Source # 
Instance details

HasTypes Int Int Source # 
Instance details