module Torch.Indef.Static.Tensor.Math.Pointwise.Signed where
import Torch.Indef.Types
import Torch.Indef.Static.Tensor
import Torch.Indef.Static.Tensor.Math (constant)
import Torch.Indef.Static.Tensor.Math.Pointwise (sign, (^*^), (^-^), (^+^))
import qualified Torch.Indef.Dynamic.Tensor.Math.Pointwise.Signed as Dynamic
import Numeric.Dimensions
import System.IO.Unsafe
abs_ :: Tensor d -> IO ()
abs_ t = Dynamic.abs_ (asDynamic t)
neg_ :: Tensor d -> IO ()
neg_ t = Dynamic.neg_ (asDynamic t)
neg :: Dimensions d => Tensor d -> Tensor d
neg t = asStatic $ Dynamic.neg (asDynamic t)
abs :: Dimensions d => Tensor d -> Tensor d
abs t = asStatic $ Dynamic.abs (asDynamic t)
instance Dimensions d => Num (Tensor d) where
(+) = (^+^)
(-) = (^-^)
(*) = (^*^)
abs = Torch.Indef.Static.Tensor.Math.Pointwise.Signed.abs
signum = sign
fromInteger = constant . fromIntegral