{-# LANGUAGE FlexibleContexts #-}
module Torch.TensorFactories where
import Foreign.ForeignPtr
import System.IO.Unsafe
import Torch.Dimname
import Torch.Internal.Cast
import Torch.Internal.Class (Castable (..))
import qualified Torch.Internal.Const as ATen
import qualified Torch.Internal.Managed.Autograd as LibTorch
import Torch.Internal.Managed.Cast
import qualified Torch.Internal.Managed.Native as ATen
import qualified Torch.Internal.Managed.TensorFactories as LibTorch
import qualified Torch.Internal.Managed.Type.Tensor as ATen
import qualified Torch.Internal.Managed.Type.TensorOptions as ATen
import qualified Torch.Internal.Type as ATen
import Torch.Scalar
import Torch.Tensor
import Torch.TensorOptions
type FactoryType =
ForeignPtr ATen.IntArray ->
ForeignPtr ATen.TensorOptions ->
IO (ForeignPtr ATen.Tensor)
type FactoryTypeWithDimnames =
ForeignPtr ATen.IntArray ->
ForeignPtr ATen.DimnameList ->
ForeignPtr ATen.TensorOptions ->
IO (ForeignPtr ATen.Tensor)
mkFactory ::
FactoryType ->
[Int] ->
TensorOptions ->
IO Tensor
mkFactory :: FactoryType -> [Int] -> TensorOptions -> IO Tensor
mkFactory = forall a ca x1 cx1 y cy.
(Castable a ca, Castable x1 cx1, Castable y cy) =>
(ca -> cx1 -> IO cy) -> a -> x1 -> IO y
cast2
mkFactoryUnsafe :: FactoryType -> [Int] -> TensorOptions -> Tensor
mkFactoryUnsafe :: FactoryType -> [Int] -> TensorOptions -> Tensor
mkFactoryUnsafe FactoryType
f [Int]
shape TensorOptions
opts = forall a. IO a -> a
unsafePerformIO forall a b. (a -> b) -> a -> b
$ FactoryType -> [Int] -> TensorOptions -> IO Tensor
mkFactory FactoryType
f [Int]
shape TensorOptions
opts
mkFactoryWithDimnames :: FactoryTypeWithDimnames -> [(Int, Dimname)] -> TensorOptions -> IO Tensor
mkFactoryWithDimnames :: FactoryTypeWithDimnames
-> [(Int, Dimname)] -> TensorOptions -> IO Tensor
mkFactoryWithDimnames FactoryTypeWithDimnames
aten_impl [(Int, Dimname)]
shape = forall a ca x1 cx1 x2 cx2 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable y cy) =>
(ca -> cx1 -> cx2 -> IO cy) -> a -> x1 -> x2 -> IO y
cast3 FactoryTypeWithDimnames
aten_impl (forall a b. (a -> b) -> [a] -> [b]
map forall a b. (a, b) -> a
fst [(Int, Dimname)]
shape) (forall a b. (a -> b) -> [a] -> [b]
map forall a b. (a, b) -> b
snd [(Int, Dimname)]
shape)
mkFactoryUnsafeWithDimnames :: FactoryTypeWithDimnames -> [(Int, Dimname)] -> TensorOptions -> Tensor
mkFactoryUnsafeWithDimnames :: FactoryTypeWithDimnames
-> [(Int, Dimname)] -> TensorOptions -> Tensor
mkFactoryUnsafeWithDimnames FactoryTypeWithDimnames
f [(Int, Dimname)]
shape TensorOptions
opts = forall a. IO a -> a
unsafePerformIO forall a b. (a -> b) -> a -> b
$ FactoryTypeWithDimnames
-> [(Int, Dimname)] -> TensorOptions -> IO Tensor
mkFactoryWithDimnames FactoryTypeWithDimnames
f [(Int, Dimname)]
shape TensorOptions
opts
mkDefaultFactory :: ([Int] -> TensorOptions -> a) -> [Int] -> a
mkDefaultFactory :: forall a. ([Int] -> TensorOptions -> a) -> [Int] -> a
mkDefaultFactory [Int] -> TensorOptions -> a
non_default [Int]
shape = [Int] -> TensorOptions -> a
non_default [Int]
shape TensorOptions
defaultOpts
mkDefaultFactoryWithDimnames :: ([(Int, Dimname)] -> TensorOptions -> a) -> [(Int, Dimname)] -> a
mkDefaultFactoryWithDimnames :: forall a.
([(Int, Dimname)] -> TensorOptions -> a) -> [(Int, Dimname)] -> a
mkDefaultFactoryWithDimnames [(Int, Dimname)] -> TensorOptions -> a
non_default [(Int, Dimname)]
shape = [(Int, Dimname)] -> TensorOptions -> a
non_default [(Int, Dimname)]
shape TensorOptions
defaultOpts
ones ::
[Int] ->
TensorOptions ->
Tensor
ones :: [Int] -> TensorOptions -> Tensor
ones = FactoryType -> [Int] -> TensorOptions -> Tensor
mkFactoryUnsafe FactoryType
LibTorch.ones_lo
onesLike ::
Tensor ->
Tensor
onesLike :: Tensor -> Tensor
onesLike Tensor
self = forall a. IO a -> a
unsafePerformIO forall a b. (a -> b) -> a -> b
$ forall a ca y cy.
(Castable a ca, Castable y cy) =>
(ca -> IO cy) -> a -> IO y
cast1 ForeignPtr Tensor -> IO (ForeignPtr Tensor)
ATen.ones_like_t Tensor
self
zeros ::
[Int] ->
TensorOptions ->
Tensor
zeros :: [Int] -> TensorOptions -> Tensor
zeros = FactoryType -> [Int] -> TensorOptions -> Tensor
mkFactoryUnsafe FactoryType
LibTorch.zeros_lo
zerosLike ::
Tensor ->
Tensor
zerosLike :: Tensor -> Tensor
zerosLike Tensor
self = forall a. IO a -> a
unsafePerformIO forall a b. (a -> b) -> a -> b
$ forall a ca y cy.
(Castable a ca, Castable y cy) =>
(ca -> IO cy) -> a -> IO y
cast1 ForeignPtr Tensor -> IO (ForeignPtr Tensor)
ATen.zeros_like_t Tensor
self
randIO ::
[Int] ->
TensorOptions ->
IO Tensor
randIO :: [Int] -> TensorOptions -> IO Tensor
randIO = FactoryType -> [Int] -> TensorOptions -> IO Tensor
mkFactory FactoryType
LibTorch.rand_lo
randnIO ::
[Int] ->
TensorOptions ->
IO Tensor
randnIO :: [Int] -> TensorOptions -> IO Tensor
randnIO = FactoryType -> [Int] -> TensorOptions -> IO Tensor
mkFactory FactoryType
LibTorch.randn_lo
randintIO ::
Int ->
Int ->
[Int] ->
TensorOptions ->
IO Tensor
randintIO :: Int -> Int -> [Int] -> TensorOptions -> IO Tensor
randintIO Int
low Int
high = FactoryType -> [Int] -> TensorOptions -> IO Tensor
mkFactory (Int64 -> Int64 -> FactoryType
LibTorch.randint_lllo (forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
low) (forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
high))
randnLikeIO ::
Tensor ->
IO Tensor
randnLikeIO :: Tensor -> IO Tensor
randnLikeIO = forall a ca y cy.
(Castable a ca, Castable y cy) =>
(ca -> IO cy) -> a -> IO y
cast1 ForeignPtr Tensor -> IO (ForeignPtr Tensor)
ATen.randn_like_t
randLikeIO ::
Tensor ->
TensorOptions ->
IO Tensor
randLikeIO :: Tensor -> TensorOptions -> IO Tensor
randLikeIO = forall a ca x1 cx1 y cy.
(Castable a ca, Castable x1 cx1, Castable y cy) =>
(ca -> cx1 -> IO cy) -> a -> x1 -> IO y
cast2 ForeignPtr Tensor
-> ForeignPtr TensorOptions -> IO (ForeignPtr Tensor)
LibTorch.rand_like_to
fullLike ::
Tensor ->
Float ->
TensorOptions ->
IO Tensor
fullLike :: Tensor -> Float -> TensorOptions -> IO Tensor
fullLike = forall a ca x1 cx1 x2 cx2 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable y cy) =>
(ca -> cx1 -> cx2 -> IO cy) -> a -> x1 -> x2 -> IO y
cast3 ForeignPtr Tensor
-> ForeignPtr Scalar
-> ForeignPtr TensorOptions
-> IO (ForeignPtr Tensor)
LibTorch.full_like_tso
onesWithDimnames :: [(Int, Dimname)] -> TensorOptions -> Tensor
onesWithDimnames :: [(Int, Dimname)] -> TensorOptions -> Tensor
onesWithDimnames = FactoryTypeWithDimnames
-> [(Int, Dimname)] -> TensorOptions -> Tensor
mkFactoryUnsafeWithDimnames FactoryTypeWithDimnames
LibTorch.ones_lNo
zerosWithDimnames :: [(Int, Dimname)] -> TensorOptions -> Tensor
zerosWithDimnames :: [(Int, Dimname)] -> TensorOptions -> Tensor
zerosWithDimnames = FactoryTypeWithDimnames
-> [(Int, Dimname)] -> TensorOptions -> Tensor
mkFactoryUnsafeWithDimnames FactoryTypeWithDimnames
LibTorch.zeros_lNo
randWithDimnames :: [(Int, Dimname)] -> TensorOptions -> IO Tensor
randWithDimnames :: [(Int, Dimname)] -> TensorOptions -> IO Tensor
randWithDimnames = FactoryTypeWithDimnames
-> [(Int, Dimname)] -> TensorOptions -> IO Tensor
mkFactoryWithDimnames FactoryTypeWithDimnames
LibTorch.rand_lNo
randnWithDimnames :: [(Int, Dimname)] -> TensorOptions -> IO Tensor
randnWithDimnames :: [(Int, Dimname)] -> TensorOptions -> IO Tensor
randnWithDimnames = FactoryTypeWithDimnames
-> [(Int, Dimname)] -> TensorOptions -> IO Tensor
mkFactoryWithDimnames FactoryTypeWithDimnames
LibTorch.randn_lNo
linspace ::
(Scalar a, Scalar b) =>
a ->
b ->
Int ->
TensorOptions ->
Tensor
linspace :: forall a b.
(Scalar a, Scalar b) =>
a -> b -> Int -> TensorOptions -> Tensor
linspace a
start b
end Int
steps TensorOptions
opts = forall a. IO a -> a
unsafePerformIO forall a b. (a -> b) -> a -> b
$ forall a ca x1 cx1 x2 cx2 x3 cx3 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
Castable y cy) =>
(ca -> cx1 -> cx2 -> cx3 -> IO cy) -> a -> x1 -> x2 -> x3 -> IO y
cast4 ForeignPtr Scalar
-> ForeignPtr Scalar
-> Int64
-> ForeignPtr TensorOptions
-> IO (ForeignPtr Tensor)
LibTorch.linspace_sslo a
start b
end Int
steps TensorOptions
opts
logspace :: (Scalar a, Scalar b) => a -> b -> Int -> Double -> TensorOptions -> Tensor
logspace :: forall a b.
(Scalar a, Scalar b) =>
a -> b -> Int -> Double -> TensorOptions -> Tensor
logspace a
start b
end Int
steps Double
base TensorOptions
opts = forall a. IO a -> a
unsafePerformIO forall a b. (a -> b) -> a -> b
$ forall a ca x1 cx1 x2 cx2 x3 cx3 x4 cx4 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
Castable x4 cx4, Castable y cy) =>
(ca -> cx1 -> cx2 -> cx3 -> cx4 -> IO cy)
-> a -> x1 -> x2 -> x3 -> x4 -> IO y
cast5 ForeignPtr Scalar
-> ForeignPtr Scalar
-> Int64
-> CDouble
-> ForeignPtr TensorOptions
-> IO (ForeignPtr Tensor)
LibTorch.logspace_ssldo a
start b
end Int
steps Double
base TensorOptions
opts
eyeSquare ::
Int ->
TensorOptions ->
Tensor
eyeSquare :: Int -> TensorOptions -> Tensor
eyeSquare Int
dim = forall a. IO a -> a
unsafePerformIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a ca x1 cx1 y cy.
(Castable a ca, Castable x1 cx1, Castable y cy) =>
(ca -> cx1 -> IO cy) -> a -> x1 -> IO y
cast2 Int64 -> ForeignPtr TensorOptions -> IO (ForeignPtr Tensor)
LibTorch.eye_lo Int
dim
eye ::
Int ->
Int ->
TensorOptions ->
Tensor
eye :: Int -> Int -> TensorOptions -> Tensor
eye Int
nrows Int
ncols TensorOptions
opts = forall a. IO a -> a
unsafePerformIO forall a b. (a -> b) -> a -> b
$ forall a ca x1 cx1 x2 cx2 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable y cy) =>
(ca -> cx1 -> cx2 -> IO cy) -> a -> x1 -> x2 -> IO y
cast3 Int64
-> Int64 -> ForeignPtr TensorOptions -> IO (ForeignPtr Tensor)
LibTorch.eye_llo Int
nrows Int
ncols TensorOptions
opts
full ::
Scalar a =>
[Int] ->
a ->
TensorOptions ->
Tensor
full :: forall a. Scalar a => [Int] -> a -> TensorOptions -> Tensor
full [Int]
shape a
value TensorOptions
opts = forall a. IO a -> a
unsafePerformIO forall a b. (a -> b) -> a -> b
$ forall a ca x1 cx1 x2 cx2 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable y cy) =>
(ca -> cx1 -> cx2 -> IO cy) -> a -> x1 -> x2 -> IO y
cast3 ForeignPtr IntArray
-> ForeignPtr Scalar
-> ForeignPtr TensorOptions
-> IO (ForeignPtr Tensor)
LibTorch.full_lso [Int]
shape a
value TensorOptions
opts
sparseCooTensor ::
Tensor ->
Tensor ->
[Int] ->
TensorOptions ->
Tensor
sparseCooTensor :: Tensor -> Tensor -> [Int] -> TensorOptions -> Tensor
sparseCooTensor Tensor
indices Tensor
values [Int]
size TensorOptions
opts = forall a. IO a -> a
unsafePerformIO forall a b. (a -> b) -> a -> b
$ forall a ca x1 cx1 x2 cx2 x3 cx3 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
Castable y cy) =>
(ca -> cx1 -> cx2 -> cx3 -> IO cy) -> a -> x1 -> x2 -> x3 -> IO y
cast4 ForeignPtr Tensor -> ForeignPtr Tensor -> FactoryType
sparse_coo_tensor_ttlo Tensor
indices Tensor
values [Int]
size TensorOptions
opts
where
sparse_coo_tensor_ttlo :: ForeignPtr Tensor -> ForeignPtr Tensor -> FactoryType
sparse_coo_tensor_ttlo ForeignPtr Tensor
indices' ForeignPtr Tensor
values' ForeignPtr IntArray
size' ForeignPtr TensorOptions
opts' = do
ForeignPtr Tensor
i' <- ForeignPtr Tensor -> IO (ForeignPtr Tensor)
LibTorch.dropVariable ForeignPtr Tensor
indices'
ForeignPtr Tensor
v' <- ForeignPtr Tensor -> IO (ForeignPtr Tensor)
LibTorch.dropVariable ForeignPtr Tensor
values'
ForeignPtr Tensor -> ForeignPtr Tensor -> FactoryType
LibTorch.sparse_coo_tensor_ttlo ForeignPtr Tensor
i' ForeignPtr Tensor
v' ForeignPtr IntArray
size' ForeignPtr TensorOptions
opts'
ones' :: [Int] -> Tensor
ones' :: [Int] -> Tensor
ones' = forall a. ([Int] -> TensorOptions -> a) -> [Int] -> a
mkDefaultFactory [Int] -> TensorOptions -> Tensor
ones
zeros' :: [Int] -> Tensor
zeros' :: [Int] -> Tensor
zeros' = forall a. ([Int] -> TensorOptions -> a) -> [Int] -> a
mkDefaultFactory [Int] -> TensorOptions -> Tensor
zeros
randIO' :: [Int] -> IO Tensor
randIO' :: [Int] -> IO Tensor
randIO' = forall a. ([Int] -> TensorOptions -> a) -> [Int] -> a
mkDefaultFactory [Int] -> TensorOptions -> IO Tensor
randIO
randnIO' :: [Int] -> IO Tensor
randnIO' :: [Int] -> IO Tensor
randnIO' = forall a. ([Int] -> TensorOptions -> a) -> [Int] -> a
mkDefaultFactory [Int] -> TensorOptions -> IO Tensor
randnIO
randintIO' :: Int -> Int -> [Int] -> IO Tensor
randintIO' :: Int -> Int -> [Int] -> IO Tensor
randintIO' Int
low Int
high = forall a. ([Int] -> TensorOptions -> a) -> [Int] -> a
mkDefaultFactory (Int -> Int -> [Int] -> TensorOptions -> IO Tensor
randintIO Int
low Int
high)
randLikeIO' :: Tensor -> IO Tensor
randLikeIO' :: Tensor -> IO Tensor
randLikeIO' Tensor
t = Tensor -> TensorOptions -> IO Tensor
randLikeIO Tensor
t TensorOptions
defaultOpts
bernoulliIO' ::
Tensor ->
IO Tensor
bernoulliIO' :: Tensor -> IO Tensor
bernoulliIO' = forall a ca y cy.
(Castable a ca, Castable y cy) =>
(ca -> IO cy) -> a -> IO y
cast1 ForeignPtr Tensor -> IO (ForeignPtr Tensor)
ATen.bernoulli_t
bernoulliIO ::
Tensor ->
Double ->
IO Tensor
bernoulliIO :: Tensor -> Double -> IO Tensor
bernoulliIO = forall a ca x1 cx1 y cy.
(Castable a ca, Castable x1 cx1, Castable y cy) =>
(ca -> cx1 -> IO cy) -> a -> x1 -> IO y
cast2 ForeignPtr Tensor -> CDouble -> IO (ForeignPtr Tensor)
ATen.bernoulli_td
poissonIO ::
Tensor ->
IO Tensor
poissonIO :: Tensor -> IO Tensor
poissonIO = forall a ca y cy.
(Castable a ca, Castable y cy) =>
(ca -> IO cy) -> a -> IO y
cast1 ForeignPtr Tensor -> IO (ForeignPtr Tensor)
ATen.poisson_t
multinomialIO' ::
Tensor ->
Int ->
IO Tensor
multinomialIO' :: Tensor -> Int -> IO Tensor
multinomialIO' = forall a ca x1 cx1 y cy.
(Castable a ca, Castable x1 cx1, Castable y cy) =>
(ca -> cx1 -> IO cy) -> a -> x1 -> IO y
cast2 ForeignPtr Tensor -> Int64 -> IO (ForeignPtr Tensor)
ATen.multinomial_tl
multinomialIO ::
Tensor ->
Int ->
Bool ->
IO Tensor
multinomialIO :: Tensor -> Int -> Bool -> IO Tensor
multinomialIO = forall a ca x1 cx1 x2 cx2 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable y cy) =>
(ca -> cx1 -> cx2 -> IO cy) -> a -> x1 -> x2 -> IO y
cast3 ForeignPtr Tensor -> Int64 -> CBool -> IO (ForeignPtr Tensor)
ATen.multinomial_tlb
normalIO' ::
Tensor ->
IO Tensor
normalIO' :: Tensor -> IO Tensor
normalIO' = forall a ca y cy.
(Castable a ca, Castable y cy) =>
(ca -> IO cy) -> a -> IO y
cast1 ForeignPtr Tensor -> IO (ForeignPtr Tensor)
ATen.normal_t
normalIO ::
Tensor ->
Tensor ->
IO Tensor
normalIO :: Tensor -> Tensor -> IO Tensor
normalIO = forall a ca x1 cx1 y cy.
(Castable a ca, Castable x1 cx1, Castable y cy) =>
(ca -> cx1 -> IO cy) -> a -> x1 -> IO y
cast2 ForeignPtr Tensor -> ForeignPtr Tensor -> IO (ForeignPtr Tensor)
ATen.normal_tt
normalScalarIO ::
Tensor ->
Double ->
IO Tensor
normalScalarIO :: Tensor -> Double -> IO Tensor
normalScalarIO = forall a ca x1 cx1 y cy.
(Castable a ca, Castable x1 cx1, Castable y cy) =>
(ca -> cx1 -> IO cy) -> a -> x1 -> IO y
cast2 ForeignPtr Tensor -> CDouble -> IO (ForeignPtr Tensor)
ATen.normal_td
normalScalarIO' ::
Double ->
Tensor ->
IO Tensor
normalScalarIO' :: Double -> Tensor -> IO Tensor
normalScalarIO' = forall a ca x1 cx1 y cy.
(Castable a ca, Castable x1 cx1, Castable y cy) =>
(ca -> cx1 -> IO cy) -> a -> x1 -> IO y
cast2 CDouble -> ForeignPtr Tensor -> IO (ForeignPtr Tensor)
ATen.normal_dt
normalWithSizeIO ::
Double ->
Double ->
Int ->
IO Tensor
normalWithSizeIO :: Double -> Double -> Int -> IO Tensor
normalWithSizeIO = forall a ca x1 cx1 x2 cx2 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable y cy) =>
(ca -> cx1 -> cx2 -> IO cy) -> a -> x1 -> x2 -> IO y
cast3 CDouble -> CDouble -> ForeignPtr IntArray -> IO (ForeignPtr Tensor)
ATen.normal_ddl
rreluIO''' ::
Tensor ->
IO Tensor
rreluIO''' :: Tensor -> IO Tensor
rreluIO''' = forall a ca y cy.
(Castable a ca, Castable y cy) =>
(ca -> IO cy) -> a -> IO y
cast1 ForeignPtr Tensor -> IO (ForeignPtr Tensor)
ATen.rrelu_t
rreluIO'' ::
Scalar a =>
Tensor ->
a ->
IO Tensor
rreluIO'' :: forall a. Scalar a => Tensor -> a -> IO Tensor
rreluIO'' = forall a ca x1 cx1 y cy.
(Castable a ca, Castable x1 cx1, Castable y cy) =>
(ca -> cx1 -> IO cy) -> a -> x1 -> IO y
cast2 ForeignPtr Tensor -> ForeignPtr Scalar -> IO (ForeignPtr Tensor)
ATen.rrelu_ts
rreluIO' ::
Scalar a =>
Tensor ->
a ->
a ->
IO Tensor
rreluIO' :: forall a. Scalar a => Tensor -> a -> a -> IO Tensor
rreluIO' = forall a ca x1 cx1 x2 cx2 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable y cy) =>
(ca -> cx1 -> cx2 -> IO cy) -> a -> x1 -> x2 -> IO y
cast3 ForeignPtr Tensor
-> ForeignPtr Scalar -> ForeignPtr Scalar -> IO (ForeignPtr Tensor)
ATen.rrelu_tss
rreluIO ::
Scalar a =>
Tensor ->
a ->
a ->
Bool ->
IO Tensor
rreluIO :: forall a. Scalar a => Tensor -> a -> a -> Bool -> IO Tensor
rreluIO = forall a ca x1 cx1 x2 cx2 x3 cx3 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
Castable y cy) =>
(ca -> cx1 -> cx2 -> cx3 -> IO cy) -> a -> x1 -> x2 -> x3 -> IO y
cast4 ForeignPtr Tensor
-> ForeignPtr Scalar
-> ForeignPtr Scalar
-> CBool
-> IO (ForeignPtr Tensor)
ATen.rrelu_tssb
rreluWithNoiseIO''' ::
Tensor ->
Tensor ->
IO Tensor
rreluWithNoiseIO''' :: Tensor -> Tensor -> IO Tensor
rreluWithNoiseIO''' = forall a ca x1 cx1 y cy.
(Castable a ca, Castable x1 cx1, Castable y cy) =>
(ca -> cx1 -> IO cy) -> a -> x1 -> IO y
cast2 ForeignPtr Tensor -> ForeignPtr Tensor -> IO (ForeignPtr Tensor)
ATen.rrelu_with_noise_tt
rreluWithNoiseIO'' ::
Scalar a =>
Tensor ->
Tensor ->
a ->
IO Tensor
rreluWithNoiseIO'' :: forall a. Scalar a => Tensor -> Tensor -> a -> IO Tensor
rreluWithNoiseIO'' = forall a ca x1 cx1 x2 cx2 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable y cy) =>
(ca -> cx1 -> cx2 -> IO cy) -> a -> x1 -> x2 -> IO y
cast3 ForeignPtr Tensor
-> ForeignPtr Tensor -> ForeignPtr Scalar -> IO (ForeignPtr Tensor)
ATen.rrelu_with_noise_tts
rreluWithNoiseIO' ::
Scalar a =>
Tensor ->
Tensor ->
a ->
a ->
IO Tensor
rreluWithNoiseIO' :: forall a. Scalar a => Tensor -> Tensor -> a -> a -> IO Tensor
rreluWithNoiseIO' = forall a ca x1 cx1 x2 cx2 x3 cx3 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
Castable y cy) =>
(ca -> cx1 -> cx2 -> cx3 -> IO cy) -> a -> x1 -> x2 -> x3 -> IO y
cast4 ForeignPtr Tensor
-> ForeignPtr Tensor
-> ForeignPtr Scalar
-> ForeignPtr Scalar
-> IO (ForeignPtr Tensor)
ATen.rrelu_with_noise_ttss
rreluWithNoiseIO ::
Scalar a =>
Tensor ->
Tensor ->
a ->
a ->
Bool ->
IO Tensor
rreluWithNoiseIO :: forall a.
Scalar a =>
Tensor -> Tensor -> a -> a -> Bool -> IO Tensor
rreluWithNoiseIO = forall a ca x1 cx1 x2 cx2 x3 cx3 x4 cx4 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
Castable x4 cx4, Castable y cy) =>
(ca -> cx1 -> cx2 -> cx3 -> cx4 -> IO cy)
-> a -> x1 -> x2 -> x3 -> x4 -> IO y
cast5 ForeignPtr Tensor
-> ForeignPtr Tensor
-> ForeignPtr Scalar
-> ForeignPtr Scalar
-> CBool
-> IO (ForeignPtr Tensor)
ATen.rrelu_with_noise_ttssb
onesWithDimnames' :: [(Int, Dimname)] -> Tensor
onesWithDimnames' :: [(Int, Dimname)] -> Tensor
onesWithDimnames' = forall a.
([(Int, Dimname)] -> TensorOptions -> a) -> [(Int, Dimname)] -> a
mkDefaultFactoryWithDimnames [(Int, Dimname)] -> TensorOptions -> Tensor
onesWithDimnames
zerosWithDimnames' :: [(Int, Dimname)] -> Tensor
zerosWithDimnames' :: [(Int, Dimname)] -> Tensor
zerosWithDimnames' = forall a.
([(Int, Dimname)] -> TensorOptions -> a) -> [(Int, Dimname)] -> a
mkDefaultFactoryWithDimnames [(Int, Dimname)] -> TensorOptions -> Tensor
zerosWithDimnames
randWithDimnames' :: [(Int, Dimname)] -> IO Tensor
randWithDimnames' :: [(Int, Dimname)] -> IO Tensor
randWithDimnames' = forall a.
([(Int, Dimname)] -> TensorOptions -> a) -> [(Int, Dimname)] -> a
mkDefaultFactoryWithDimnames [(Int, Dimname)] -> TensorOptions -> IO Tensor
randWithDimnames
randnWithDimnames' :: [(Int, Dimname)] -> IO Tensor
randnWithDimnames' :: [(Int, Dimname)] -> IO Tensor
randnWithDimnames' = forall a.
([(Int, Dimname)] -> TensorOptions -> a) -> [(Int, Dimname)] -> a
mkDefaultFactoryWithDimnames [(Int, Dimname)] -> TensorOptions -> IO Tensor
randnWithDimnames
linspace' :: (Scalar a, Scalar b) => a -> b -> Int -> Tensor
linspace' :: forall a b. (Scalar a, Scalar b) => a -> b -> Int -> Tensor
linspace' a
start b
end Int
steps = forall a b.
(Scalar a, Scalar b) =>
a -> b -> Int -> TensorOptions -> Tensor
linspace a
start b
end Int
steps TensorOptions
defaultOpts
logspace' :: (Scalar a, Scalar b) => a -> b -> Int -> Double -> Tensor
logspace' :: forall a b.
(Scalar a, Scalar b) =>
a -> b -> Int -> Double -> Tensor
logspace' a
start b
end Int
steps Double
base = forall a b.
(Scalar a, Scalar b) =>
a -> b -> Int -> Double -> TensorOptions -> Tensor
logspace a
start b
end Int
steps Double
base TensorOptions
defaultOpts
eyeSquare' :: Int -> Tensor
eyeSquare' :: Int -> Tensor
eyeSquare' Int
dim = Int -> TensorOptions -> Tensor
eyeSquare Int
dim TensorOptions
defaultOpts
eye' :: Int -> Int -> Tensor
eye' :: Int -> Int -> Tensor
eye' Int
nrows Int
ncols = Int -> Int -> TensorOptions -> Tensor
eye Int
nrows Int
ncols TensorOptions
defaultOpts
full' :: Scalar a => [Int] -> a -> Tensor
full' :: forall a. Scalar a => [Int] -> a -> Tensor
full' [Int]
shape a
value = forall a. Scalar a => [Int] -> a -> TensorOptions -> Tensor
full [Int]
shape a
value TensorOptions
defaultOpts
sparseCooTensor' :: Tensor -> Tensor -> [Int] -> Tensor
sparseCooTensor' :: Tensor -> Tensor -> [Int] -> Tensor
sparseCooTensor' Tensor
indices Tensor
values [Int]
size = Tensor -> Tensor -> [Int] -> TensorOptions -> Tensor
sparseCooTensor Tensor
indices Tensor
values [Int]
size TensorOptions
defaultOpts
arange ::
Int ->
Int ->
Int ->
TensorOptions ->
Tensor
arange :: Int -> Int -> Int -> TensorOptions -> Tensor
arange Int
s Int
e Int
ss TensorOptions
o = forall a. IO a -> a
unsafePerformIO forall a b. (a -> b) -> a -> b
$ (forall a ca x1 cx1 x2 cx2 x3 cx3 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
Castable y cy) =>
(ca -> cx1 -> cx2 -> cx3 -> IO cy) -> a -> x1 -> x2 -> x3 -> IO y
cast4 ForeignPtr Scalar
-> ForeignPtr Scalar
-> ForeignPtr Scalar
-> ForeignPtr TensorOptions
-> IO (ForeignPtr Tensor)
ATen.arange_ssso) Int
s Int
e Int
ss TensorOptions
o
arange' ::
Int ->
Int ->
Int ->
Tensor
arange' :: Int -> Int -> Int -> Tensor
arange' Int
s Int
e Int
ss = Int -> Int -> Int -> TensorOptions -> Tensor
arange Int
s Int
e Int
ss TensorOptions
defaultOpts