module Num
Extended Modules
Defined in:
linalg/work.crnum.cr
tensor/backends/agnostic/impl_index.cr
tensor/backends/agnostic/impl_manipulate.cr
tensor/backends/arrow/impl_allocation.cr
tensor/backends/arrow/impl_convert.cr
tensor/backends/arrow/impl_data_structure.cr
tensor/backends/arrow/impl_index.cr
tensor/backends/arrow/impl_iteration.cr
tensor/backends/arrow/impl_manipulate.cr
tensor/backends/arrow/impl_math.cr
tensor/backends/arrow/impl_reduction.cr
tensor/backends/cpu/impl_allocation.cr
tensor/backends/cpu/impl_convert.cr
tensor/backends/cpu/impl_data_structure.cr
tensor/backends/cpu/impl_index.cr
tensor/backends/cpu/impl_iteration.cr
tensor/backends/cpu/impl_manipulate.cr
tensor/backends/cpu/impl_math.cr
tensor/backends/cpu/impl_reduction.cr
tensor/backends/opencl/impl_convert.cr
tensor/backends/opencl/impl_data_structure.cr
tensor/backends/opencl/impl_index.cr
tensor/backends/opencl/impl_iteration.cr
tensor/backends/opencl/impl_manipulate.cr
tensor/backends/opencl/impl_math.cr
tensor/backends/opencl/impl_reduction.cr
tensor/backends/opencl/kernels/base.cr
tensor/backends/opencl/kernels/templates.cr
tensor/internal/enums.cr
tensor/internal/shape.cr
Constant Summary
-
ColMajor =
OrderType::ColMajor
-
RowMajor =
OrderType::RowMajor
-
VERSION =
"0.5.0"
Instance Method Summary
- #acos(a : Tensor(U, CPU(U))) : Tensor forall U
-
#acos(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function acos for a single
Tensor
. - #acos(a : Tensor(U, ARROW(U))) : Tensor forall U
- #acos!(a : Tensor(U, CPU(U))) : Nil forall U
-
#acos!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function acos for a single
Tensor
. - #acos!(a : Tensor(U, ARROW(U))) : Nil forall U
- #acosh(a : Tensor(U, CPU(U))) : Tensor forall U
-
#acosh(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function acosh for a single
Tensor
. - #acosh(a : Tensor(U, ARROW(U))) : Tensor forall U
- #acosh!(a : Tensor(U, CPU(U))) : Nil forall U
-
#acosh!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function acosh for a single
Tensor
. - #acosh!(a : Tensor(U, ARROW(U))) : Nil forall U
-
#acospi(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function acospi for a single
Tensor
. -
#acospi!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function acospi for a single
Tensor
. -
#add(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Tensor forall U, V
Implements the :+ operator between two
Tensor
s. -
#add(a : Tensor(U, CPU(U)), b : Number | Complex) : Tensor forall U
Implements the :+ operator between a
Tensor
and scalar. -
#add(a : Number | Complex, b : Tensor(U, CPU(U))) : Tensor forall U
Implements the :+ operator between a scalar and
Tensor
. -
#add(a : Tensor(U, OCL(U)), b : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Add two
Tensor
s elementwise - #add(a : Tensor(U, OCL(U)), b : U) : Tensor(U, OCL(U)) forall U
- #add(a : U, b : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
-
#add(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Tensor forall U, V
Implements the :+ operator between two
Tensor
s. -
#add(a : Tensor(U, ARROW(U)), b : Number) : Tensor forall U
Implements the :+ operator between a
Tensor
and scalar. -
#add(a : Number, b : Tensor(U, ARROW(U))) : Tensor forall U
Implements the :+ operator between a scalar and
Tensor
. -
#add!(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Nil forall U, V
Implements the :+ operator between two
Tensor
s. -
#add!(a : Tensor(U, CPU(U)), b : Number | Complex) : Nil forall U
Implements the :+ operator between a
Tensor
and scalar. -
#add!(a : Tensor(U, OCL(U)), b : Tensor(U, OCL(U))) : Nil forall U
"Add" two
Tensor
s elementwise, storing the result in the first Tensor - #add!(a : Tensor(U, OCL(U)), b : U) : Nil forall U
-
#add!(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Nil forall U, V
Implements the :+ operator between two
Tensor
s. -
#add!(a : Tensor(U, ARROW(U)), b : Number) : Nil forall U
Implements the :+ operator between a
Tensor
and scalar. - #all(a : Tensor(U, CPU(U)), axis : Int, dims : Bool = false) forall U
- #all(a : Tensor(U, ARROW(U)), axis : Int, dims : Bool = false) forall U
-
#all(a : Tensor(U, CPU(U))) forall U
Reduces a
Tensor
to a boolean by asserting the truthiness of all elements -
#all(a : Tensor(U, ARROW(U))) forall U
Reduces a
Tensor
to a boolean by asserting the truthiness of all elements -
#all_close(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V)), epsilon = 1e-6) : Bool forall U, V
Asserts that two
Tensor
s are equal, allowing for small margins of errors with floating point values using an EPSILON value. -
#all_close(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V)), epsilon = 1e-6) : Bool forall U, V
Asserts that two
Tensor
s are equal, allowing for small margins of errors with floating point values using an EPSILON value. - #any(a : Tensor(U, CPU(U)), axis : Int, dims : Bool = false) forall U
- #any(a : Tensor(U, ARROW(U)), axis : Int, dims : Bool = false) forall U
-
#any(a : Tensor(U, CPU(U))) forall U
Reduces a
Tensor
to a boolean by asserting the truthiness of any element -
#any(a : Tensor(U, ARROW(U))) forall U
Reduces a
Tensor
to a boolean by asserting the truthiness of any element -
#argmax(a : Tensor(U, CPU(U)), axis : Int, dims : Bool = false) forall U
Find the maximum index value of a Tensor along an axis
-
#argmax(a : Tensor(U, ARROW(U)), axis : Int, dims : Bool = false) forall U
Find the maximum index value of a Tensor along an axis
-
#argmax(a : Tensor(U, CPU(U))) : Int32 forall U
Find the maximum index value of a Tensor
-
#argmax(a : Tensor(U, ARROW(U))) : Int32 forall U
Find the maximum index value of a Tensor
-
#argmin(a : Tensor(U, CPU(U)), axis : Int, dims : Bool = false) forall U
Find the minimum index value of a Tensor along an axis
-
#argmin(a : Tensor(U, ARROW(U)), axis : Int, dims : Bool = false) forall U
Find the minimum index value of a Tensor along an axis
-
#argmin(a : Tensor(U, CPU(U))) : Int32 forall U
Find the minimum index value of a Tensor
-
#argmin(a : Tensor(U, ARROW(U))) : Int32 forall U
Find the minimum index value of a Tensor
- #array_split(a : Tensor(U, CPU(U)), ind : Int, axis : Int = 0) : Array(Tensor(U, CPU(U))) forall U
- #array_split(a : Tensor(U, CPU(U)), ind : Array(Int), axis : Int = 0) : Array(Tensor(U, CPU(U))) forall U
- #array_split(a : Tensor(U, ARROW(U)), ind : Int, axis : Int = 0) : Array(Tensor(U, ARROW(U))) forall U
- #array_split(a : Tensor(U, ARROW(U)), ind : Array(Int), axis : Int = 0) : Array(Tensor(U, ARROW(U))) forall U
-
#as_strided(arr : Tensor(U, V), shape : Array(Int), strides : Array(Int)) : Tensor(U, V) forall U, V
#as_strided
creates a view into theTensor
given the exact strides and shape. -
#as_tensor(value : Number, like : Tensor(U, V) | Tensor(U, V).class) forall U, V
Convert a scalar value to a
Tensor
like the one specified, matching the data type and target compute. -
#as_type(arr : Tensor(U, CPU(U)), dtype : V.class) forall U, V
Casts a
Tensor
to a new dtype, by making a copy. -
#as_type(arr : Tensor(U, ARROW(U)), dtype : V.class) forall U, V
Casts a
Tensor
to a new dtype, by making a copy. - #asin(a : Tensor(U, CPU(U))) : Tensor forall U
-
#asin(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function asin for a single
Tensor
. - #asin(a : Tensor(U, ARROW(U))) : Tensor forall U
- #asin!(a : Tensor(U, CPU(U))) : Nil forall U
-
#asin!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function asin for a single
Tensor
. - #asin!(a : Tensor(U, ARROW(U))) : Nil forall U
- #asinh(a : Tensor(U, CPU(U))) : Tensor forall U
-
#asinh(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function asinh for a single
Tensor
. - #asinh(a : Tensor(U, ARROW(U))) : Tensor forall U
- #asinh!(a : Tensor(U, CPU(U))) : Nil forall U
-
#asinh!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function asinh for a single
Tensor
. - #asinh!(a : Tensor(U, ARROW(U))) : Nil forall U
-
#asinpi(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function asinpi for a single
Tensor
. -
#asinpi!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function asinpi for a single
Tensor
. - #atan(a : Tensor(U, CPU(U))) : Tensor forall U
-
#atan(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function atan for a single
Tensor
. - #atan(a : Tensor(U, ARROW(U))) : Tensor forall U
- #atan!(a : Tensor(U, CPU(U))) : Nil forall U
-
#atan!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function atan for a single
Tensor
. - #atan!(a : Tensor(U, ARROW(U))) : Nil forall U
- #atan2(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Tensor forall U, V
- #atan2(a : Tensor(U, CPU(U)), b : Number) : Tensor forall U
- #atan2(a : Number, b : Tensor(U, CPU(U))) : Tensor forall U
-
#atan2(a : Tensor(U, OCL(U)), b : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function atan2 between two
Tensor
s - #atan2(a : Tensor(U, OCL(U)), b : U) : Tensor(U, OCL(U)) forall U
- #atan2(a : U, b : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
- #atan2(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Tensor forall U, V
- #atan2(a : Tensor(U, ARROW(U)), b : Number) : Tensor forall U
- #atan2(a : Number, b : Tensor(U, ARROW(U))) : Tensor forall U
- #atan2!(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Nil forall U, V
- #atan2!(a : Tensor(U, CPU(U)), b : Number) : Nil forall U
- #atan2!(a : Tensor(U, OCL(U)), b : Tensor(U, OCL(U))) : Nil forall U
- #atan2!(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Nil forall U, V
- #atan2!(a : Tensor(U, ARROW(U)), b : Number) : Nil forall U
- #atanh(a : Tensor(U, CPU(U))) : Tensor forall U
-
#atanh(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function atanh for a single
Tensor
. - #atanh(a : Tensor(U, ARROW(U))) : Tensor forall U
- #atanh!(a : Tensor(U, CPU(U))) : Nil forall U
-
#atanh!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function atanh for a single
Tensor
. - #atanh!(a : Tensor(U, ARROW(U))) : Nil forall U
-
#atanpi(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function atanpi for a single
Tensor
. -
#atanpi!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function atanpi for a single
Tensor
. - #besselj(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Tensor forall U, V
- #besselj(a : Tensor(U, CPU(U)), b : Number) : Tensor forall U
- #besselj(a : Number, b : Tensor(U, CPU(U))) : Tensor forall U
- #besselj(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Tensor forall U, V
- #besselj(a : Tensor(U, ARROW(U)), b : Number) : Tensor forall U
- #besselj(a : Number, b : Tensor(U, ARROW(U))) : Tensor forall U
- #besselj!(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Nil forall U, V
- #besselj!(a : Tensor(U, CPU(U)), b : Number) : Nil forall U
- #besselj!(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Nil forall U, V
- #besselj!(a : Tensor(U, ARROW(U)), b : Number) : Nil forall U
- #besselj0(a : Tensor(U, CPU(U))) : Tensor forall U
- #besselj0(a : Tensor(U, ARROW(U))) : Tensor forall U
- #besselj0!(a : Tensor(U, CPU(U))) : Nil forall U
- #besselj0!(a : Tensor(U, ARROW(U))) : Nil forall U
- #besselj1(a : Tensor(U, CPU(U))) : Tensor forall U
- #besselj1(a : Tensor(U, ARROW(U))) : Tensor forall U
- #besselj1!(a : Tensor(U, CPU(U))) : Nil forall U
- #besselj1!(a : Tensor(U, ARROW(U))) : Nil forall U
- #bessely(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Tensor forall U, V
- #bessely(a : Tensor(U, CPU(U)), b : Number) : Tensor forall U
- #bessely(a : Number, b : Tensor(U, CPU(U))) : Tensor forall U
- #bessely(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Tensor forall U, V
- #bessely(a : Tensor(U, ARROW(U)), b : Number) : Tensor forall U
- #bessely(a : Number, b : Tensor(U, ARROW(U))) : Tensor forall U
- #bessely!(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Nil forall U, V
- #bessely!(a : Tensor(U, CPU(U)), b : Number) : Nil forall U
- #bessely!(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Nil forall U, V
- #bessely!(a : Tensor(U, ARROW(U)), b : Number) : Nil forall U
- #bessely0(a : Tensor(U, CPU(U))) : Tensor forall U
- #bessely0(a : Tensor(U, ARROW(U))) : Tensor forall U
- #bessely0!(a : Tensor(U, CPU(U))) : Nil forall U
- #bessely0!(a : Tensor(U, ARROW(U))) : Nil forall U
- #bessely1(a : Tensor(U, CPU(U))) : Tensor forall U
- #bessely1(a : Tensor(U, ARROW(U))) : Tensor forall U
- #bessely1!(a : Tensor(U, CPU(U))) : Nil forall U
- #bessely1!(a : Tensor(U, ARROW(U))) : Nil forall U
-
#bitwise_and(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Tensor forall U, V
Implements the :& operator between two
Tensor
s. -
#bitwise_and(a : Tensor(U, CPU(U)), b : Number | Complex) : Tensor forall U
Implements the :& operator between a
Tensor
and scalar. -
#bitwise_and(a : Number | Complex, b : Tensor(U, CPU(U))) : Tensor forall U
Implements the :& operator between a scalar and
Tensor
. -
#bitwise_and(a : Tensor(U, OCL(U)), b : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the bitwise operator "&" between two
Tensor
s. - #bitwise_and(a : Tensor(U, OCL(U)), b : U) : Tensor(U, OCL(U)) forall U
- #bitwise_and(a : U, b : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
-
#bitwise_and(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Tensor forall U, V
Implements the :& operator between two
Tensor
s. -
#bitwise_and(a : Tensor(U, ARROW(U)), b : Number) : Tensor forall U
Implements the :& operator between a
Tensor
and scalar. -
#bitwise_and(a : Number, b : Tensor(U, ARROW(U))) : Tensor forall U
Implements the :& operator between a scalar and
Tensor
. -
#bitwise_and!(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Nil forall U, V
Implements the :& operator between two
Tensor
s. -
#bitwise_and!(a : Tensor(U, CPU(U)), b : Number | Complex) : Nil forall U
Implements the :& operator between a
Tensor
and scalar. -
#bitwise_and!(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Nil forall U, V
Implements the :& operator between two
Tensor
s. -
#bitwise_and!(a : Tensor(U, ARROW(U)), b : Number) : Nil forall U
Implements the :& operator between a
Tensor
and scalar. -
#bitwise_or(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Tensor forall U, V
Implements the :| operator between two
Tensor
s. -
#bitwise_or(a : Tensor(U, CPU(U)), b : Number | Complex) : Tensor forall U
Implements the :| operator between a
Tensor
and scalar. -
#bitwise_or(a : Number | Complex, b : Tensor(U, CPU(U))) : Tensor forall U
Implements the :| operator between a scalar and
Tensor
. -
#bitwise_or(a : Tensor(U, OCL(U)), b : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the bitwise operator "|" between two
Tensor
s. - #bitwise_or(a : Tensor(U, OCL(U)), b : U) : Tensor(U, OCL(U)) forall U
- #bitwise_or(a : U, b : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
-
#bitwise_or(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Tensor forall U, V
Implements the :| operator between two
Tensor
s. -
#bitwise_or(a : Tensor(U, ARROW(U)), b : Number) : Tensor forall U
Implements the :| operator between a
Tensor
and scalar. -
#bitwise_or(a : Number, b : Tensor(U, ARROW(U))) : Tensor forall U
Implements the :| operator between a scalar and
Tensor
. -
#bitwise_or!(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Nil forall U, V
Implements the :| operator between two
Tensor
s. -
#bitwise_or!(a : Tensor(U, CPU(U)), b : Number | Complex) : Nil forall U
Implements the :| operator between a
Tensor
and scalar. -
#bitwise_or!(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Nil forall U, V
Implements the :| operator between two
Tensor
s. -
#bitwise_or!(a : Tensor(U, ARROW(U)), b : Number) : Nil forall U
Implements the :| operator between a
Tensor
and scalar. -
#bitwise_xor(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Tensor forall U, V
Implements the :^ operator between two
Tensor
s. -
#bitwise_xor(a : Tensor(U, CPU(U)), b : Number | Complex) : Tensor forall U
Implements the :^ operator between a
Tensor
and scalar. -
#bitwise_xor(a : Number | Complex, b : Tensor(U, CPU(U))) : Tensor forall U
Implements the :^ operator between a scalar and
Tensor
. -
#bitwise_xor(a : Tensor(U, OCL(U)), b : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the bitwise operator "^" between two
Tensor
s. - #bitwise_xor(a : Tensor(U, OCL(U)), b : U) : Tensor(U, OCL(U)) forall U
- #bitwise_xor(a : U, b : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
-
#bitwise_xor(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Tensor forall U, V
Implements the :^ operator between two
Tensor
s. -
#bitwise_xor(a : Tensor(U, ARROW(U)), b : Number) : Tensor forall U
Implements the :^ operator between a
Tensor
and scalar. -
#bitwise_xor(a : Number, b : Tensor(U, ARROW(U))) : Tensor forall U
Implements the :^ operator between a scalar and
Tensor
. -
#bitwise_xor!(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Nil forall U, V
Implements the :^ operator between two
Tensor
s. -
#bitwise_xor!(a : Tensor(U, CPU(U)), b : Number | Complex) : Nil forall U
Implements the :^ operator between a
Tensor
and scalar. -
#bitwise_xor!(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Nil forall U, V
Implements the :^ operator between two
Tensor
s. -
#bitwise_xor!(a : Tensor(U, ARROW(U)), b : Number) : Nil forall U
Implements the :^ operator between a
Tensor
and scalar. -
#broadcast(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V)), c : Tensor(W, CPU(W))) forall U, V, W
Broadcasts two
Tensor
's' to a new shape. -
#broadcast(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V)), c : Tensor(W, ARROW(W))) forall U, V, W
Broadcasts two
Tensor
's' to a new shape. -
#broadcast(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) forall U, V
Broadcasts two
Tensor
's' to a new shape. -
#broadcast(a : Tensor(U, OCL(U)), b : Tensor(V, OCL(V))) forall U, V
Broadcasts two
Tensor
's' to a new shape. -
#broadcast(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) forall U, V
Broadcasts two
Tensor
's' to a new shape. -
#broadcast_to(arr : Tensor(U, V), shape : Array(Int)) forall U, V
Broadcasts a
Tensor
to a new shape. - #cbrt(a : Tensor(U, CPU(U))) : Tensor forall U
-
#cbrt(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function cbrt for a single
Tensor
. - #cbrt(a : Tensor(U, ARROW(U))) : Tensor forall U
- #cbrt!(a : Tensor(U, CPU(U))) : Nil forall U
-
#cbrt!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function cbrt for a single
Tensor
. - #cbrt!(a : Tensor(U, ARROW(U))) : Nil forall U
-
#ceil(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function ceil for a single
Tensor
. -
#ceil!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function ceil for a single
Tensor
. -
#concatenate(arrs : Array(Tensor(U, V)), axis : Int) forall U, V
Join a sequence of
Tensor
s along an existing axis. -
#concatenate(*arrs : Tensor(U, V), axis : Int) forall U, V
Join a sequence of
Tensor
s along an existing axis. - #copysign(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Tensor forall U, V
- #copysign(a : Tensor(U, CPU(U)), b : Number) : Tensor forall U
- #copysign(a : Number, b : Tensor(U, CPU(U))) : Tensor forall U
- #copysign(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Tensor forall U, V
- #copysign(a : Tensor(U, ARROW(U)), b : Number) : Tensor forall U
- #copysign(a : Number, b : Tensor(U, ARROW(U))) : Tensor forall U
- #copysign!(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Nil forall U, V
- #copysign!(a : Tensor(U, CPU(U)), b : Number) : Nil forall U
- #copysign!(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Nil forall U, V
- #copysign!(a : Tensor(U, ARROW(U)), b : Number) : Nil forall U
- #cos(a : Tensor(U, CPU(U))) : Tensor forall U
-
#cos(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function cos for a single
Tensor
. - #cos(a : Tensor(U, ARROW(U))) : Tensor forall U
- #cos!(a : Tensor(U, CPU(U))) : Nil forall U
-
#cos!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function cos for a single
Tensor
. - #cos!(a : Tensor(U, ARROW(U))) : Nil forall U
- #cosh(a : Tensor(U, CPU(U))) : Tensor forall U
-
#cosh(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function cosh for a single
Tensor
. - #cosh(a : Tensor(U, ARROW(U))) : Tensor forall U
- #cosh!(a : Tensor(U, CPU(U))) : Nil forall U
-
#cosh!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function cosh for a single
Tensor
. - #cosh!(a : Tensor(U, ARROW(U))) : Nil forall U
-
#cospi(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function cospi for a single
Tensor
. -
#cospi!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function cospi for a single
Tensor
. -
#cpu(arr : Tensor(U, CPU(U))) forall U
Converts a CPU
Tensor
to CPU. - #cpu(arr : Tensor(U, OCL(U))) forall U
-
#cpu(arr : Tensor(U, ARROW(U))) forall U
Converts a ARROW
Tensor
to CPU. -
#diagonal(arr : Tensor(U, CPU(U))) forall U
Returns a view of the diagonal of a
Tensor
. -
#diagonal(arr : Tensor(U, ARROW(U))) forall U
Returns a view of the diagonal of a
Tensor
. -
#divide(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Tensor forall U, V
Implements the :/ operator between two
Tensor
s. -
#divide(a : Tensor(U, CPU(U)), b : Number | Complex) : Tensor forall U
Implements the :/ operator between a
Tensor
and scalar. -
#divide(a : Number | Complex, b : Tensor(U, CPU(U))) : Tensor forall U
Implements the :/ operator between a scalar and
Tensor
. -
#divide(a : Tensor(U, OCL(U)), b : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Divide two
Tensor
s elementwise - #divide(a : Tensor(U, OCL(U)), b : U) : Tensor(U, OCL(U)) forall U
- #divide(a : U, b : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
-
#divide(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Tensor forall U, V
Implements the :/ operator between two
Tensor
s. -
#divide(a : Tensor(U, ARROW(U)), b : Number) : Tensor forall U
Implements the :/ operator between a
Tensor
and scalar. -
#divide(a : Number, b : Tensor(U, ARROW(U))) : Tensor forall U
Implements the :/ operator between a scalar and
Tensor
. -
#divide!(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Nil forall U, V
Implements the :/ operator between two
Tensor
s. -
#divide!(a : Tensor(U, CPU(U)), b : Number | Complex) : Nil forall U
Implements the :/ operator between a
Tensor
and scalar. -
#divide!(a : Tensor(U, OCL(U)), b : Tensor(U, OCL(U))) : Nil forall U
"Divide" two
Tensor
s elementwise, storing the result in the first Tensor - #divide!(a : Tensor(U, OCL(U)), b : U) : Nil forall U
-
#divide!(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Nil forall U, V
Implements the :/ operator between two
Tensor
s. -
#divide!(a : Tensor(U, ARROW(U)), b : Number) : Nil forall U
Implements the :/ operator between a
Tensor
and scalar. -
#dup(t : Tensor(U, CPU(U)), order : Num::OrderType = Num::RowMajor) forall U
Deep-copies a
Tensor
. -
#dup(t : Tensor(U, ARROW(U)), order : Num::OrderType = Num::RowMajor) forall U
Deep-copies a
Tensor
. - #each(arr : Tensor(U, CPU(U)), &block : U -> _) forall U
- #each(arr : Tensor(U, CPU(U))) forall U
- #each(arr : Tensor(U, ARROW(U)), &block : U -> _) forall U
- #each(arr : Tensor(U, ARROW(U))) forall U
-
#each_axis(a0 : Tensor(U, CPU(U)), axis : Int, dims : Bool = false, &block : Tensor(U, CPU(U)) -> _) forall U
Yields a view of each lane of an
axis
. -
#each_axis(arr : Tensor(U, CPU(U)), axis : Int, dims : Bool = false) forall U
Returns an iterator along each element of an
axis
. -
#each_axis(a0 : Tensor(U, OCL(U)), axis : Int, dims : Bool = false, &block : Tensor(U, OCL(U)) -> _) forall U
Yields a view of each lane of an
axis
. -
#each_axis(a0 : Tensor(U, ARROW(U)), axis : Int, dims : Bool = false, &block : Tensor(U, ARROW(U)) -> _) forall U
Yields a view of each lane of an
axis
. -
#each_axis(arr : Tensor(U, ARROW(U)), axis : Int, dims : Bool = false) forall U
Returns an iterator along each element of an
axis
. - #each_pointer(arr : Tensor(U, CPU(U)), &block : Pointer(U) -> _) forall U
- #each_pointer(arr : Tensor(U, ARROW(U)), &block : Pointer(U) -> _) forall U
- #each_pointer_with_index(arr : Tensor(U, CPU(U)), &block : Pointer(U), Int32 -> _) forall U
- #each_pointer_with_index(arr : Tensor(U, ARROW(U)), &block : Pointer(U), Int32 -> _) forall U
- #each_with_index(arr : Tensor(U, CPU(U)), &block : U, Int32 -> _) forall U
- #each_with_index(arr : Tensor(U, ARROW(U)), &block : U, Int32 -> _) forall U
-
#equal(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Tensor forall U, V
Implements the :== operator between two
Tensor
s. -
#equal(a : Tensor(U, CPU(U)), b : Number | Complex) : Tensor forall U
Implements the :== operator between a
Tensor
and scalar. -
#equal(a : Number | Complex, b : Tensor(U, CPU(U))) : Tensor forall U
Implements the :== operator between a scalar and
Tensor
. -
#equal(a : Tensor(U, OCL(U)), b : Tensor(U, OCL(U))) : Tensor(Int32, OCL(Int32)) forall U
Implements the comparison operator "==" between two
Tensor
s. - #equal(a : Tensor(U, OCL(U)), b : U) : Tensor(Int32, OCL(Int32)) forall U
- #equal(a : U, b : Tensor(U, OCL(U))) : Tensor(Int32, OCL(Int32)) forall U
-
#equal(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Tensor forall U, V
Implements the :== operator between two
Tensor
s. -
#equal(a : Tensor(U, ARROW(U)), b : Number) : Tensor forall U
Implements the :== operator between a
Tensor
and scalar. -
#equal(a : Number, b : Tensor(U, ARROW(U))) : Tensor forall U
Implements the :== operator between a scalar and
Tensor
. -
#equal!(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Nil forall U, V
Implements the :== operator between two
Tensor
s. -
#equal!(a : Tensor(U, CPU(U)), b : Number | Complex) : Nil forall U
Implements the :== operator between a
Tensor
and scalar. -
#equal!(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Nil forall U, V
Implements the :== operator between two
Tensor
s. -
#equal!(a : Tensor(U, ARROW(U)), b : Number) : Nil forall U
Implements the :== operator between a
Tensor
and scalar. - #erf(a : Tensor(U, CPU(U))) : Tensor forall U
-
#erf(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function erf for a single
Tensor
. - #erf(a : Tensor(U, ARROW(U))) : Tensor forall U
- #erf!(a : Tensor(U, CPU(U))) : Nil forall U
-
#erf!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function erf for a single
Tensor
. - #erf!(a : Tensor(U, ARROW(U))) : Nil forall U
- #erfc(a : Tensor(U, CPU(U))) : Tensor forall U
-
#erfc(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function erfc for a single
Tensor
. - #erfc(a : Tensor(U, ARROW(U))) : Tensor forall U
- #erfc!(a : Tensor(U, CPU(U))) : Nil forall U
-
#erfc!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function erfc for a single
Tensor
. - #erfc!(a : Tensor(U, ARROW(U))) : Nil forall U
- #exp(a : Tensor(U, CPU(U))) : Tensor forall U
-
#exp(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function exp for a single
Tensor
. - #exp(a : Tensor(U, ARROW(U))) : Tensor forall U
- #exp!(a : Tensor(U, CPU(U))) : Nil forall U
-
#exp!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function exp for a single
Tensor
. - #exp!(a : Tensor(U, ARROW(U))) : Nil forall U
-
#exp10(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function exp10 for a single
Tensor
. -
#exp10!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function exp10 for a single
Tensor
. - #exp2(a : Tensor(U, CPU(U))) : Tensor forall U
-
#exp2(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function exp2 for a single
Tensor
. - #exp2(a : Tensor(U, ARROW(U))) : Tensor forall U
- #exp2!(a : Tensor(U, CPU(U))) : Nil forall U
-
#exp2!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function exp2 for a single
Tensor
. - #exp2!(a : Tensor(U, ARROW(U))) : Nil forall U
-
#expand_dims(arr : Tensor(U, V), axis : Int) : Tensor(U, V) forall U, V
Expands a
Tensor
along anaxis
- #expm1(a : Tensor(U, CPU(U))) : Tensor forall U
-
#expm1(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function expm1 for a single
Tensor
. - #expm1(a : Tensor(U, ARROW(U))) : Tensor forall U
- #expm1!(a : Tensor(U, CPU(U))) : Nil forall U
-
#expm1!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function expm1 for a single
Tensor
. - #expm1!(a : Tensor(U, ARROW(U))) : Nil forall U
-
#fabs(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function fabs for a single
Tensor
. -
#fabs!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function fabs for a single
Tensor
. -
#flat(arr : Tensor(U, CPU(U))) forall U
Flattens a
Tensor
to a single dimension. -
#flat(arr : Tensor(U, ARROW(U))) forall U
Flattens a
Tensor
to a single dimension. -
#flip(a : Tensor(U, CPU(U)), axis : Int) forall U
Flips a
Tensor
along an axis, returning a view -
#flip(a : Tensor(U, ARROW(U)), axis : Int) forall U
Flips a
Tensor
along an axis, returning a view -
#flip(a : Tensor(U, CPU(U))) forall U
Flips a
Tensor
along all axes, returning a view -
#flip(a : Tensor(U, ARROW(U))) forall U
Flips a
Tensor
along all axes, returning a view -
#floor(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function floor for a single
Tensor
. -
#floor!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function floor for a single
Tensor
. -
#floordiv(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Tensor forall U, V
Implements the :// operator between two
Tensor
s. -
#floordiv(a : Tensor(U, CPU(U)), b : Number | Complex) : Tensor forall U
Implements the :// operator between a
Tensor
and scalar. -
#floordiv(a : Number | Complex, b : Tensor(U, CPU(U))) : Tensor forall U
Implements the :// operator between a scalar and
Tensor
. -
#floordiv(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Tensor forall U, V
Implements the :// operator between two
Tensor
s. -
#floordiv(a : Tensor(U, ARROW(U)), b : Number) : Tensor forall U
Implements the :// operator between a
Tensor
and scalar. -
#floordiv(a : Number, b : Tensor(U, ARROW(U))) : Tensor forall U
Implements the :// operator between a scalar and
Tensor
. -
#floordiv!(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Nil forall U, V
Implements the :// operator between two
Tensor
s. -
#floordiv!(a : Tensor(U, CPU(U)), b : Number | Complex) : Nil forall U
Implements the :// operator between a
Tensor
and scalar. -
#floordiv!(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Nil forall U, V
Implements the :// operator between two
Tensor
s. -
#floordiv!(a : Tensor(U, ARROW(U)), b : Number) : Nil forall U
Implements the :// operator between a
Tensor
and scalar. - #gamma(a : Tensor(U, CPU(U))) : Tensor forall U
- #gamma(a : Tensor(U, ARROW(U))) : Tensor forall U
- #gamma!(a : Tensor(U, CPU(U))) : Nil forall U
- #gamma!(a : Tensor(U, ARROW(U))) : Nil forall U
-
#greater(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Tensor forall U, V
Implements the :> operator between two
Tensor
s. -
#greater(a : Tensor(U, CPU(U)), b : Number | Complex) : Tensor forall U
Implements the :> operator between a
Tensor
and scalar. -
#greater(a : Number | Complex, b : Tensor(U, CPU(U))) : Tensor forall U
Implements the :> operator between a scalar and
Tensor
. -
#greater(a : Tensor(U, OCL(U)), b : Tensor(U, OCL(U))) : Tensor(Int32, OCL(Int32)) forall U
Implements the comparison operator ">" between two
Tensor
s. - #greater(a : Tensor(U, OCL(U)), b : U) : Tensor(Int32, OCL(Int32)) forall U
- #greater(a : U, b : Tensor(U, OCL(U))) : Tensor(Int32, OCL(Int32)) forall U
-
#greater(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Tensor forall U, V
Implements the :> operator between two
Tensor
s. -
#greater(a : Tensor(U, ARROW(U)), b : Number) : Tensor forall U
Implements the :> operator between a
Tensor
and scalar. -
#greater(a : Number, b : Tensor(U, ARROW(U))) : Tensor forall U
Implements the :> operator between a scalar and
Tensor
. -
#greater!(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Nil forall U, V
Implements the :> operator between two
Tensor
s. -
#greater!(a : Tensor(U, CPU(U)), b : Number | Complex) : Nil forall U
Implements the :> operator between a
Tensor
and scalar. -
#greater!(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Nil forall U, V
Implements the :> operator between two
Tensor
s. -
#greater!(a : Tensor(U, ARROW(U)), b : Number) : Nil forall U
Implements the :> operator between a
Tensor
and scalar. -
#greater_equal(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Tensor forall U, V
Implements the :>= operator between two
Tensor
s. -
#greater_equal(a : Tensor(U, CPU(U)), b : Number | Complex) : Tensor forall U
Implements the :>= operator between a
Tensor
and scalar. -
#greater_equal(a : Number | Complex, b : Tensor(U, CPU(U))) : Tensor forall U
Implements the :>= operator between a scalar and
Tensor
. -
#greater_equal(a : Tensor(U, OCL(U)), b : Tensor(U, OCL(U))) : Tensor(Int32, OCL(Int32)) forall U
Implements the comparison operator ">=" between two
Tensor
s. - #greater_equal(a : Tensor(U, OCL(U)), b : U) : Tensor(Int32, OCL(Int32)) forall U
- #greater_equal(a : U, b : Tensor(U, OCL(U))) : Tensor(Int32, OCL(Int32)) forall U
-
#greater_equal(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Tensor forall U, V
Implements the :>= operator between two
Tensor
s. -
#greater_equal(a : Tensor(U, ARROW(U)), b : Number) : Tensor forall U
Implements the :>= operator between a
Tensor
and scalar. -
#greater_equal(a : Number, b : Tensor(U, ARROW(U))) : Tensor forall U
Implements the :>= operator between a scalar and
Tensor
. -
#greater_equal!(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Nil forall U, V
Implements the :>= operator between two
Tensor
s. -
#greater_equal!(a : Tensor(U, CPU(U)), b : Number | Complex) : Nil forall U
Implements the :>= operator between a
Tensor
and scalar. -
#greater_equal!(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Nil forall U, V
Implements the :>= operator between two
Tensor
s. -
#greater_equal!(a : Tensor(U, ARROW(U)), b : Number) : Nil forall U
Implements the :>= operator between a
Tensor
and scalar. -
#hstack(arrs : Array(Tensor(U, V))) forall U, V
Stack an array of
Tensor
s in sequence column-wise. -
#hstack(*arrs : Tensor(U, V)) forall U, V
Stack an array of
Tensor
s in sequence column-wise. - #hypot(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Tensor forall U, V
- #hypot(a : Tensor(U, CPU(U)), b : Number) : Tensor forall U
- #hypot(a : Number, b : Tensor(U, CPU(U))) : Tensor forall U
- #hypot(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Tensor forall U, V
- #hypot(a : Tensor(U, ARROW(U)), b : Number) : Tensor forall U
- #hypot(a : Number, b : Tensor(U, ARROW(U))) : Tensor forall U
- #hypot!(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Nil forall U, V
- #hypot!(a : Tensor(U, CPU(U)), b : Number) : Nil forall U
- #hypot!(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Nil forall U, V
- #hypot!(a : Tensor(U, ARROW(U)), b : Number) : Nil forall U
- #ilogb(a : Tensor(U, CPU(U))) : Tensor forall U
- #ilogb(a : Tensor(U, ARROW(U))) : Tensor forall U
- #ilogb!(a : Tensor(U, CPU(U))) : Nil forall U
- #ilogb!(a : Tensor(U, ARROW(U))) : Nil forall U
- #ldexp(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Tensor forall U, V
- #ldexp(a : Tensor(U, CPU(U)), b : Number) : Tensor forall U
- #ldexp(a : Number, b : Tensor(U, CPU(U))) : Tensor forall U
- #ldexp(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Tensor forall U, V
- #ldexp(a : Tensor(U, ARROW(U)), b : Number) : Tensor forall U
- #ldexp(a : Number, b : Tensor(U, ARROW(U))) : Tensor forall U
- #ldexp!(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Nil forall U, V
- #ldexp!(a : Tensor(U, CPU(U)), b : Number) : Nil forall U
- #ldexp!(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Nil forall U, V
- #ldexp!(a : Tensor(U, ARROW(U)), b : Number) : Nil forall U
-
#left_shift(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Tensor forall U, V
Implements the :<< operator between two
Tensor
s. -
#left_shift(a : Tensor(U, CPU(U)), b : Number | Complex) : Tensor forall U
Implements the :<< operator between a
Tensor
and scalar. -
#left_shift(a : Number | Complex, b : Tensor(U, CPU(U))) : Tensor forall U
Implements the :<< operator between a scalar and
Tensor
. -
#left_shift(a : Tensor(U, OCL(U)), b : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the bitwise operator "<<" between two
Tensor
s. - #left_shift(a : Tensor(U, OCL(U)), b : U) : Tensor(U, OCL(U)) forall U
- #left_shift(a : U, b : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
-
#left_shift(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Tensor forall U, V
Implements the :<< operator between two
Tensor
s. -
#left_shift(a : Tensor(U, ARROW(U)), b : Number) : Tensor forall U
Implements the :<< operator between a
Tensor
and scalar. -
#left_shift(a : Number, b : Tensor(U, ARROW(U))) : Tensor forall U
Implements the :<< operator between a scalar and
Tensor
. -
#left_shift!(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Nil forall U, V
Implements the :<< operator between two
Tensor
s. -
#left_shift!(a : Tensor(U, CPU(U)), b : Number | Complex) : Nil forall U
Implements the :<< operator between a
Tensor
and scalar. -
#left_shift!(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Nil forall U, V
Implements the :<< operator between two
Tensor
s. -
#left_shift!(a : Tensor(U, ARROW(U)), b : Number) : Nil forall U
Implements the :<< operator between a
Tensor
and scalar. -
#less(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Tensor forall U, V
Implements the :< operator between two
Tensor
s. -
#less(a : Tensor(U, CPU(U)), b : Number | Complex) : Tensor forall U
Implements the :< operator between a
Tensor
and scalar. -
#less(a : Number | Complex, b : Tensor(U, CPU(U))) : Tensor forall U
Implements the :< operator between a scalar and
Tensor
. -
#less(a : Tensor(U, OCL(U)), b : Tensor(U, OCL(U))) : Tensor(Int32, OCL(Int32)) forall U
Implements the comparison operator "<" between two
Tensor
s. - #less(a : Tensor(U, OCL(U)), b : U) : Tensor(Int32, OCL(Int32)) forall U
- #less(a : U, b : Tensor(U, OCL(U))) : Tensor(Int32, OCL(Int32)) forall U
-
#less(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Tensor forall U, V
Implements the :< operator between two
Tensor
s. -
#less(a : Tensor(U, ARROW(U)), b : Number) : Tensor forall U
Implements the :< operator between a
Tensor
and scalar. -
#less(a : Number, b : Tensor(U, ARROW(U))) : Tensor forall U
Implements the :< operator between a scalar and
Tensor
. -
#less!(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Nil forall U, V
Implements the :< operator between two
Tensor
s. -
#less!(a : Tensor(U, CPU(U)), b : Number | Complex) : Nil forall U
Implements the :< operator between a
Tensor
and scalar. -
#less!(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Nil forall U, V
Implements the :< operator between two
Tensor
s. -
#less!(a : Tensor(U, ARROW(U)), b : Number) : Nil forall U
Implements the :< operator between a
Tensor
and scalar. -
#less_equal(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Tensor forall U, V
Implements the :<= operator between two
Tensor
s. -
#less_equal(a : Tensor(U, CPU(U)), b : Number | Complex) : Tensor forall U
Implements the :<= operator between a
Tensor
and scalar. -
#less_equal(a : Number | Complex, b : Tensor(U, CPU(U))) : Tensor forall U
Implements the :<= operator between a scalar and
Tensor
. -
#less_equal(a : Tensor(U, OCL(U)), b : Tensor(U, OCL(U))) : Tensor(Int32, OCL(Int32)) forall U
Implements the comparison operator "<=" between two
Tensor
s. - #less_equal(a : Tensor(U, OCL(U)), b : U) : Tensor(Int32, OCL(Int32)) forall U
- #less_equal(a : U, b : Tensor(U, OCL(U))) : Tensor(Int32, OCL(Int32)) forall U
-
#less_equal(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Tensor forall U, V
Implements the :<= operator between two
Tensor
s. -
#less_equal(a : Tensor(U, ARROW(U)), b : Number) : Tensor forall U
Implements the :<= operator between a
Tensor
and scalar. -
#less_equal(a : Number, b : Tensor(U, ARROW(U))) : Tensor forall U
Implements the :<= operator between a scalar and
Tensor
. -
#less_equal!(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Nil forall U, V
Implements the :<= operator between two
Tensor
s. -
#less_equal!(a : Tensor(U, CPU(U)), b : Number | Complex) : Nil forall U
Implements the :<= operator between a
Tensor
and scalar. -
#less_equal!(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Nil forall U, V
Implements the :<= operator between two
Tensor
s. -
#less_equal!(a : Tensor(U, ARROW(U)), b : Number) : Nil forall U
Implements the :<= operator between a
Tensor
and scalar. - #lgamma(a : Tensor(U, CPU(U))) : Tensor forall U
-
#lgamma(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function lgamma for a single
Tensor
. - #lgamma(a : Tensor(U, ARROW(U))) : Tensor forall U
- #lgamma!(a : Tensor(U, CPU(U))) : Nil forall U
-
#lgamma!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function lgamma for a single
Tensor
. - #lgamma!(a : Tensor(U, ARROW(U))) : Nil forall U
- #log(a : Tensor(U, CPU(U))) : Tensor forall U
-
#log(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function log for a single
Tensor
. - #log(a : Tensor(U, ARROW(U))) : Tensor forall U
- #log!(a : Tensor(U, CPU(U))) : Nil forall U
-
#log!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function log for a single
Tensor
. - #log!(a : Tensor(U, ARROW(U))) : Nil forall U
- #log10(a : Tensor(U, CPU(U))) : Tensor forall U
-
#log10(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function log10 for a single
Tensor
. - #log10(a : Tensor(U, ARROW(U))) : Tensor forall U
- #log10!(a : Tensor(U, CPU(U))) : Nil forall U
-
#log10!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function log10 for a single
Tensor
. - #log10!(a : Tensor(U, ARROW(U))) : Nil forall U
- #log1p(a : Tensor(U, CPU(U))) : Tensor forall U
-
#log1p(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function log1p for a single
Tensor
. - #log1p(a : Tensor(U, ARROW(U))) : Tensor forall U
- #log1p!(a : Tensor(U, CPU(U))) : Nil forall U
-
#log1p!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function log1p for a single
Tensor
. - #log1p!(a : Tensor(U, ARROW(U))) : Nil forall U
- #log2(a : Tensor(U, CPU(U))) : Tensor forall U
-
#log2(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function log2 for a single
Tensor
. - #log2(a : Tensor(U, ARROW(U))) : Tensor forall U
- #log2!(a : Tensor(U, CPU(U))) : Nil forall U
-
#log2!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function log2 for a single
Tensor
. - #log2!(a : Tensor(U, ARROW(U))) : Nil forall U
- #logb(a : Tensor(U, CPU(U))) : Tensor forall U
-
#logb(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function logb for a single
Tensor
. - #logb(a : Tensor(U, ARROW(U))) : Tensor forall U
- #logb!(a : Tensor(U, CPU(U))) : Nil forall U
-
#logb!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function logb for a single
Tensor
. - #logb!(a : Tensor(U, ARROW(U))) : Nil forall U
-
#map(a0 : Tensor(U, CPU(U)), a1 : Tensor(V, CPU(V)), a2 : Tensor(W, CPU(W)), &block : U, V, W -> X) : Tensor(X, CPU(X)) forall U, V, W, X
Maps a block across three
Tensors
. -
#map(a0 : Tensor(U, ARROW(U)), a1 : Tensor(V, ARROW(V)), a2 : Tensor(W, ARROW(W)), &block : U, V, W -> X) : Tensor(X, ARROW(X)) forall U, V, W, X
Maps a block across three
Tensors
. -
#map(a0 : Tensor(U, CPU(U)), a1 : Tensor(V, CPU(V)), &block : U, V -> W) forall U, V, W
Maps a block across two
Tensors
. -
#map(a0 : Tensor(U, ARROW(U)), a1 : Tensor(V, ARROW(V)), &block : U, V -> W) forall U, V, W
Maps a block across two
Tensors
. -
#map(arr : Tensor(U, CPU(U)), &block : U -> V) : Tensor(V, CPU(V)) forall U, V
Maps a block across a
Tensor
. -
#map(arr : Tensor(U, ARROW(U)), &block : U -> V) : Tensor(V, ARROW(V)) forall U, V
Maps a block across a
Tensor
. -
#map!(a0 : Tensor(U, CPU(U)), a1 : Tensor(V, CPU(V)), a2 : Tensor(W, CPU(W)), &) forall U, V, W
Maps a block across three
Tensors
. -
#map!(a0 : Tensor(U, ARROW(U)), a1 : Tensor(V, ARROW(V)), a2 : Tensor(W, ARROW(W)), &) forall U, V, W
Maps a block across three
Tensors
. -
#map!(a0 : Tensor(U, CPU(U)), a1 : Tensor(V, CPU(V)), &block : U, V -> _) forall U, V
Maps a block across two
Tensors
. -
#map!(a0 : Tensor(U, ARROW(U)), a1 : Tensor(V, ARROW(V)), &block : U, V -> _) forall U, V
Maps a block across two
Tensors
. -
#map!(arr : Tensor(U, CPU(U)), &block : U -> _) forall U
Maps a block across a
Tensor
in place. -
#map!(arr : Tensor(U, ARROW(U)), &block : U -> _) forall U
Maps a block across a
Tensor
in place. - #max(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Tensor forall U, V
- #max(a : Tensor(U, CPU(U)), axis : Int, dims : Bool = false) forall U
- #max(a : Tensor(U, CPU(U)), b : Number) : Tensor forall U
- #max(a : Number, b : Tensor(U, CPU(U))) : Tensor forall U
-
#max(a : Tensor(U, OCL(U)), b : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function fmax between two
Tensor
s - #max(a : Tensor(U, OCL(U)), b : U) : Tensor(U, OCL(U)) forall U
- #max(a : U, b : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
- #max(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Tensor forall U, V
- #max(a : Tensor(U, ARROW(U)), axis : Int, dims : Bool = false) forall U
- #max(a : Tensor(U, ARROW(U)), b : Number) : Tensor forall U
- #max(a : Number, b : Tensor(U, ARROW(U))) : Tensor forall U
-
#max(a : Tensor(U, CPU(U))) forall U
Reduces a
Tensor
to a scalar by finding the maximum value -
#max(a : Tensor(U, ARROW(U))) forall U
Reduces a
Tensor
to a scalar by finding the maximum value - #max!(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Nil forall U, V
- #max!(a : Tensor(U, CPU(U)), b : Number) : Nil forall U
- #max!(a : Tensor(U, OCL(U)), b : Tensor(U, OCL(U))) : Nil forall U
- #max!(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Nil forall U, V
- #max!(a : Tensor(U, ARROW(U)), b : Number) : Nil forall U
- #mean(a : Tensor(U, CPU(U)), axis : Int, dims : Bool = false) forall U
- #mean(a : Tensor(U, ARROW(U)), axis : Int, dims : Bool = false) forall U
-
#mean(a : Tensor(U, CPU(U))) forall U
Reduces a
Tensor
to a scalar by finding the average -
#mean(a : Tensor(U, ARROW(U))) forall U
Reduces a
Tensor
to a scalar by finding the average - #min(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Tensor forall U, V
- #min(a : Tensor(U, CPU(U)), axis : Int, dims : Bool = false) forall U
- #min(a : Tensor(U, CPU(U)), b : Number) : Tensor forall U
- #min(a : Number, b : Tensor(U, CPU(U))) : Tensor forall U
-
#min(a : Tensor(U, OCL(U)), b : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function fmin between two
Tensor
s - #min(a : Tensor(U, OCL(U)), b : U) : Tensor(U, OCL(U)) forall U
- #min(a : U, b : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
- #min(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Tensor forall U, V
- #min(a : Tensor(U, ARROW(U)), axis : Int, dims : Bool = false) forall U
- #min(a : Tensor(U, ARROW(U)), b : Number) : Tensor forall U
- #min(a : Number, b : Tensor(U, ARROW(U))) : Tensor forall U
-
#min(a : Tensor(U, CPU(U))) forall U
Reduces a
Tensor
to a scalar by finding the minimum value -
#min(a : Tensor(U, ARROW(U))) forall U
Reduces a
Tensor
to a scalar by finding the minimum value - #min!(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Nil forall U, V
- #min!(a : Tensor(U, CPU(U)), b : Number) : Nil forall U
- #min!(a : Tensor(U, OCL(U)), b : Tensor(U, OCL(U))) : Nil forall U
- #min!(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Nil forall U, V
- #min!(a : Tensor(U, ARROW(U)), b : Number) : Nil forall U
-
#modulo(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Tensor forall U, V
Implements the :% operator between two
Tensor
s. -
#modulo(a : Tensor(U, CPU(U)), b : Number | Complex) : Tensor forall U
Implements the :% operator between a
Tensor
and scalar. -
#modulo(a : Number | Complex, b : Tensor(U, CPU(U))) : Tensor forall U
Implements the :% operator between a scalar and
Tensor
. -
#modulo(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Tensor forall U, V
Implements the :% operator between two
Tensor
s. -
#modulo(a : Tensor(U, ARROW(U)), b : Number) : Tensor forall U
Implements the :% operator between a
Tensor
and scalar. -
#modulo(a : Number, b : Tensor(U, ARROW(U))) : Tensor forall U
Implements the :% operator between a scalar and
Tensor
. -
#modulo!(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Nil forall U, V
Implements the :% operator between two
Tensor
s. -
#modulo!(a : Tensor(U, CPU(U)), b : Number | Complex) : Nil forall U
Implements the :% operator between a
Tensor
and scalar. -
#modulo!(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Nil forall U, V
Implements the :% operator between two
Tensor
s. -
#modulo!(a : Tensor(U, ARROW(U)), b : Number) : Nil forall U
Implements the :% operator between a
Tensor
and scalar. -
#move_axis(arr : Tensor(U, CPU(U)), source : Array(Int), destination : Array(Int)) forall U
Move axes of a Tensor to new positions, other axes remain in their original order
-
#move_axis(arr : Tensor(U, CPU(U)), source : Int, destination : Int) forall U
Move axes of a Tensor to new positions, other axes remain in their original order
-
#move_axis(arr : Tensor(U, ARROW(U)), source : Array(Int), destination : Array(Int)) forall U
Move axes of a Tensor to new positions, other axes remain in their original order
-
#move_axis(arr : Tensor(U, ARROW(U)), source : Int, destination : Int) forall U
Move axes of a Tensor to new positions, other axes remain in their original order
-
#multiply(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Tensor forall U, V
Implements the :* operator between two
Tensor
s. -
#multiply(a : Tensor(U, CPU(U)), b : Number | Complex) : Tensor forall U
Implements the :* operator between a
Tensor
and scalar. -
#multiply(a : Number | Complex, b : Tensor(U, CPU(U))) : Tensor forall U
Implements the :* operator between a scalar and
Tensor
. -
#multiply(a : Tensor(U, OCL(U)), b : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Multiply two
Tensor
s elementwise - #multiply(a : Tensor(U, OCL(U)), b : U) : Tensor(U, OCL(U)) forall U
- #multiply(a : U, b : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
-
#multiply(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Tensor forall U, V
Implements the :* operator between two
Tensor
s. -
#multiply(a : Tensor(U, ARROW(U)), b : Number) : Tensor forall U
Implements the :* operator between a
Tensor
and scalar. -
#multiply(a : Number, b : Tensor(U, ARROW(U))) : Tensor forall U
Implements the :* operator between a scalar and
Tensor
. -
#multiply!(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Nil forall U, V
Implements the :* operator between two
Tensor
s. -
#multiply!(a : Tensor(U, CPU(U)), b : Number | Complex) : Nil forall U
Implements the :* operator between a
Tensor
and scalar. -
#multiply!(a : Tensor(U, OCL(U)), b : Tensor(U, OCL(U))) : Nil forall U
"Multiply" two
Tensor
s elementwise, storing the result in the first Tensor - #multiply!(a : Tensor(U, OCL(U)), b : U) : Nil forall U
-
#multiply!(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Nil forall U, V
Implements the :* operator between two
Tensor
s. -
#multiply!(a : Tensor(U, ARROW(U)), b : Number) : Nil forall U
Implements the :* operator between a
Tensor
and scalar. -
#negate(a : Tensor(U, CPU(U))) : Tensor(U, CPU(U)) forall U
Implements the negation operator on a
Tensor
-
#negate(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the negation operator on a
Tensor
-
#negate(a : Tensor(U, ARROW(U))) : Tensor(U, ARROW(U)) forall U
Implements the negation operator on a
Tensor
-
#not_equal(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Tensor forall U, V
Implements the :!= operator between two
Tensor
s. -
#not_equal(a : Tensor(U, CPU(U)), b : Number | Complex) : Tensor forall U
Implements the :!= operator between a
Tensor
and scalar. -
#not_equal(a : Number | Complex, b : Tensor(U, CPU(U))) : Tensor forall U
Implements the :!= operator between a scalar and
Tensor
. -
#not_equal(a : Tensor(U, OCL(U)), b : Tensor(U, OCL(U))) : Tensor(Int32, OCL(Int32)) forall U
Implements the comparison operator "!=" between two
Tensor
s. - #not_equal(a : Tensor(U, OCL(U)), b : U) : Tensor(Int32, OCL(Int32)) forall U
- #not_equal(a : U, b : Tensor(U, OCL(U))) : Tensor(Int32, OCL(Int32)) forall U
-
#not_equal(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Tensor forall U, V
Implements the :!= operator between two
Tensor
s. -
#not_equal(a : Tensor(U, ARROW(U)), b : Number) : Tensor forall U
Implements the :!= operator between a
Tensor
and scalar. -
#not_equal(a : Number, b : Tensor(U, ARROW(U))) : Tensor forall U
Implements the :!= operator between a scalar and
Tensor
. -
#not_equal!(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Nil forall U, V
Implements the :!= operator between two
Tensor
s. -
#not_equal!(a : Tensor(U, CPU(U)), b : Number | Complex) : Nil forall U
Implements the :!= operator between a
Tensor
and scalar. -
#not_equal!(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Nil forall U, V
Implements the :!= operator between two
Tensor
s. -
#not_equal!(a : Tensor(U, ARROW(U)), b : Number) : Nil forall U
Implements the :!= operator between a
Tensor
and scalar. -
#opencl(arr : Tensor(U, CPU(U))) : Tensor(U, OCL(U)) forall U
Places a
Tensor
stored on a CPU onto an OpenCL Device. -
#opencl(arr : Tensor(U, ARROW(U))) : Tensor(U, OCL(U)) forall U
Places a
Tensor
stored on a ARROW onto an OpenCL Device. -
#power(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Tensor forall U, V
Implements the :** operator between two
Tensor
s. -
#power(a : Tensor(U, CPU(U)), b : Number | Complex) : Tensor forall U
Implements the :** operator between a
Tensor
and scalar. -
#power(a : Number | Complex, b : Tensor(U, CPU(U))) : Tensor forall U
Implements the :** operator between a scalar and
Tensor
. -
#power(a : Tensor(U, OCL(U)), b : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function pow between two
Tensor
s - #power(a : Tensor(U, OCL(U)), b : U) : Tensor(U, OCL(U)) forall U
- #power(a : U, b : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
-
#power(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Tensor forall U, V
Implements the :** operator between two
Tensor
s. -
#power(a : Tensor(U, ARROW(U)), b : Number) : Tensor forall U
Implements the :** operator between a
Tensor
and scalar. -
#power(a : Number, b : Tensor(U, ARROW(U))) : Tensor forall U
Implements the :** operator between a scalar and
Tensor
. -
#power!(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Nil forall U, V
Implements the :** operator between two
Tensor
s. -
#power!(a : Tensor(U, CPU(U)), b : Number | Complex) : Nil forall U
Implements the :** operator between a
Tensor
and scalar. - #power!(a : Tensor(U, OCL(U)), b : Tensor(U, OCL(U))) : Nil forall U
-
#power!(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Nil forall U, V
Implements the :** operator between two
Tensor
s. -
#power!(a : Tensor(U, ARROW(U)), b : Number) : Nil forall U
Implements the :** operator between a
Tensor
and scalar. - #prod(a : Tensor(U, CPU(U)), axis : Int, dims : Bool = false) forall U
- #prod(a : Tensor(U, ARROW(U)), axis : Int, dims : Bool = false) forall U
-
#prod(a : Tensor(U, CPU(U))) forall U
Reduces a
Tensor
to a scalar by multiplying all of its elements -
#prod(a : Tensor(U, ARROW(U))) forall U
Reduces a
Tensor
to a scalar by multiplying all of its elements -
#ptp(a : Tensor(U, CPU(U)), axis : Int, dims : Bool = false) forall U
Finds the difference between the maximum and minimum elements of a
Tensor
along an axis -
#ptp(a : Tensor(U, ARROW(U)), axis : Int, dims : Bool = false) forall U
Finds the difference between the maximum and minimum elements of a
Tensor
along an axis -
#ptp(a : Tensor(U, CPU(U))) forall U
Finds the difference between the maximum and minimum elements of a
Tensor
-
#ptp(a : Tensor(U, ARROW(U))) forall U
Finds the difference between the maximum and minimum elements of a
Tensor
-
#reduce_axis(a0 : Tensor(U, CPU(U)), axis : Int, dims : Bool = false, &block : U, U -> _) forall U
Reduces a
Tensor
along an axis. -
#reduce_axis(a0 : Tensor(U, OCL(U)), axis : Int, dims : Bool = false, &block : Tensor(U, OCL(U)), Tensor(U, OCL(U)) -> _) : Tensor(U, OCL(U)) forall U
Reduces a
Tensor
along an axis. -
#reduce_axis(a0 : Tensor(U, ARROW(U)), axis : Int, dims : Bool = false, &block : U, U -> _) forall U
Reduces a
Tensor
along an axis. -
#repeat(a : Tensor(U, CPU(U)), n : Int, axis : Int) forall U
Repeat elements of a
Tensor
along an axis -
#repeat(a : Tensor(U, ARROW(U)), n : Int, axis : Int) forall U
Repeat elements of a
Tensor
along an axis - #repeat(a : Tensor(U, CPU(U)), n : Int) forall U
- #repeat(a : Tensor(U, ARROW(U)), n : Int) forall U
-
#reshape(arr : Tensor(U, CPU(U)), shape : Array(Int)) forall U
Transform's a
Tensor
's shape. -
#reshape(arr : Tensor(U, ARROW(U)), shape : Array(Int)) forall U
Transform's a
Tensor
's shape. -
#reshape(arr : Tensor(U, CPU(U)), *shape : Int) forall U
Transform's a
Tensor
's shape. -
#reshape(arr : Tensor(U, ARROW(U)), *shape : Int) forall U
Transform's a
Tensor
's shape. -
#right_shift(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Tensor forall U, V
Implements the :>> operator between two
Tensor
s. -
#right_shift(a : Tensor(U, CPU(U)), b : Number | Complex) : Tensor forall U
Implements the :>> operator between a
Tensor
and scalar. -
#right_shift(a : Number | Complex, b : Tensor(U, CPU(U))) : Tensor forall U
Implements the :>> operator between a scalar and
Tensor
. -
#right_shift(a : Tensor(U, OCL(U)), b : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the bitwise operator ">>" between two
Tensor
s. - #right_shift(a : Tensor(U, OCL(U)), b : U) : Tensor(U, OCL(U)) forall U
- #right_shift(a : U, b : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
-
#right_shift(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Tensor forall U, V
Implements the :>> operator between two
Tensor
s. -
#right_shift(a : Tensor(U, ARROW(U)), b : Number) : Tensor forall U
Implements the :>> operator between a
Tensor
and scalar. -
#right_shift(a : Number, b : Tensor(U, ARROW(U))) : Tensor forall U
Implements the :>> operator between a scalar and
Tensor
. -
#right_shift!(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Nil forall U, V
Implements the :>> operator between two
Tensor
s. -
#right_shift!(a : Tensor(U, CPU(U)), b : Number | Complex) : Nil forall U
Implements the :>> operator between a
Tensor
and scalar. -
#right_shift!(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Nil forall U, V
Implements the :>> operator between two
Tensor
s. -
#right_shift!(a : Tensor(U, ARROW(U)), b : Number) : Nil forall U
Implements the :>> operator between a
Tensor
and scalar. -
#rint(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function rint for a single
Tensor
. -
#rint!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function rint for a single
Tensor
. -
#round(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function round for a single
Tensor
. -
#round!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function round for a single
Tensor
. -
#rsqrt(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function rsqrt for a single
Tensor
. -
#rsqrt!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function rsqrt for a single
Tensor
. -
#set(arr : Tensor(U, CPU(U)), args : Array, t : Tensor(V, CPU(V))) forall U, V
The primary method of setting Tensor values.
-
#set(arr : Tensor(U, CPU(U)), args : Array, t : V) forall U, V
The primary method of setting Tensor values.
-
#set(arr : Tensor(U, OCL(U)), args : Array, t : Tensor(U, OCL(U))) forall U
The primary method of setting Tensor values.
-
#set(arr : Tensor(U, OCL(U)), args : Array, t : U) forall U
The primary method of setting Tensor values.
-
#set(arr : Tensor(U, ARROW(U)), args : Array, t : Tensor(V, ARROW(V))) forall U, V
The primary method of setting Tensor values.
-
#set(arr : Tensor(U, ARROW(U)), args : Array, t : V) forall U, V
The primary method of setting Tensor values.
-
#set(arr : Tensor(U, CPU(U)), *args, value) forall U
The primary method of setting Tensor values.
-
#set(arr : Tensor(U, OCL(U)), *args, value) forall U
The primary method of setting Tensor values.
-
#set(arr : Tensor(U, ARROW(U)), *args, value) forall U
The primary method of setting Tensor values.
- #sin(a : Tensor(U, CPU(U))) : Tensor forall U
-
#sin(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function sin for a single
Tensor
. - #sin(a : Tensor(U, ARROW(U))) : Tensor forall U
- #sin!(a : Tensor(U, CPU(U))) : Nil forall U
-
#sin!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function sin for a single
Tensor
. - #sin!(a : Tensor(U, ARROW(U))) : Nil forall U
- #sinh(a : Tensor(U, CPU(U))) : Tensor forall U
-
#sinh(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function sinh for a single
Tensor
. - #sinh(a : Tensor(U, ARROW(U))) : Tensor forall U
- #sinh!(a : Tensor(U, CPU(U))) : Nil forall U
-
#sinh!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function sinh for a single
Tensor
. - #sinh!(a : Tensor(U, ARROW(U))) : Nil forall U
-
#sinpi(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function sinpi for a single
Tensor
. -
#sinpi!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function sinpi for a single
Tensor
. -
#slice(arr : Tensor(U, V), args : Array) forall U, V
Returns a view of a
Tensor
from any valid indexers. -
#slice(arr : Tensor(U, V), *args) forall U, V
Returns a view of a
Tensor
from any valid indexers. -
#sort(a : Tensor(U, CPU(U)), axis : Int) forall U
Sorts a
Tensor
along an axis. -
#sort(a : Tensor(U, ARROW(U)), axis : Int) forall U
Sorts a
Tensor
along an axis. - #sort(a : Tensor(U, CPU(U))) forall U
-
#sort(a : Tensor(U, CPU(U)), axis : Int, &block : U, U -> _) forall U
Sorts a
Tensor
along an axis. -
#sort(a : Tensor(U, ARROW(U)), axis : Int, &block : U, U -> _) forall U
Sorts a
Tensor
along an axis. - #sort(a : Tensor(U, CPU(U)), &block : U, U -> _) forall U
- #sort(a : Tensor(U, ARROW(U))) forall U
- #sort(a : Tensor(U, ARROW(U)), &block : U, U -> _) forall U
- #split(a : Tensor(U, CPU(U)), ind : Int, axis : Int = 0) : Array(Tensor(U, CPU(U))) forall U
- #split(a : Tensor(U, CPU(U)), ind : Array(Int), axis : Int = 0) : Array(Tensor(U, CPU(U))) forall U
- #split(a : Tensor(U, ARROW(U)), ind : Int, axis : Int = 0) : Array(Tensor(U, ARROW(U))) forall U
- #split(a : Tensor(U, ARROW(U)), ind : Array(Int), axis : Int = 0) : Array(Tensor(U, ARROW(U))) forall U
- #sqrt(a : Tensor(U, CPU(U))) : Tensor forall U
-
#sqrt(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function sqrt for a single
Tensor
. - #sqrt(a : Tensor(U, ARROW(U))) : Tensor forall U
- #sqrt!(a : Tensor(U, CPU(U))) : Nil forall U
-
#sqrt!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function sqrt for a single
Tensor
. - #sqrt!(a : Tensor(U, ARROW(U))) : Nil forall U
- #std(a : Tensor(U, CPU(U)), axis : Int, dims : Bool = false) forall U
- #std(a : Tensor(U, ARROW(U)), axis : Int, dims : Bool = false) forall U
-
#std(a : Tensor(U, CPU(U))) forall U
Reduces a
Tensor
to a scalar by finding the standard deviation -
#std(a : Tensor(U, ARROW(U))) forall U
Reduces a
Tensor
to a scalar by finding the standard deviation -
#subtract(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Tensor forall U, V
Implements the :- operator between two
Tensor
s. -
#subtract(a : Tensor(U, CPU(U)), b : Number | Complex) : Tensor forall U
Implements the :- operator between a
Tensor
and scalar. -
#subtract(a : Number | Complex, b : Tensor(U, CPU(U))) : Tensor forall U
Implements the :- operator between a scalar and
Tensor
. -
#subtract(a : Tensor(U, OCL(U)), b : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Subtract two
Tensor
s elementwise - #subtract(a : Tensor(U, OCL(U)), b : U) : Tensor(U, OCL(U)) forall U
- #subtract(a : U, b : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
-
#subtract(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Tensor forall U, V
Implements the :- operator between two
Tensor
s. -
#subtract(a : Tensor(U, ARROW(U)), b : Number) : Tensor forall U
Implements the :- operator between a
Tensor
and scalar. -
#subtract(a : Number, b : Tensor(U, ARROW(U))) : Tensor forall U
Implements the :- operator between a scalar and
Tensor
. -
#subtract!(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V))) : Nil forall U, V
Implements the :- operator between two
Tensor
s. -
#subtract!(a : Tensor(U, CPU(U)), b : Number | Complex) : Nil forall U
Implements the :- operator between a
Tensor
and scalar. -
#subtract!(a : Tensor(U, OCL(U)), b : Tensor(U, OCL(U))) : Nil forall U
"Subtract" two
Tensor
s elementwise, storing the result in the first Tensor - #subtract!(a : Tensor(U, OCL(U)), b : U) : Nil forall U
-
#subtract!(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V))) : Nil forall U, V
Implements the :- operator between two
Tensor
s. -
#subtract!(a : Tensor(U, ARROW(U)), b : Number) : Nil forall U
Implements the :- operator between a
Tensor
and scalar. - #sum(a : Tensor(U, CPU(U)), axis : Int, dims : Bool = false) forall U
- #sum(a : Tensor(U, OCL(U)), axis : Int, dims : Bool = false) forall U
- #sum(a : Tensor(U, ARROW(U)), axis : Int, dims : Bool = false) forall U
-
#sum(a : Tensor(U, CPU(U))) forall U
Reduces a
Tensor
to a scalar by summing all of its elements -
#sum(a : Tensor(U, ARROW(U))) forall U
Reduces a
Tensor
to a scalar by summing all of its elements -
#swap_axes(arr : Tensor(U, CPU(U)), a : Int, b : Int) forall U
Permutes two axes of a
Tensor
. -
#swap_axes(arr : Tensor(U, ARROW(U)), a : Int, b : Int) forall U
Permutes two axes of a
Tensor
. - #tan(a : Tensor(U, CPU(U))) : Tensor forall U
-
#tan(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function tan for a single
Tensor
. - #tan(a : Tensor(U, ARROW(U))) : Tensor forall U
- #tan!(a : Tensor(U, CPU(U))) : Nil forall U
-
#tan!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function tan for a single
Tensor
. - #tan!(a : Tensor(U, ARROW(U))) : Nil forall U
- #tanh(a : Tensor(U, CPU(U))) : Tensor forall U
-
#tanh(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function tanh for a single
Tensor
. - #tanh(a : Tensor(U, ARROW(U))) : Tensor forall U
- #tanh!(a : Tensor(U, CPU(U))) : Nil forall U
-
#tanh!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function tanh for a single
Tensor
. - #tanh!(a : Tensor(U, ARROW(U))) : Nil forall U
-
#tanpi(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function tanpi for a single
Tensor
. -
#tanpi!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function tanpi for a single
Tensor
. -
#tgamma(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function tgamma for a single
Tensor
. -
#tgamma!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function tgamma for a single
Tensor
. -
#tile(a : Tensor(U, CPU(U)), n : Int) forall U
Tile elements of a
Tensor
-
#tile(a : Tensor(U, CPU(U)), n : Array(Int)) forall U
Tile elements of a
Tensor
-
#tile(a : Tensor(U, ARROW(U)), n : Int) forall U
Tile elements of a
Tensor
-
#tile(a : Tensor(U, ARROW(U)), n : Array(Int)) forall U
Tile elements of a
Tensor
-
#to_a(arr : Tensor(U, CPU(U))) forall U
Converts a
Tensor
to a standard library array. -
#to_a(arr : Tensor(U, OCL(U))) forall U
Converts a
Tensor
to a standard library array. -
#to_a(arr : Tensor(U, ARROW(U))) forall U
Converts a
Tensor
to a standard library array. -
#transpose(arr : Tensor(U, CPU(U)), axes : Array(Int) = [] of Int32) forall U
Permutes a
Tensor
's axes to a different order. -
#transpose(arr : Tensor(U, OCL(U)), axes : Array(Int) = [] of Int32) forall U
Permutes a
Tensor
's axes to a different order. -
#transpose(arr : Tensor(U, ARROW(U)), axes : Array(Int) = [] of Int32) forall U
Permutes a
Tensor
's axes to a different order. -
#transpose(arr : Tensor(U, CPU(U)), *args : Int) forall U
Permutes a
Tensor
's axes to a different order. -
#transpose(arr : Tensor(U, OCL(U)), *args : Int) forall U
Permutes a
Tensor
's axes to a different order. -
#transpose(arr : Tensor(U, ARROW(U)), *args : Int) forall U
Permutes a
Tensor
's axes to a different order. -
#trunc(a : Tensor(U, OCL(U))) : Tensor(U, OCL(U)) forall U
Implements the OpenCL builtin function trunc for a single
Tensor
. -
#trunc!(a : Tensor(U, OCL(U))) : Nil forall U
Implements the OpenCL builtin function trunc for a single
Tensor
. -
#view(arr : Tensor(U, CPU(U)), dtype : V.class) forall U, V
Return a shallow copy of a
Tensor
with a new dtype. -
#view(arr : Tensor(U, ARROW(U)), dtype : V.class) forall U, V
Return a shallow copy of a
Tensor
with a new dtype. -
#vstack(arrs : Array(Tensor(U, V))) forall U, V
Stack an array of
Tensor
s in sequence row-wise. -
#vstack(*arrs : Tensor(U, V)) forall U, V
Stack an array of
Tensor
s in sequence row-wise. -
#with_broadcast(arr : Tensor(U, V), n : Int) : Tensor(U, V) forall U, V
Expands a
Tensor
s dimensions n times by broadcasting the shape and strides. -
#yield_along_axis(a0 : Tensor(U, CPU(U)), axis : Int, &) forall U
Similar to
#each_axis
, but instead of yielding slices of an axis, it yields slices along an axis, useful for methods that require an entire view of anaxis
slice for a reduction operation, such as#std
, rather than being able to incrementally reduce. -
#yield_along_axis(a0 : Tensor(U, ARROW(U)), axis : Int, &) forall U
Similar to
#each_axis
, but instead of yielding slices of an axis, it yields slices along an axis, useful for methods that require an entire view of anaxis
slice for a reduction operation, such as#std
, rather than being able to incrementally reduce. - #zip(a : Tensor(U, CPU(U)), b : Tensor(V, CPU(V)), &block : U, V -> _) forall U, V
- #zip(a : Tensor(U, ARROW(U)), b : Tensor(V, ARROW(V)), &block : U, V -> _) forall U, V
Instance Method Detail
Implements the stdlib Math method acos on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.acos(a)
Implements the OpenCL builtin function acos for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.acos(a)
Implements the stdlib Math method acos on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.acos(a)
Implements the stdlib Math method acos on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.acos(a)
Implements the OpenCL builtin function acos for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.acos!(a)
Implements the stdlib Math method acos on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.acos(a)
Implements the stdlib Math method acosh on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.acosh(a)
Implements the OpenCL builtin function acosh for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.acosh(a)
Implements the stdlib Math method acosh on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.acosh(a)
Implements the stdlib Math method acosh on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.acosh(a)
Implements the OpenCL builtin function acosh for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.acosh!(a)
Implements the stdlib Math method acosh on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.acosh(a)
Implements the OpenCL builtin function acospi for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.acospi(a)
Implements the OpenCL builtin function acospi for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.acospi!(a)
Implements the :+ operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.add(a, b)
Implements the :+ operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.add(a, b)
Implements the :+ operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.add(b, a)
Add a Tensor
and a Number
elementwise
Arguments
Examples
a = [1.5, 2.2, 3.2].to_tensor(OCL)
Num.add(a, 3.5)
Add a Number
and a Tensor
elementwise
Arguments
Examples
a = [1.5, 2.2, 3.2].to_tensor(OCL)
Num.add(a, 3.5)
Implements the :+ operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise_arrow.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.add(a, b)
Implements the :+ operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.add(a, b)
Implements the :+ operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.add(b, a)
Implements the :+ operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.add!(a, b) # a is modified
Implements the :+ operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.add!(a, b)
"Add" two Tensor
s elementwise, storing
the result in the first Tensor
Arguments
- a :
Tensor(U, OCL(U))
- LHS argument to add, will be modified inplace - b :
Tensor(U, OCL(U))
- RHS argument to add
Examples
a = [1.5, 2.2, 3.2].to_tensor(OCL)
Num.add!(a, a)
Add a Tensor
and a Number
elementwise,
modifying the Tensor
inplace.
Arguments
Examples
a = [1.5, 2.2, 3.2].to_tensor(OCL)
Num.add(a, 3.5)
Implements the :+ operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.add!(a, b) # a is modified
Implements the :+ operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.add!(a, b)
Reduces a Tensor
along an axis, asserting the truthiness of all values
in each view into the Tensor
Arguments
- a :
Tensor(U, CPU(U))
-Tensor
to reduce - axis :
Int
- Axis of reduction - dims :
Bool
- Indicate if the axis of reduction should remain in the result
Examples
a = Tensor.new([2, 2]) { |i| i }
Num.all(a, 0) # => [false, true]
Num.all(a, 1, dims: true)
# [[false],
# [ true]]
Reduces a Tensor
along an axis, asserting the truthiness of all values
in each view into the Tensor
Arguments
- a :
Tensor(U, ARROW(U))
-Tensor
to reduce - axis :
Int
- Axis of reduction - dims :
Bool
- Indicate if the axis of reduction should remain in the result
Examples
a = Tensor.new([2, 2]) { |i| i }
Num.all(a, 0) # => [false, true]
Num.all(a, 1, dims: true)
# [[false],
# [ true]]
Reduces a Tensor
to a boolean by asserting the truthiness of
all elements
Arguments
Examples
a = [0, 2, 3]
Num.all(a) # => false
Reduces a Tensor
to a boolean by asserting the truthiness of
all elements
Arguments
Examples
a = [0, 2, 3]
Num.all(a) # => false
Asserts that two Tensor
s are equal, allowing for small
margins of errors with floating point values using
an EPSILON value.
Arguments
- a :
Tensor(U, CPU(U))
- LHS argument to compare - b :
Tensor(V, CPU(V))
- RHS argument to compare - epsilon :
Number
- Allowed variance between numbers
Examples
a = [0.0, 0.0, 0.0000000001].to_tensor
b = [0.0, 0.0, 0.0].to_tensor
Num.all_close(a, b) # => true
Asserts that two Tensor
s are equal, allowing for small
margins of errors with floating point values using
an EPSILON value.
Arguments
- a :
Tensor(U, ARROW(U))
- LHS argument to compare - b :
Tensor(V, ARROW(V))
- RHS argument to compare - epsilon :
Number
- Allowed variance between numbers
Examples
a = [0.0, 0.0, 0.0000000001].to_tensor
b = [0.0, 0.0, 0.0].to_tensor
Num.all_close(a, b) # => true
Reduces a Tensor
along an axis, asserting the truthiness of any values
in each view into the Tensor
Arguments
- a :
Tensor(U, CPU(U))
-Tensor
to reduce - axis :
Int
- Axis of reduction - dims :
Bool
- Indicate if the axis of reduction should remain in the result
Examples
a = Tensor.new([2, 2]) { |i| i }
Num.any(a, 0) # => [true, true]
Num.any(a, 1, dims: true)
# [[true],
# [ true]]
Reduces a Tensor
along an axis, asserting the truthiness of any values
in each view into the Tensor
Arguments
- a :
Tensor(U, ARROW(U))
-Tensor
to reduce - axis :
Int
- Axis of reduction - dims :
Bool
- Indicate if the axis of reduction should remain in the result
Examples
a = Tensor.new([2, 2]) { |i| i }
Num.any(a, 0) # => [true, true]
Num.any(a, 1, dims: true)
# [[true],
# [ true]]
Reduces a Tensor
to a boolean by asserting the truthiness of
any element
Arguments
Examples
a = [0, 2, 3]
Num.any(a) # => true
Reduces a Tensor
to a boolean by asserting the truthiness of
any element
Arguments
Examples
a = [0, 2, 3]
Num.any(a) # => true
Find the maximum index value of a Tensor along an axis
Arguments
- a :
Tensor(U, CPU(U))
-Tensor
to reduce - axis :
Int
- Axis of reduction - dims :
Bool
- Indicate if the axis of reduction should remain in the result
Examples
a = [[2, 1], [1, 2]].to_tensor
puts a.argmax(1) # => [0, 1]
Find the maximum index value of a Tensor along an axis
Arguments
- a :
Tensor(U, ARROW(U))
-Tensor
to reduce - axis :
Int
- Axis of reduction - dims :
Bool
- Indicate if the axis of reduction should remain in the result
Examples
a = [[2, 1], [1, 2]].to_tensor
puts a.argmax(1) # => [0, 1]
Find the maximum index value of a Tensor
Arguments
Examples
a = [1, 10, 1].to_tensor
a.argmax # => 1
Find the maximum index value of a Tensor
Arguments
Examples
a = [1, 10, 1].to_tensor
a.argmax # => 1
Find the minimum index value of a Tensor along an axis
Arguments
- a :
Tensor(U, CPU(U))
-Tensor
to reduce - axis :
Int
- Axis of reduction - dims :
Bool
- Indicate if the axis of reduction should remain in the result
Examples
a = [[2, 1], [1, 2]].to_tensor
puts a.argmin(1) # => [1, 0]
Find the minimum index value of a Tensor along an axis
Arguments
- a :
Tensor(U, ARROW(U))
-Tensor
to reduce - axis :
Int
- Axis of reduction - dims :
Bool
- Indicate if the axis of reduction should remain in the result
Examples
a = [[2, 1], [1, 2]].to_tensor
puts a.argmin(1) # => [1, 0]
Find the minimum index value of a Tensor
Arguments
Examples
a = [10, 1, 10].to_tensor
a.argmin # => 1
Find the minimum index value of a Tensor
Arguments
Examples
a = [10, 1, 10].to_tensor
a.argmin # => 1
Split a Tensor
into multiple sub-Tensor
s
Arguments
- a :
Tensor(U, CPU(U))
-Tensor
to split` - ind :
Int
- Number of sections of resultingArray
- axis :
Int
- Axis along which to split
Examples
a = Tensor.range(9)
puts Num.array_split(a, 2) # => [[0, 1, 2, 3, 4], [5, 6, 7, 8]]
Split a Tensor
into multiple sub-Tensor
s, using an explicit mapping
of indices to split the Tensor
Arguments
- a :
Tensor(U, CPU(U))
-Tensor
to split` - ind :
Int
- Array of indices to use when splitting theTensor
- axis :
Int
- Axis along which to split
Examples
a = Tensor.range(9)
puts Num.array_split(a, [1, 3, 5]) # => [[0], [1, 2], [3, 4], [5, 6, 7, 8]]
Split a Tensor
into multiple sub-Tensor
s
Arguments
- a :
Tensor(U, ARROW(U))
-Tensor
to split` - ind :
Int
- Number of sections of resultingArray
- axis :
Int
- Axis along which to split
Examples
a = Tensor.range(9)
puts Num.array_split(a, 2) # => [[0, 1, 2, 3, 4], [5, 6, 7, 8]]
Split a Tensor
into multiple sub-Tensor
s, using an explicit mapping
of indices to split the Tensor
Arguments
- a :
Tensor(U, ARROW(U))
-Tensor
to split` - ind :
Int
- Array of indices to use when splitting theTensor
- axis :
Int
- Axis along which to split
Examples
a = Tensor.range(9)
puts Num.array_split(a, [1, 3, 5]) # => [[0], [1, 2], [3, 4], [5, 6, 7, 8]]
#as_strided
creates a view into the Tensor
given the exact strides
and shape. This means it manipulates the internal data structure
of a Tensor
and, if done incorrectly, the array elements can point
to invalid memory and can corrupt results or crash your program.
It is advisable to always use the original strides
when
calculating new strides to avoid reliance on a contiguous
memory layout.
Furthermore, Tensor
s created with this function often contain
self overlapping memory, so that two elements are identical.
Vectorized write operations on such Tensor
s will typically be
unpredictable. They may even give different results for small,
large, or transposed Tensor
s.
Arguments
- arr :
Tensor
-Tensor
to broadcast - shape :
Array(Int)
- Shape of broadcastedTensor
- strides :
Array(Int)
- Strides of broadcastedTensor
Examples
a = Tensor.from_array [1, 2, 3]
a.as_strided([3, 3], [0, 1])
# [[1, 2, 3],
# [1, 2, 3],
# [1, 2, 3]]
Convert a scalar value to a Tensor
like the one specified, matching
the data type and target compute.
Examples
t = Tensor(Float32, OCL(Float32)).from_array([0.5, 0.2])
x = Num.as_tensor(12, like: t)
x = Num.as_tensor(12, like: Tensor(Float32, OCL(Float32)))
Casts a Tensor
to a new dtype, by making a copy. Information may
be lost when converting between data types, for example Float to Int
or Int to Bool.
Arguments
- u :
U.class
- Data type theTensor
will be cast to
Examples
a = Tensor.from_array [1.5, 2.5, 3.5]
a.astype(Int32) # => [1, 2, 3]
a.astype(Bool) # => [true, true, true]
a.astype(Float32) # => [1.5, 2.5, 3.5]
Casts a Tensor
to a new dtype, by making a copy. Information may
be lost when converting between data types, for example Float to Int
or Int to Bool.
Arguments
- u :
U.class
- Data type theTensor
will be cast to
Examples
a = Tensor.from_array [1.5, 2.5, 3.5]
a.astype(Int32) # => [1, 2, 3]
a.astype(Bool) # => [true, true, true]
a.astype(Float32) # => [1.5, 2.5, 3.5]
Implements the stdlib Math method asin on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.asin(a)
Implements the OpenCL builtin function asin for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.asin(a)
Implements the stdlib Math method asin on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.asin(a)
Implements the stdlib Math method asin on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.asin(a)
Implements the OpenCL builtin function asin for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.asin!(a)
Implements the stdlib Math method asin on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.asin(a)
Implements the stdlib Math method asinh on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.asinh(a)
Implements the OpenCL builtin function asinh for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.asinh(a)
Implements the stdlib Math method asinh on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.asinh(a)
Implements the stdlib Math method asinh on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.asinh(a)
Implements the OpenCL builtin function asinh for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.asinh!(a)
Implements the stdlib Math method asinh on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.asinh(a)
Implements the OpenCL builtin function asinpi for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.asinpi(a)
Implements the OpenCL builtin function asinpi for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.asinpi!(a)
Implements the stdlib Math method atan on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.atan(a)
Implements the OpenCL builtin function atan for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.atan(a)
Implements the stdlib Math method atan on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.atan(a)
Implements the stdlib Math method atan on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.atan(a)
Implements the OpenCL builtin function atan for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.atan!(a)
Implements the stdlib Math method atan on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.atan(a)
Implements the stdlib Math method atan2 on two Tensor
s,
broadcasting the Tensor
s together.
Arguments
- a :
Tensor(U, CPU(U))
- LHS argument to the method - b :
Tensor(V, CPU(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.atan2(a, b)
Implements the stdlib Math method atan2 on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.atan2(a, b)
Implements the stdlib Math method atan2 on a Number
and a
Tensor
, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = 1.5
b = [2.0, 3.65, 3.141].to_tensor
Num.atan2(a, b)
Implements the OpenCL builtin function atan2 between two Tensor
s
Arguments
- a :
Tensor(U, OCL(U))
- LHSTensor
for the operation - b :
Tensor(U, OCL(U))
- RHSTensor
for the operation
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
b = [0.2, 0.5, 0.1].to_tensor(OCL)
Num.atan2(a, b)
Implements the OpenCL builtin function atan2 between two a Tensor
and a Number
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.atan2(a, 3_f64)
Implements the OpenCL builtin function atan2 between two a Tensor
and a Number
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.atan2(3_f64, a)
Implements the stdlib Math method atan2 on two Tensor
s,
broadcasting the Tensor
s together.
Arguments
- a :
Tensor(U, ARROW(U))
- LHS argument to the method - b :
Tensor(V, ARROW(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.atan2(a, b)
Implements the stdlib Math method atan2 on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.atan2(a, b)
Implements the stdlib Math method atan2 on a Number
and a
Tensor
, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = 1.5
b = [2.0, 3.65, 3.141].to_tensor
Num.atan2(a, b)
Implements the stdlib Math method atan2 on a Tensor
,
broadcasting the Tensor
s together. The second Tensor
must
broadcast against the shape of the first, as the first Tensor
is modified inplace.
Arguments
- a :
Tensor(U, CPU(U))
- LHS argument to the method - b :
Tensor(V, CPU(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.atan2!(a, b)
Implements the stdlib Math method atan2 on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
.
The Tensor
is modified inplace
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.atan2!(a, b)
Implements the OpenCL builtin function atan2 between two Tensor
s,
mutating the first Tensor
, modifying it to store the result of the
operation
Arguments
- a :
Tensor(U, OCL(U))
- LHSTensor
for the operation - b :
Tensor(U, OCL(U))
- RHSTensor
for the operation
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
b = [0.2, 0.5, 0.1].to_tensor(OCL)
Num.atan2!(a, b)
Implements the stdlib Math method atan2 on a Tensor
,
broadcasting the Tensor
s together. The second Tensor
must
broadcast against the shape of the first, as the first Tensor
is modified inplace.
Arguments
- a :
Tensor(U, ARROW(U))
- LHS argument to the method - b :
Tensor(V, ARROW(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.atan2!(a, b)
Implements the stdlib Math method atan2 on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
.
The Tensor
is modified inplace
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.atan2!(a, b)
Implements the stdlib Math method atanh on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.atanh(a)
Implements the OpenCL builtin function atanh for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.atanh(a)
Implements the stdlib Math method atanh on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.atanh(a)
Implements the stdlib Math method atanh on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.atanh(a)
Implements the OpenCL builtin function atanh for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.atanh!(a)
Implements the stdlib Math method atanh on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.atanh(a)
Implements the OpenCL builtin function atanpi for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.atanpi(a)
Implements the OpenCL builtin function atanpi for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.atanpi!(a)
Implements the stdlib Math method besselj on two Tensor
s,
broadcasting the Tensor
s together.
Arguments
- a :
Tensor(U, CPU(U))
- LHS argument to the method - b :
Tensor(V, CPU(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.besselj(a, b)
Implements the stdlib Math method besselj on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.besselj(a, b)
Implements the stdlib Math method besselj on a Number
and a
Tensor
, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = 1.5
b = [2.0, 3.65, 3.141].to_tensor
Num.besselj(a, b)
Implements the stdlib Math method besselj on two Tensor
s,
broadcasting the Tensor
s together.
Arguments
- a :
Tensor(U, ARROW(U))
- LHS argument to the method - b :
Tensor(V, ARROW(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.besselj(a, b)
Implements the stdlib Math method besselj on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.besselj(a, b)
Implements the stdlib Math method besselj on a Number
and a
Tensor
, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = 1.5
b = [2.0, 3.65, 3.141].to_tensor
Num.besselj(a, b)
Implements the stdlib Math method besselj on a Tensor
,
broadcasting the Tensor
s together. The second Tensor
must
broadcast against the shape of the first, as the first Tensor
is modified inplace.
Arguments
- a :
Tensor(U, CPU(U))
- LHS argument to the method - b :
Tensor(V, CPU(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.besselj!(a, b)
Implements the stdlib Math method besselj on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
.
The Tensor
is modified inplace
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.besselj!(a, b)
Implements the stdlib Math method besselj on a Tensor
,
broadcasting the Tensor
s together. The second Tensor
must
broadcast against the shape of the first, as the first Tensor
is modified inplace.
Arguments
- a :
Tensor(U, ARROW(U))
- LHS argument to the method - b :
Tensor(V, ARROW(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.besselj!(a, b)
Implements the stdlib Math method besselj on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
.
The Tensor
is modified inplace
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.besselj!(a, b)
Implements the stdlib Math method besselj0 on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.besselj0(a)
Implements the stdlib Math method besselj0 on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.besselj0(a)
Implements the stdlib Math method besselj0 on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.besselj0(a)
Implements the stdlib Math method besselj0 on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.besselj0(a)
Implements the stdlib Math method besselj1 on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.besselj1(a)
Implements the stdlib Math method besselj1 on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.besselj1(a)
Implements the stdlib Math method besselj1 on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.besselj1(a)
Implements the stdlib Math method besselj1 on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.besselj1(a)
Implements the stdlib Math method bessely on two Tensor
s,
broadcasting the Tensor
s together.
Arguments
- a :
Tensor(U, CPU(U))
- LHS argument to the method - b :
Tensor(V, CPU(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.bessely(a, b)
Implements the stdlib Math method bessely on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.bessely(a, b)
Implements the stdlib Math method bessely on a Number
and a
Tensor
, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = 1.5
b = [2.0, 3.65, 3.141].to_tensor
Num.bessely(a, b)
Implements the stdlib Math method bessely on two Tensor
s,
broadcasting the Tensor
s together.
Arguments
- a :
Tensor(U, ARROW(U))
- LHS argument to the method - b :
Tensor(V, ARROW(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.bessely(a, b)
Implements the stdlib Math method bessely on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.bessely(a, b)
Implements the stdlib Math method bessely on a Number
and a
Tensor
, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = 1.5
b = [2.0, 3.65, 3.141].to_tensor
Num.bessely(a, b)
Implements the stdlib Math method bessely on a Tensor
,
broadcasting the Tensor
s together. The second Tensor
must
broadcast against the shape of the first, as the first Tensor
is modified inplace.
Arguments
- a :
Tensor(U, CPU(U))
- LHS argument to the method - b :
Tensor(V, CPU(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.bessely!(a, b)
Implements the stdlib Math method bessely on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
.
The Tensor
is modified inplace
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.bessely!(a, b)
Implements the stdlib Math method bessely on a Tensor
,
broadcasting the Tensor
s together. The second Tensor
must
broadcast against the shape of the first, as the first Tensor
is modified inplace.
Arguments
- a :
Tensor(U, ARROW(U))
- LHS argument to the method - b :
Tensor(V, ARROW(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.bessely!(a, b)
Implements the stdlib Math method bessely on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
.
The Tensor
is modified inplace
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.bessely!(a, b)
Implements the stdlib Math method bessely0 on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.bessely0(a)
Implements the stdlib Math method bessely0 on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.bessely0(a)
Implements the stdlib Math method bessely0 on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.bessely0(a)
Implements the stdlib Math method bessely0 on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.bessely0(a)
Implements the stdlib Math method bessely1 on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.bessely1(a)
Implements the stdlib Math method bessely1 on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.bessely1(a)
Implements the stdlib Math method bessely1 on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.bessely1(a)
Implements the stdlib Math method bessely1 on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.bessely1(a)
Implements the :& operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.bitwise_and(a, b)
Implements the :& operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.bitwise_and(a, b)
Implements the :& operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.bitwise_and(b, a)
Implements the bitwise operator "&" between two Tensor
s.
Only Int32
and UInt32
Tensor
s are supported
Arguments
- a :
Tensor(U, OCL(U))
- LHS argument to the "&" operator - b :
Tensor(U, OCL(U))
- RHS argument to the "&" operator
Examples
a = [12, 3, 5].to_tensor(OCL)
b = [1, 8, 5.to_tensor(OCL)
Num.bitwise_and(a, a)
Implements the bitwise operator "&" between a Tensor
and
a Number
Only Int32
and UInt32
Tensor
s are supported
Arguments
Examples
a = [12, 3, 5].to_tensor(OCL)
Num.bitwise_and(a, 3)
Implements the bitwise operator "&" between a Tensor
and
a Number
Only Int32
and UInt32
Tensor
s are supported
Arguments
Examples
a = [12, 3, 5].to_tensor(OCL)
Num.bitwise_and(3, a)
Implements the :& operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise_arrow.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.bitwise_and(a, b)
Implements the :& operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.bitwise_and(a, b)
Implements the :& operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.bitwise_and(b, a)
Implements the :& operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.bitwise_and!(a, b) # a is modified
Implements the :& operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.bitwise_and!(a, b)
Implements the :& operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.bitwise_and!(a, b) # a is modified
Implements the :& operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.bitwise_and!(a, b)
Implements the :| operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.bitwise_or(a, b)
Implements the :| operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.bitwise_or(a, b)
Implements the :| operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.bitwise_or(b, a)
Implements the bitwise operator "|" between two Tensor
s.
Only Int32
and UInt32
Tensor
s are supported
Arguments
- a :
Tensor(U, OCL(U))
- LHS argument to the "|" operator - b :
Tensor(U, OCL(U))
- RHS argument to the "|" operator
Examples
a = [12, 3, 5].to_tensor(OCL)
b = [1, 8, 5.to_tensor(OCL)
Num.bitwise_or(a, a)
Implements the bitwise operator "|" between a Tensor
and
a Number
Only Int32
and UInt32
Tensor
s are supported
Arguments
Examples
a = [12, 3, 5].to_tensor(OCL)
Num.bitwise_or(a, 3)
Implements the bitwise operator "|" between a Tensor
and
a Number
Only Int32
and UInt32
Tensor
s are supported
Arguments
Examples
a = [12, 3, 5].to_tensor(OCL)
Num.bitwise_or(3, a)
Implements the :| operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise_arrow.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.bitwise_or(a, b)
Implements the :| operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.bitwise_or(a, b)
Implements the :| operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.bitwise_or(b, a)
Implements the :| operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.bitwise_or!(a, b) # a is modified
Implements the :| operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.bitwise_or!(a, b)
Implements the :| operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.bitwise_or!(a, b) # a is modified
Implements the :| operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.bitwise_or!(a, b)
Implements the :^ operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.bitwise_xor(a, b)
Implements the :^ operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.bitwise_xor(a, b)
Implements the :^ operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.bitwise_xor(b, a)
Implements the bitwise operator "^" between two Tensor
s.
Only Int32
and UInt32
Tensor
s are supported
Arguments
- a :
Tensor(U, OCL(U))
- LHS argument to the "^" operator - b :
Tensor(U, OCL(U))
- RHS argument to the "^" operator
Examples
a = [12, 3, 5].to_tensor(OCL)
b = [1, 8, 5.to_tensor(OCL)
Num.bitwise_xor(a, a)
Implements the bitwise operator "^" between a Tensor
and
a Number
Only Int32
and UInt32
Tensor
s are supported
Arguments
Examples
a = [12, 3, 5].to_tensor(OCL)
Num.bitwise_xor(a, 3)
Implements the bitwise operator "^" between a Tensor
and
a Number
Only Int32
and UInt32
Tensor
s are supported
Arguments
Examples
a = [12, 3, 5].to_tensor(OCL)
Num.bitwise_xor(3, a)
Implements the :^ operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise_arrow.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.bitwise_xor(a, b)
Implements the :^ operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.bitwise_xor(a, b)
Implements the :^ operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.bitwise_xor(b, a)
Implements the :^ operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.bitwise_xor!(a, b) # a is modified
Implements the :^ operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.bitwise_xor!(a, b)
Implements the :^ operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.bitwise_xor!(a, b) # a is modified
Implements the :^ operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.bitwise_xor!(a, b)
Broadcasts two Tensor
's' to a new shape. This allows
for elementwise operations between the two Tensors with the
new shape.
Broadcasting rules apply, and imcompatible shapes will raise an error.
Arguments
- a :
Tensor(U, CPU(U))
- FirstTensor
to broadcast - b :
Tensor(V, CPU(V))
- SecondTensor
to broadcast - c :
Tensor(W, CPU(W))
- ThirdTensor
to broadcast
Examples
a = Tensor.from_array [1, 2, 3]
b = Tensor.new([3, 3]) { |i| i }
c = Tensor.new([3, 3, 3, 3]) { |i| i }
x, y, z = a.broadcast(b, c)
x.shape # => [3, 3, 3, 3]
Broadcasts two Tensor
's' to a new shape. This allows
for elementwise operations between the two Tensors with the
new shape.
Broadcasting rules apply, and imcompatible shapes will raise an error.
Arguments
- a :
Tensor(U, ARROW(U))
- FirstTensor
to broadcast - b :
Tensor(V, ARROW(V))
- SecondTensor
to broadcast - c :
Tensor(W, ARROW(W))
- ThirdTensor
to broadcast
Examples
a = Tensor.from_array [1, 2, 3]
b = Tensor.new([3, 3]) { |i| i }
c = Tensor.new([3, 3, 3, 3]) { |i| i }
x, y, z = a.broadcast(b, c)
x.shape # => [3, 3, 3, 3]
Broadcasts two Tensor
's' to a new shape. This allows
for elementwise operations between the two Tensors with the
new shape.
Broadcasting rules apply, and imcompatible shapes will raise an error.
Arguments
- a :
Tensor(U, CPU(U))
- FirstTensor
to broadcast - b :
Tensor(V, CPU(V))
- SecondTensor
to broadcast
Examples
a = Tensor.from_array [1, 2, 3]
b = Tensor.new([3, 3]) { |i| i }
x, y = a.broadcast(b)
x.shape # => [3, 3]
Broadcasts two Tensor
's' to a new shape. This allows
for elementwise operations between the two Tensors with the
new shape.
Broadcasting rules apply, and imcompatible shapes will raise an error.
Examples
a = Tensor.from_array [1, 2, 3]
b = Tensor.new([3, 3]) { |i| i }
x, y = a.broadcast(b)
x.shape # => [3, 3]
Broadcasts two Tensor
's' to a new shape. This allows
for elementwise operations between the two Tensors with the
new shape.
Broadcasting rules apply, and imcompatible shapes will raise an error.
Arguments
- a :
Tensor(U, ARROW(U))
- FirstTensor
to broadcast - b :
Tensor(V, ARROW(V))
- SecondTensor
to broadcast
Examples
a = Tensor.from_array [1, 2, 3]
b = Tensor.new([3, 3]) { |i| i }
x, y = a.broadcast(b)
x.shape # => [3, 3]
Broadcasts a Tensor
to a new shape. Returns a read-only
view of the original Tensor
. Many elements in the Tensor
will refer to the same memory location, and the result is
rarely contiguous.
Shapes must be broadcastable, and an error will be raised if broadcasting fails.
Arguments
Examples
a = [1, 2, 3].to_tensor
a.broadcast_to([3, 3])
# [[1, 2, 3],
# [1, 2, 3],
# [1, 2, 3]]
Implements the stdlib Math method cbrt on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.cbrt(a)
Implements the OpenCL builtin function cbrt for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.cbrt(a)
Implements the stdlib Math method cbrt on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.cbrt(a)
Implements the stdlib Math method cbrt on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.cbrt(a)
Implements the OpenCL builtin function cbrt for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.cbrt!(a)
Implements the stdlib Math method cbrt on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.cbrt(a)
Implements the OpenCL builtin function ceil for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.ceil(a)
Implements the OpenCL builtin function ceil for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.ceil!(a)
Join a sequence of Tensor
s along an existing axis. The Tensor
s
must have the same shape for all axes other than the axis of
concatenation
Arguments
- arrs :
Array(Tensor)
-Tensor
s to concatenate - axis :
Int
- Axis of concatenation, negative axes are allowed
Examples
a = [1, 2, 3].to_tensor
b = Tensor.from_array [4, 5, 6]
Num.concat([a, b], 0) # => [1, 2, 3, 4, 5, 6]
c = Tensor.new([3, 2, 2]) { |i| i / 2 }
Num.concat([c, c, c], -1)
# [[[0 , 0.5, 0 , 0.5, 0 , 0.5],
# [1 , 1.5, 1 , 1.5, 1 , 1.5]],
#
# [[2 , 2.5, 2 , 2.5, 2 , 2.5],
# [3 , 3.5, 3 , 3.5, 3 , 3.5]],
#
# [[4 , 4.5, 4 , 4.5, 4 , 4.5],
# [5 , 5.5, 5 , 5.5, 5 , 5.5]]]
Join a sequence of Tensor
s along an existing axis. The Tensor
s
must have the same shape for all axes other than the axis of
concatenation
Arguments
- arrs :
Tuple(Tensor)
-Tensor
s to concatenate - axis :
Int
- Axis of concatenation, negative axes are allowed
Examples
a = [1, 2, 3].to_tensor
b = Tensor.from_array [4, 5, 6]
Num.concat([a, b], 0) # => [1, 2, 3, 4, 5, 6]
c = Tensor.new([3, 2, 2]) { |i| i / 2 }
Num.concat([c, c, c], -1)
# [[[0 , 0.5, 0 , 0.5, 0 , 0.5],
# [1 , 1.5, 1 , 1.5, 1 , 1.5]],
#
# [[2 , 2.5, 2 , 2.5, 2 , 2.5],
# [3 , 3.5, 3 , 3.5, 3 , 3.5]],
#
# [[4 , 4.5, 4 , 4.5, 4 , 4.5],
# [5 , 5.5, 5 , 5.5, 5 , 5.5]]]
Implements the stdlib Math method copysign on two Tensor
s,
broadcasting the Tensor
s together.
Arguments
- a :
Tensor(U, CPU(U))
- LHS argument to the method - b :
Tensor(V, CPU(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.copysign(a, b)
Implements the stdlib Math method copysign on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.copysign(a, b)
Implements the stdlib Math method copysign on a Number
and a
Tensor
, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = 1.5
b = [2.0, 3.65, 3.141].to_tensor
Num.copysign(a, b)
Implements the stdlib Math method copysign on two Tensor
s,
broadcasting the Tensor
s together.
Arguments
- a :
Tensor(U, ARROW(U))
- LHS argument to the method - b :
Tensor(V, ARROW(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.copysign(a, b)
Implements the stdlib Math method copysign on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.copysign(a, b)
Implements the stdlib Math method copysign on a Number
and a
Tensor
, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = 1.5
b = [2.0, 3.65, 3.141].to_tensor
Num.copysign(a, b)
Implements the stdlib Math method copysign on a Tensor
,
broadcasting the Tensor
s together. The second Tensor
must
broadcast against the shape of the first, as the first Tensor
is modified inplace.
Arguments
- a :
Tensor(U, CPU(U))
- LHS argument to the method - b :
Tensor(V, CPU(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.copysign!(a, b)
Implements the stdlib Math method copysign on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
.
The Tensor
is modified inplace
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.copysign!(a, b)
Implements the stdlib Math method copysign on a Tensor
,
broadcasting the Tensor
s together. The second Tensor
must
broadcast against the shape of the first, as the first Tensor
is modified inplace.
Arguments
- a :
Tensor(U, ARROW(U))
- LHS argument to the method - b :
Tensor(V, ARROW(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.copysign!(a, b)
Implements the stdlib Math method copysign on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
.
The Tensor
is modified inplace
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.copysign!(a, b)
Implements the stdlib Math method cos on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.cos(a)
Implements the OpenCL builtin function cos for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.cos(a)
Implements the stdlib Math method cos on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.cos(a)
Implements the stdlib Math method cos on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.cos(a)
Implements the OpenCL builtin function cos for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.cos!(a)
Implements the stdlib Math method cos on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.cos(a)
Implements the stdlib Math method cosh on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.cosh(a)
Implements the OpenCL builtin function cosh for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.cosh(a)
Implements the stdlib Math method cosh on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.cosh(a)
Implements the stdlib Math method cosh on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.cosh(a)
Implements the OpenCL builtin function cosh for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.cosh!(a)
Implements the stdlib Math method cosh on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.cosh(a)
Implements the OpenCL builtin function cospi for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.cospi(a)
Implements the OpenCL builtin function cospi for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.cospi!(a)
Converts a CPU Tensor
to CPU. Returns the input array,
no copy is performed.
Arguments
Examples
a = Tensor.new([2, 2]) { |i| i }
a.opencl # => "<4> on OpenCL Backend"
Converts a Tensor
stored on an OpenCL device to a Tensor
stored
on a CPU.
Arguments
Examples
a = Tensor.new([2, 2], device: OCL) { |i| i }
a.cpu # => [[0, 1], [2, 3]]
Converts a ARROW Tensor
to CPU. Returns the input array,
no copy is performed.
Arguments
Examples
a = Tensor.new([2, 2]) { |i| i }
a.opencl # => "<4> on OpenCL Backend"
Returns a view of the diagonal of a Tensor
. This method only works
for two-dimensional arrays.
TODO Implement views for offset diagonals
Arguments
Examples
a = Tensor.new(3, 3) { |i, _| i }
a.diagonal # => [0, 1, 2]
Returns a view of the diagonal of a Tensor
. This method only works
for two-dimensional arrays.
TODO Implement views for offset diagonals
Arguments
Examples
a = Tensor.new(3, 3) { |i, _| i }
a.diagonal # => [0, 1, 2]
Implements the :/ operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.divide(a, b)
Implements the :/ operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.divide(a, b)
Implements the :/ operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.divide(b, a)
Divide two Tensor
s elementwise
Arguments
Examples
a = [1.5, 2.2, 3.2].to_tensor(OCL)
Num.divide(a, a)
Divide a Tensor
and a Number
elementwise
Arguments
Examples
a = [1.5, 2.2, 3.2].to_tensor(OCL)
Num.divide(a, 3.5)
Divide a Number
and a Tensor
elementwise
Arguments
Examples
a = [1.5, 2.2, 3.2].to_tensor(OCL)
Num.divide(a, 3.5)
Implements the :/ operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise_arrow.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.divide(a, b)
Implements the :/ operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.divide(a, b)
Implements the :/ operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.divide(b, a)
Implements the :/ operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.divide!(a, b) # a is modified
Implements the :/ operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.divide!(a, b)
"Divide" two Tensor
s elementwise, storing
the result in the first Tensor
Arguments
- a :
Tensor(U, OCL(U))
- LHS argument to divide, will be modified inplace - b :
Tensor(U, OCL(U))
- RHS argument to divide
Examples
a = [1.5, 2.2, 3.2].to_tensor(OCL)
Num.divide!(a, a)
Divide a Tensor
and a Number
elementwise,
modifying the Tensor
inplace.
Arguments
Examples
a = [1.5, 2.2, 3.2].to_tensor(OCL)
Num.divide(a, 3.5)
Implements the :/ operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.divide!(a, b) # a is modified
Implements the :/ operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.divide!(a, b)
Deep-copies a Tensor
. If an order is provided, the returned
Tensor
's memory layout will respect that order.
If no order is provided, the Tensor
will retain it's same
memory layout.
Arguments
- t :
Tensor(U, CPU(U))
-Tensor
to duplicate - order :
Num::OrderType
- Memory layout to use for the returnedTensor
Examples
a = Tensor.from_array [1, 2, 3]
a.dup # => [1, 2, 3]
Deep-copies a Tensor
. If an order is provided, the returned
Tensor
's memory layout will respect that order.
If no order is provided, the Tensor
will retain it's same
memory layout.
Arguments
- t :
Tensor(U, CPU(U))
-Tensor
to duplicate - order :
Num::OrderType
- Memory layout to use for the returnedTensor
Examples
a = Tensor.from_array [1, 2, 3]
a.dup # => [1, 2, 3]
Yields the elements of a Tensor
, always in RowMajor order,
as if the Tensor
was flat.
Arguments
Examples
a = Tensor.new(2, 2) { |i| i }
a.each do |el|
puts el
end
# 0
# 1
# 2
# 3
Yields the elements of a Tensor
lazily, always in RowMajor order,
as if the Tensor
was flat.
Arguments
Examples
a = Tensor.new(2, 2) { |i| i }
iter = a.each
a.size.times do
puts iter.next.value
end
# 0
# 1
# 2
# 3
Yields the elements of a Tensor
, always in RowMajor order,
as if the Tensor
was flat.
Arguments
Examples
a = Tensor.new(2, 2) { |i| i }
a.each do |el|
puts el
end
# 0
# 1
# 2
# 3
Yields the elements of a Tensor
lazily, always in RowMajor order,
as if the Tensor
was flat.
Arguments
Examples
a = Tensor.new(2, 2) { |i| i }
iter = a.each
a.size.times do
puts iter.next.value
end
# 0
# 1
# 2
# 3
Yields a view of each lane of an axis
. Changes made in
the passed block will be reflected in the original Tensor
Arguments
- a0 :
Tensor(U, CPU(U))
-Tensor
to iterate along - axis :
Int
- Axis of reduction - dims :
Bool
- Indicates if the axis of reduction should be removed from the result
Examples
a = Tensor.new([3, 3]) { |i| i }
a.each_axis(1) do |ax|
puts ax
end
# [0, 3, 6]
# [1, 4, 7]
# [2, 5, 8]
Returns an iterator along each element of an axis
.
Each element returned by the iterator is a view, not a copy
Arguments
- arr :
Tensor(U, CPU(U))
-Tensor
to iterate along - axis :
Int
- Axis of reduction - dims :
Bool
- Indicates if the axis of reduction should be removed from the result
Examples
a = Tensor.new([3, 3]) { |i| i }
a.each_axis(1).next # => [0, 3, 6]
Yields a view of each lane of an axis
. Changes made in
the passed block will be reflected in the original Tensor
Arguments
- a0 :
Tensor(U, OCL(U))
-Tensor
to iterate along - axis :
Int
- Axis of reduction - dims :
Bool
- Indicates if the axis of reduction should be removed from the result
Examples
a = Tensor.new([3, 3], device: OCL) { |i| i }
a.each_axis(1) do |ax|
puts ax.cpu
end
# [0, 3, 6]
# [1, 4, 7]
# [2, 5, 8]
Yields a view of each lane of an axis
. Changes made in
the passed block will be reflected in the original Tensor
Arguments
- a0 :
Tensor(U, ARROW(U))
-Tensor
to iterate along - axis :
Int
- Axis of reduction - dims :
Bool
- Indicates if the axis of reduction should be removed from the result
Examples
a = Tensor.new([3, 3]) { |i| i }
a.each_axis(1) do |ax|
puts ax
end
# [0, 3, 6]
# [1, 4, 7]
# [2, 5, 8]
Returns an iterator along each element of an axis
.
Each element returned by the iterator is a view, not a copy
Arguments
- arr :
Tensor(U, ARROW(U))
-Tensor
to iterate along - axis :
Int
- Axis of reduction - dims :
Bool
- Indicates if the axis of reduction should be removed from the result
Examples
a = Tensor.new([3, 3]) { |i| i }
a.each_axis(1).next # => [0, 3, 6]
Yields the memory locations of each element of a Tensor
, always in
RowMajor oder, as if the Tensor
was flat.
This should primarily be used by internal methods. Methods such
as #map!
provided more convenient access to editing the values
of a Tensor
Arguments
Examples
a = Tensor.new(2, 2) { |i| i }
a.each_pointer do |el|
puts el.value
end
# 0
# 1
# 2
# 3
Yields the memory locations of each element of a Tensor
, always in
RowMajor oder, as if the Tensor
was flat.
This should primarily be used by internal methods. Methods such
as #map!
provided more convenient access to editing the values
of a Tensor
Arguments
Examples
a = Tensor.new(2, 2) { |i| i }
a.each_pointer do |el|
puts el.value
end
# 0
# 1
# 2
# 3
Yields the memory locations of each element of a Tensor
, always in
RowMajor oder, as if the Tensor
was flat.
This should primarily be used by internal methods. Methods such
as #map!
provided more convenient access to editing the values
of a Tensor
Arguments
Examples
a = Tensor.new(2, 2) { |i| i }
a.each_pointer do |el|
puts el.value
end
# 0
# 1
# 2
# 3
Yields the memory locations of each element of a Tensor
, always in
RowMajor oder, as if the Tensor
was flat.
This should primarily be used by internal methods. Methods such
as #map!
provided more convenient access to editing the values
of a Tensor
Arguments
Examples
a = Tensor.new(2, 2) { |i| i }
a.each_pointer do |el|
puts el.value
end
# 0
# 1
# 2
# 3
Yields the elements of a Tensor
, always in RowMajor order,
as if the Tensor
was flat. Also yields the flat index of each
element.
Arguments
Examples
a = Tensor.new(2, 2) { |i| i }
a.each_with_index do |el, i|
puts "#{el}_#{i}"
end
# 0_0
# 1_1
# 2_2
# 3_3
Yields the elements of a Tensor
, always in RowMajor order,
as if the Tensor
was flat. Also yields the flat index of each
element.
Arguments
Examples
a = Tensor.new(2, 2) { |i| i }
a.each_with_index do |el, i|
puts "#{el}_#{i}"
end
# 0_0
# 1_1
# 2_2
# 3_3
Implements the :== operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.equal(a, b)
Implements the :== operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.equal(a, b)
Implements the :== operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.equal(b, a)
Implements the comparison operator "==" between two Tensor
s.
The returned result of OpenCL relational operators will always be
Tensor(Int32, OCL(Int32))
.
Arguments
- a :
Tensor(U, OCL(U))
- LHS argument to the "==" operator - b :
Tensor(U, OCL(U))
- RHS argument to the "==" operator
Examples
a = [12, 3, 5].to_tensor(OCL)
b = [1, 8, 5.to_tensor(OCL)
Num.equal(a, a)
Implements the comparison operator "==" between a Tensor
and a Number
.
The returned result of OpenCL relational operators will always be
Tensor(Int32, OCL(Int32))`.
Arguments
Examples
a = [12, 3, 5].to_tensor(OCL)
Num.equal(a, 3)
Implements the comparison operator "==" between a Number
and a Tensor
.
The returned result of OpenCL relational operators will always be
Tensor(Int32, OCL(Int32))`.
Arguments
Examples
a = [12, 3, 5].to_tensor(OCL)
Num.equal(3, a)
Implements the :== operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise_arrow.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.equal(a, b)
Implements the :== operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.equal(a, b)
Implements the :== operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.equal(b, a)
Implements the :== operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.equal!(a, b) # a is modified
Implements the :== operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.equal!(a, b)
Implements the :== operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.equal!(a, b) # a is modified
Implements the :== operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.equal!(a, b)
Implements the stdlib Math method erf on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.erf(a)
Implements the OpenCL builtin function erf for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.erf(a)
Implements the stdlib Math method erf on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.erf(a)
Implements the stdlib Math method erf on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.erf(a)
Implements the OpenCL builtin function erf for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.erf!(a)
Implements the stdlib Math method erf on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.erf(a)
Implements the stdlib Math method erfc on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.erfc(a)
Implements the OpenCL builtin function erfc for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.erfc(a)
Implements the stdlib Math method erfc on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.erfc(a)
Implements the stdlib Math method erfc on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.erfc(a)
Implements the OpenCL builtin function erfc for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.erfc!(a)
Implements the stdlib Math method erfc on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.erfc(a)
Implements the stdlib Math method exp on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.exp(a)
Implements the OpenCL builtin function exp for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.exp(a)
Implements the stdlib Math method exp on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.exp(a)
Implements the stdlib Math method exp on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.exp(a)
Implements the OpenCL builtin function exp for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.exp!(a)
Implements the stdlib Math method exp on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.exp(a)
Implements the OpenCL builtin function exp10 for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.exp10(a)
Implements the OpenCL builtin function exp10 for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.exp10!(a)
Implements the stdlib Math method exp2 on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.exp2(a)
Implements the OpenCL builtin function exp2 for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.exp2(a)
Implements the stdlib Math method exp2 on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.exp2(a)
Implements the stdlib Math method exp2 on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.exp2(a)
Implements the OpenCL builtin function exp2 for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.exp2!(a)
Implements the stdlib Math method exp2 on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.exp2(a)
Expands a Tensor
along an axis
Arguments
Examples
a = [1, 2, 3].to_tensor
a.expand_dims(0) # => [[1, 2, 3]]
Implements the stdlib Math method expm1 on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.expm1(a)
Implements the OpenCL builtin function expm1 for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.expm1(a)
Implements the stdlib Math method expm1 on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.expm1(a)
Implements the stdlib Math method expm1 on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.expm1(a)
Implements the OpenCL builtin function expm1 for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.expm1!(a)
Implements the stdlib Math method expm1 on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.expm1(a)
Implements the OpenCL builtin function fabs for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.fabs(a)
Implements the OpenCL builtin function fabs for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.fabs!(a)
Flattens a Tensor
to a single dimension. If a view can be created,
the reshape operation will not copy data.
Arguments
Examples
a = Tensor.new([2, 2]) { |i| i }
a.flat # => [0, 1, 2, 3]
Flattens a Tensor
to a single dimension. If a view can be created,
the reshape operation will not copy data.
Arguments
Examples
a = Tensor.new([2, 2]) { |i| i }
a.flat # => [0, 1, 2, 3]
Flips a Tensor
along an axis, returning a view
Arguments
Examples
a = [[1, 2, 3], [4, 5, 6]]
puts Num.flip(a, 1)
# [[3, 2, 1],
# [6, 5, 4]]
Flips a Tensor
along an axis, returning a view
Arguments
Examples
a = [[1, 2, 3], [4, 5, 6]]
puts Num.flip(a, 1)
# [[3, 2, 1],
# [6, 5, 4]]
Flips a Tensor
along all axes, returning a view
Arguments
Examples
a = [[1, 2, 3], [4, 5, 6]]
puts Num.flip(a)
# [[6, 5, 4],
# [3, 2, 1]]
Flips a Tensor
along all axes, returning a view
Arguments
Examples
a = [[1, 2, 3], [4, 5, 6]]
puts Num.flip(a)
# [[6, 5, 4],
# [3, 2, 1]]
Implements the OpenCL builtin function floor for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.floor(a)
Implements the OpenCL builtin function floor for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.floor!(a)
Implements the :// operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.floordiv(a, b)
Implements the :// operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.floordiv(a, b)
Implements the :// operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.floordiv(b, a)
Implements the :// operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise_arrow.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.floordiv(a, b)
Implements the :// operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.floordiv(a, b)
Implements the :// operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.floordiv(b, a)
Implements the :// operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.floordiv!(a, b) # a is modified
Implements the :// operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.floordiv!(a, b)
Implements the :// operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.floordiv!(a, b) # a is modified
Implements the :// operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.floordiv!(a, b)
Implements the stdlib Math method gamma on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.gamma(a)
Implements the stdlib Math method gamma on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.gamma(a)
Implements the stdlib Math method gamma on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.gamma(a)
Implements the stdlib Math method gamma on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.gamma(a)
Implements the :> operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.greater(a, b)
Implements the :> operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.greater(a, b)
Implements the :> operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.greater(b, a)
Implements the comparison operator ">" between two Tensor
s.
The returned result of OpenCL relational operators will always be
Tensor(Int32, OCL(Int32))
.
Arguments
- a :
Tensor(U, OCL(U))
- LHS argument to the ">" operator - b :
Tensor(U, OCL(U))
- RHS argument to the ">" operator
Examples
a = [12, 3, 5].to_tensor(OCL)
b = [1, 8, 5.to_tensor(OCL)
Num.greater(a, a)
Implements the comparison operator ">" between a Tensor
and a Number
.
The returned result of OpenCL relational operators will always be
Tensor(Int32, OCL(Int32))`.
Arguments
Examples
a = [12, 3, 5].to_tensor(OCL)
Num.greater(a, 3)
Implements the comparison operator ">" between a Number
and a Tensor
.
The returned result of OpenCL relational operators will always be
Tensor(Int32, OCL(Int32))`.
Arguments
Examples
a = [12, 3, 5].to_tensor(OCL)
Num.greater(3, a)
Implements the :> operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise_arrow.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.greater(a, b)
Implements the :> operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.greater(a, b)
Implements the :> operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.greater(b, a)
Implements the :> operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.greater!(a, b) # a is modified
Implements the :> operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.greater!(a, b)
Implements the :> operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.greater!(a, b) # a is modified
Implements the :> operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.greater!(a, b)
Implements the :>= operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.greater_equal(a, b)
Implements the :>= operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.greater_equal(a, b)
Implements the :>= operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.greater_equal(b, a)
Implements the comparison operator ">=" between two Tensor
s.
The returned result of OpenCL relational operators will always be
Tensor(Int32, OCL(Int32))
.
Arguments
- a :
Tensor(U, OCL(U))
- LHS argument to the ">=" operator - b :
Tensor(U, OCL(U))
- RHS argument to the ">=" operator
Examples
a = [12, 3, 5].to_tensor(OCL)
b = [1, 8, 5.to_tensor(OCL)
Num.greater_equal(a, a)
Implements the comparison operator ">=" between a Tensor
and a Number
.
The returned result of OpenCL relational operators will always be
Tensor(Int32, OCL(Int32))`.
Arguments
Examples
a = [12, 3, 5].to_tensor(OCL)
Num.greater_equal(a, 3)
Implements the comparison operator ">=" between a Number
and a Tensor
.
The returned result of OpenCL relational operators will always be
Tensor(Int32, OCL(Int32))`.
Arguments
Examples
a = [12, 3, 5].to_tensor(OCL)
Num.greater_equal(3, a)
Implements the :>= operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise_arrow.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.greater_equal(a, b)
Implements the :>= operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.greater_equal(a, b)
Implements the :>= operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.greater_equal(b, a)
Implements the :>= operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.greater_equal!(a, b) # a is modified
Implements the :>= operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.greater_equal!(a, b)
Implements the :>= operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.greater_equal!(a, b) # a is modified
Implements the :>= operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.greater_equal!(a, b)
Stack an array of Tensor
s in sequence column-wise. While this
method can take Tensor
s with any number of dimensions, it makes
the most sense with rank <= 3
For one dimensional Tensor
s, this will still stack along the
first axis
Arguments
Examples
a = [1, 2, 3].to_tensor
Num.h_concat([a, a]) # => [1, 2, 3, 1, 2, 3]
b = [[1, 2], [3, 4]].to_tensor
Num.h_concat([b, b])
# [[1, 2, 1, 2],
# [3, 4, 3, 4]]
Stack an array of Tensor
s in sequence column-wise. While this
method can take Tensor
s with any number of dimensions, it makes
the most sense with rank <= 3
For one dimensional Tensor
s, this will still stack along the
first axis
Arguments
Examples
a = [1, 2, 3].to_tensor
Num.h_concat([a, a]) # => [1, 2, 3, 1, 2, 3]
b = [[1, 2], [3, 4]].to_tensor
Num.h_concat([b, b])
# [[1, 2, 1, 2],
# [3, 4, 3, 4]]
Implements the stdlib Math method hypot on two Tensor
s,
broadcasting the Tensor
s together.
Arguments
- a :
Tensor(U, CPU(U))
- LHS argument to the method - b :
Tensor(V, CPU(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.hypot(a, b)
Implements the stdlib Math method hypot on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.hypot(a, b)
Implements the stdlib Math method hypot on a Number
and a
Tensor
, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = 1.5
b = [2.0, 3.65, 3.141].to_tensor
Num.hypot(a, b)
Implements the stdlib Math method hypot on two Tensor
s,
broadcasting the Tensor
s together.
Arguments
- a :
Tensor(U, ARROW(U))
- LHS argument to the method - b :
Tensor(V, ARROW(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.hypot(a, b)
Implements the stdlib Math method hypot on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.hypot(a, b)
Implements the stdlib Math method hypot on a Number
and a
Tensor
, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = 1.5
b = [2.0, 3.65, 3.141].to_tensor
Num.hypot(a, b)
Implements the stdlib Math method hypot on a Tensor
,
broadcasting the Tensor
s together. The second Tensor
must
broadcast against the shape of the first, as the first Tensor
is modified inplace.
Arguments
- a :
Tensor(U, CPU(U))
- LHS argument to the method - b :
Tensor(V, CPU(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.hypot!(a, b)
Implements the stdlib Math method hypot on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
.
The Tensor
is modified inplace
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.hypot!(a, b)
Implements the stdlib Math method hypot on a Tensor
,
broadcasting the Tensor
s together. The second Tensor
must
broadcast against the shape of the first, as the first Tensor
is modified inplace.
Arguments
- a :
Tensor(U, ARROW(U))
- LHS argument to the method - b :
Tensor(V, ARROW(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.hypot!(a, b)
Implements the stdlib Math method hypot on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
.
The Tensor
is modified inplace
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.hypot!(a, b)
Implements the stdlib Math method ilogb on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.ilogb(a)
Implements the stdlib Math method ilogb on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.ilogb(a)
Implements the stdlib Math method ilogb on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.ilogb(a)
Implements the stdlib Math method ilogb on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.ilogb(a)
Implements the stdlib Math method ldexp on two Tensor
s,
broadcasting the Tensor
s together.
Arguments
- a :
Tensor(U, CPU(U))
- LHS argument to the method - b :
Tensor(V, CPU(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.ldexp(a, b)
Implements the stdlib Math method ldexp on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.ldexp(a, b)
Implements the stdlib Math method ldexp on a Number
and a
Tensor
, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = 1.5
b = [2.0, 3.65, 3.141].to_tensor
Num.ldexp(a, b)
Implements the stdlib Math method ldexp on two Tensor
s,
broadcasting the Tensor
s together.
Arguments
- a :
Tensor(U, ARROW(U))
- LHS argument to the method - b :
Tensor(V, ARROW(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.ldexp(a, b)
Implements the stdlib Math method ldexp on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.ldexp(a, b)
Implements the stdlib Math method ldexp on a Number
and a
Tensor
, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = 1.5
b = [2.0, 3.65, 3.141].to_tensor
Num.ldexp(a, b)
Implements the stdlib Math method ldexp on a Tensor
,
broadcasting the Tensor
s together. The second Tensor
must
broadcast against the shape of the first, as the first Tensor
is modified inplace.
Arguments
- a :
Tensor(U, CPU(U))
- LHS argument to the method - b :
Tensor(V, CPU(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.ldexp!(a, b)
Implements the stdlib Math method ldexp on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
.
The Tensor
is modified inplace
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.ldexp!(a, b)
Implements the stdlib Math method ldexp on a Tensor
,
broadcasting the Tensor
s together. The second Tensor
must
broadcast against the shape of the first, as the first Tensor
is modified inplace.
Arguments
- a :
Tensor(U, ARROW(U))
- LHS argument to the method - b :
Tensor(V, ARROW(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.ldexp!(a, b)
Implements the stdlib Math method ldexp on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
.
The Tensor
is modified inplace
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.ldexp!(a, b)
Implements the :<< operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.left_shift(a, b)
Implements the :<< operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.left_shift(a, b)
Implements the :<< operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.left_shift(b, a)
Implements the bitwise operator "<<" between two Tensor
s.
Only Int32
and UInt32
Tensor
s are supported
Arguments
- a :
Tensor(U, OCL(U))
- LHS argument to the "<<" operator - b :
Tensor(U, OCL(U))
- RHS argument to the "<<" operator
Examples
a = [12, 3, 5].to_tensor(OCL)
b = [1, 8, 5.to_tensor(OCL)
Num.left_shift(a, a)
Implements the bitwise operator "<<" between a Tensor
and
a Number
Only Int32
and UInt32
Tensor
s are supported
Arguments
Examples
a = [12, 3, 5].to_tensor(OCL)
Num.left_shift(a, 3)
Implements the bitwise operator "<<" between a Tensor
and
a Number
Only Int32
and UInt32
Tensor
s are supported
Arguments
Examples
a = [12, 3, 5].to_tensor(OCL)
Num.left_shift(3, a)
Implements the :<< operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise_arrow.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.left_shift(a, b)
Implements the :<< operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.left_shift(a, b)
Implements the :<< operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.left_shift(b, a)
Implements the :<< operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.left_shift!(a, b) # a is modified
Implements the :<< operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.left_shift!(a, b)
Implements the :<< operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.left_shift!(a, b) # a is modified
Implements the :<< operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.left_shift!(a, b)
Implements the :< operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.less(a, b)
Implements the :< operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.less(a, b)
Implements the :< operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.less(b, a)
Implements the comparison operator "<" between two Tensor
s.
The returned result of OpenCL relational operators will always be
Tensor(Int32, OCL(Int32))
.
Arguments
- a :
Tensor(U, OCL(U))
- LHS argument to the "<" operator - b :
Tensor(U, OCL(U))
- RHS argument to the "<" operator
Examples
a = [12, 3, 5].to_tensor(OCL)
b = [1, 8, 5.to_tensor(OCL)
Num.less(a, a)
Implements the comparison operator "<" between a Tensor
and a Number
.
The returned result of OpenCL relational operators will always be
Tensor(Int32, OCL(Int32))`.
Arguments
Examples
a = [12, 3, 5].to_tensor(OCL)
Num.less(a, 3)
Implements the comparison operator "<" between a Number
and a Tensor
.
The returned result of OpenCL relational operators will always be
Tensor(Int32, OCL(Int32))`.
Arguments
Examples
a = [12, 3, 5].to_tensor(OCL)
Num.less(3, a)
Implements the :< operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise_arrow.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.less(a, b)
Implements the :< operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.less(a, b)
Implements the :< operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.less(b, a)
Implements the :< operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.less!(a, b) # a is modified
Implements the :< operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.less!(a, b)
Implements the :< operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.less!(a, b) # a is modified
Implements the :< operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.less!(a, b)
Implements the :<= operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.less_equal(a, b)
Implements the :<= operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.less_equal(a, b)
Implements the :<= operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.less_equal(b, a)
Implements the comparison operator "<=" between two Tensor
s.
The returned result of OpenCL relational operators will always be
Tensor(Int32, OCL(Int32))
.
Arguments
- a :
Tensor(U, OCL(U))
- LHS argument to the "<=" operator - b :
Tensor(U, OCL(U))
- RHS argument to the "<=" operator
Examples
a = [12, 3, 5].to_tensor(OCL)
b = [1, 8, 5.to_tensor(OCL)
Num.less_equal(a, a)
Implements the comparison operator "<=" between a Tensor
and a Number
.
The returned result of OpenCL relational operators will always be
Tensor(Int32, OCL(Int32))`.
Arguments
Examples
a = [12, 3, 5].to_tensor(OCL)
Num.less_equal(a, 3)
Implements the comparison operator "<=" between a Number
and a Tensor
.
The returned result of OpenCL relational operators will always be
Tensor(Int32, OCL(Int32))`.
Arguments
Examples
a = [12, 3, 5].to_tensor(OCL)
Num.less_equal(3, a)
Implements the :<= operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise_arrow.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.less_equal(a, b)
Implements the :<= operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.less_equal(a, b)
Implements the :<= operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.less_equal(b, a)
Implements the :<= operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.less_equal!(a, b) # a is modified
Implements the :<= operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.less_equal!(a, b)
Implements the :<= operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.less_equal!(a, b) # a is modified
Implements the :<= operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.less_equal!(a, b)
Implements the stdlib Math method lgamma on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.lgamma(a)
Implements the OpenCL builtin function lgamma for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.lgamma(a)
Implements the stdlib Math method lgamma on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.lgamma(a)
Implements the stdlib Math method lgamma on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.lgamma(a)
Implements the OpenCL builtin function lgamma for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.lgamma!(a)
Implements the stdlib Math method lgamma on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.lgamma(a)
Implements the stdlib Math method log on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.log(a)
Implements the OpenCL builtin function log for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.log(a)
Implements the stdlib Math method log on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.log(a)
Implements the stdlib Math method log on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.log(a)
Implements the OpenCL builtin function log for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.log!(a)
Implements the stdlib Math method log on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.log(a)
Implements the stdlib Math method log10 on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.log10(a)
Implements the OpenCL builtin function log10 for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.log10(a)
Implements the stdlib Math method log10 on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.log10(a)
Implements the stdlib Math method log10 on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.log10(a)
Implements the OpenCL builtin function log10 for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.log10!(a)
Implements the stdlib Math method log10 on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.log10(a)
Implements the stdlib Math method log1p on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.log1p(a)
Implements the OpenCL builtin function log1p for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.log1p(a)
Implements the stdlib Math method log1p on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.log1p(a)
Implements the stdlib Math method log1p on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.log1p(a)
Implements the OpenCL builtin function log1p for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.log1p!(a)
Implements the stdlib Math method log1p on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.log1p(a)
Implements the stdlib Math method log2 on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.log2(a)
Implements the OpenCL builtin function log2 for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.log2(a)
Implements the stdlib Math method log2 on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.log2(a)
Implements the stdlib Math method log2 on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.log2(a)
Implements the OpenCL builtin function log2 for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.log2!(a)
Implements the stdlib Math method log2 on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.log2(a)
Implements the stdlib Math method logb on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.logb(a)
Implements the OpenCL builtin function logb for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.logb(a)
Implements the stdlib Math method logb on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.logb(a)
Implements the stdlib Math method logb on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.logb(a)
Implements the OpenCL builtin function logb for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.logb!(a)
Implements the stdlib Math method logb on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.logb(a)
Maps a block across three Tensors
. This is more efficient than
zipping iterators since it iterates all Tensor
's in a single
call, avoiding overhead from tracking multiple iterators.
The generic type of the returned Tensor
is inferred from a block
Arguments
- a0 :
Tensor(U, CPU(U))
- FirstTensor
for iteration, must be broadcastable against the shape of a1 and a2 - a1 :
Tensor(V, CPU(V))
- SecondTensor
for iteration, must be broadcastable against the shape of a0 and a2 - a2 :
Tensor(W, CPU(W))
- ThirdTensor
for iteration, must be broadcastable against the shape of a0 and a1 - block :
Proc(T, U, V)
- The block to map across bothTensor
s
Examples
a = Tensor.new([3]) { |i| i }
b = Tensor.new([3]) { |i| i }
c = Tensor.new([3]) { |i| i }
a.map(b, c) { |i, j, k| i + j + k } # => [0, 3, 6]
Maps a block across three Tensors
. This is more efficient than
zipping iterators since it iterates all Tensor
's in a single
call, avoiding overhead from tracking multiple iterators.
The generic type of the returned Tensor
is inferred from a block
Arguments
- a0 :
Tensor(U, ARROW(U))
- FirstTensor
for iteration, must be broadcastable against the shape of a1 and a2 - a1 :
Tensor(V, ARROW(V))
- SecondTensor
for iteration, must be broadcastable against the shape of a0 and a2 - a2 :
Tensor(W, ARROW(W))
- ThirdTensor
for iteration, must be broadcastable against the shape of a0 and a1 - block :
Proc(T, U, V)
- The block to map across bothTensor
s
Examples
a = Tensor.new([3]) { |i| i }
b = Tensor.new([3]) { |i| i }
c = Tensor.new([3]) { |i| i }
a.map(b, c) { |i, j, k| i + j + k } # => [0, 3, 6]
Maps a block across two Tensors
. This is more efficient than
zipping iterators since it iterates both Tensor
's in a single
call, avoiding overhead from tracking multiple iterators.
The generic type of the returned Tensor
is inferred from a block
Arguments
- a0 :
Tensor(U, CPU(U))
- FirstTensor
for iteration, must be broadcastable against the shape of a1 - a1 :
Tensor(V, CPU(V))
- SecondTensor
for iteration, must be broadcastable against the shape of a0 - block :
Proc(T, U, V)
- The block to map across bothTensor
s
Examples
a = Tensor.new([3]) { |i| i }
b = Tensor.new([3]) { |i| i }
a.map(b) { |i, j| i + j } # => [0, 2, 4]
Maps a block across two Tensors
. This is more efficient than
zipping iterators since it iterates both Tensor
's in a single
call, avoiding overhead from tracking multiple iterators.
The generic type of the returned Tensor
is inferred from a block
Arguments
- a0 :
Tensor(U, ARROW(U))
- FirstTensor
for iteration, must be broadcastable against the shape of a1 - a1 :
Tensor(V, ARROW(V))
- SecondTensor
for iteration, must be broadcastable against the shape of a0 - block :
Proc(T, U, V)
- The block to map across bothTensor
s
Examples
a = Tensor.new([3]) { |i| i }
b = Tensor.new([3]) { |i| i }
a.map(b) { |i, j| i + j } # => [0, 2, 4]
Maps a block across a Tensor
. The Tensor
is treated
as flat during iteration, and iteration is always done
in RowMajor order
The generic type of the returned Tensor
is inferred from
the block
Arguments
- arr :
Tensor(U, CPU(U))
-Tensor
to map theProc
across - block :
Proc(T, U)
- Proc to map across theTensor
Examples
a = Tensor.new([3]) { |i| i }
a.map { |e| e + 5 } # => [5, 6, 7]
Maps a block across a Tensor
. The Tensor
is treated
as flat during iteration, and iteration is always done
in RowMajor order
The generic type of the returned Tensor
is inferred from
the block
Arguments
- arr :
Tensor(U, ARROW(U))
-Tensor
to map theProc
across - block :
Proc(T, U)
- Proc to map across theTensor
Examples
a = Tensor.new([3]) { |i| i }
a.map { |e| e + 5 } # => [5, 6, 7]
Maps a block across three Tensors
. This is more efficient than
zipping iterators since it iterates all Tensor
's in a single
call, avoiding overhead from tracking multiple iterators.
The result of the block is stored in self
.
Broadcasting rules still apply, but since this is an in place
operation, the other Tensor
's must broadcast to the shape of self
Arguments
- a0 :
Tensor(U, CPU(U))
- FirstTensor
for iteration - a1 :
Tensor(V, CPU(V))
- SecondTensor
for iteration, must be broadcastable against the shape of a0 - a2 :
Tensor(W, CPU(W))
- ThirdTensor
for iteration, must be broadcastable against the shape of a0 - block :
Proc(T, U, V)
- The block to map across bothTensor
s
Examples
a = Tensor.new([3]) { |i| i }
b = Tensor.new([3]) { |i| i }
c = Tensor.new([3]) { |i| i }
a.map!(b, c) { |i, j, k| i + j + k }
a # => [0, 3, 6]
Maps a block across three Tensors
. This is more efficient than
zipping iterators since it iterates all Tensor
's in a single
call, avoiding overhead from tracking multiple iterators.
The result of the block is stored in self
.
Broadcasting rules still apply, but since this is an in place
operation, the other Tensor
's must broadcast to the shape of self
Arguments
- a0 :
Tensor(U, ARROW(U))
- FirstTensor
for iteration - a1 :
Tensor(V, ARROW(V))
- SecondTensor
for iteration, must be broadcastable against the shape of a0 - a2 :
Tensor(W, ARROW(W))
- ThirdTensor
for iteration, must be broadcastable against the shape of a0 - block :
Proc(T, U, V)
- The block to map across bothTensor
s
Examples
a = Tensor.new([3]) { |i| i }
b = Tensor.new([3]) { |i| i }
c = Tensor.new([3]) { |i| i }
a.map!(b, c) { |i, j, k| i + j + k }
a # => [0, 3, 6]
Maps a block across two Tensors
. This is more efficient than
zipping iterators since it iterates both Tensor
's in a single
call, avoiding overhead from tracking multiple iterators.
The result of the block is stored in self
.
Broadcasting rules still apply, but since this is an in place
operation, the other Tensor
must broadcast to the shape of self
Arguments
- a0 :
Tensor(U, CPU(U))
- FirstTensor
for iteration - a1 :
Tensor(V, CPU(V))
- SecondTensor
for iteration, must be broadcastable against the shape of a0 - block :
Proc(T, U, V)
- The block to map across bothTensor
s
Examples
a = Tensor.new([3]) { |i| i }
b = Tensor.new([3]) { |i| i }
a.map!(b) { |i, j| i + j }
a # => [0, 2, 4]
Maps a block across two Tensors
. This is more efficient than
zipping iterators since it iterates both Tensor
's in a single
call, avoiding overhead from tracking multiple iterators.
The result of the block is stored in self
.
Broadcasting rules still apply, but since this is an in place
operation, the other Tensor
must broadcast to the shape of self
Arguments
- a0 :
Tensor(U, ARROW(U))
- FirstTensor
for iteration - a1 :
Tensor(V, ARROW(V))
- SecondTensor
for iteration, must be broadcastable against the shape of a0 - block :
Proc(T, U, V)
- The block to map across bothTensor
s
Examples
a = Tensor.new([3]) { |i| i }
b = Tensor.new([3]) { |i| i }
a.map!(b) { |i, j| i + j }
a # => [0, 2, 4]
Maps a block across a Tensor
in place. The Tensor
is treated
as flat during iteration, and iteration is always done
in RowMajor order
Arguments
- arr :
Tensor(U, CPU(U))
-Tensor
to map theProc
across - block :
Proc(T, U)
- Proc to map across theTensor
Examples
a = Tensor.new([3]) { |i| i }
a.map! { |e| e + 5 }
a # => [5, 6, 7]
Maps a block across a Tensor
in place. The Tensor
is treated
as flat during iteration, and iteration is always done
in RowMajor order
Arguments
- arr :
Tensor(U, ARROW(U))
-Tensor
to map theProc
across - block :
Proc(T, U)
- Proc to map across theTensor
Examples
a = Tensor.new([3]) { |i| i }
a.map! { |e| e + 5 }
a # => [5, 6, 7]
Implements the stdlib Math method max on two Tensor
s,
broadcasting the Tensor
s together.
Arguments
- a :
Tensor(U, CPU(U))
- LHS argument to the method - b :
Tensor(V, CPU(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.max(a, b)
Reduces a Tensor
along an axis, finding the max of each
view into the Tensor
Arguments
- a :
Tensor(U, CPU(U))
-Tensor
to reduce - axis :
Int
- Axis of reduction - dims :
Bool
- Indicate if the axis of reduction should remain in the result
Examples
a = Tensor.new([2, 2]) { |i| i }
Num.max(a, 0) # => [2, 3]
Num.max(a, 1, dims: true)
# [[1],
# [3]]
Implements the stdlib Math method max on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.max(a, b)
Implements the stdlib Math method max on a Number
and a
Tensor
, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = 1.5
b = [2.0, 3.65, 3.141].to_tensor
Num.max(a, b)
Implements the OpenCL builtin function fmax between two Tensor
s
Arguments
- a :
Tensor(U, OCL(U))
- LHSTensor
for the operation - b :
Tensor(U, OCL(U))
- RHSTensor
for the operation
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
b = [0.2, 0.5, 0.1].to_tensor(OCL)
Num.fmax(a, b)
Implements the OpenCL builtin function fmax between two a Tensor
and a Number
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.fmax(a, 3_f64)
Implements the OpenCL builtin function fmax between two a Tensor
and a Number
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.fmax(3_f64, a)
Implements the stdlib Math method max on two Tensor
s,
broadcasting the Tensor
s together.
Arguments
- a :
Tensor(U, ARROW(U))
- LHS argument to the method - b :
Tensor(V, ARROW(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.max(a, b)
Reduces a Tensor
along an axis, finding the max of each
view into the Tensor
Arguments
- a :
Tensor(U, ARROW(U))
-Tensor
to reduce - axis :
Int
- Axis of reduction - dims :
Bool
- Indicate if the axis of reduction should remain in the result
Examples
a = Tensor.new([2, 2]) { |i| i }
Num.max(a, 0) # => [2, 3]
Num.max(a, 1, dims: true)
# [[1],
# [3]]
Implements the stdlib Math method max on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.max(a, b)
Implements the stdlib Math method max on a Number
and a
Tensor
, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = 1.5
b = [2.0, 3.65, 3.141].to_tensor
Num.max(a, b)
Reduces a Tensor
to a scalar by finding the maximum value
Arguments
Examples
a = [1, 2, 3]
Num.max(a) # => 3
Reduces a Tensor
to a scalar by finding the maximum value
Arguments
Examples
a = [1, 2, 3]
Num.max(a) # => 3
Implements the stdlib Math method max on a Tensor
,
broadcasting the Tensor
s together. The second Tensor
must
broadcast against the shape of the first, as the first Tensor
is modified inplace.
Arguments
- a :
Tensor(U, CPU(U))
- LHS argument to the method - b :
Tensor(V, CPU(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.max!(a, b)
Implements the stdlib Math method max on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
.
The Tensor
is modified inplace
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.max!(a, b)
Implements the OpenCL builtin function fmax between two Tensor
s,
mutating the first Tensor
, modifying it to store the result of the
operation
Arguments
- a :
Tensor(U, OCL(U))
- LHSTensor
for the operation - b :
Tensor(U, OCL(U))
- RHSTensor
for the operation
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
b = [0.2, 0.5, 0.1].to_tensor(OCL)
Num.fmax!(a, b)
Implements the stdlib Math method max on a Tensor
,
broadcasting the Tensor
s together. The second Tensor
must
broadcast against the shape of the first, as the first Tensor
is modified inplace.
Arguments
- a :
Tensor(U, ARROW(U))
- LHS argument to the method - b :
Tensor(V, ARROW(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.max!(a, b)
Implements the stdlib Math method max on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
.
The Tensor
is modified inplace
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.max!(a, b)
Reduces a Tensor
along an axis, finding the average of each
view into the Tensor
Arguments
- a :
Tensor(U, CPU(U))
-Tensor
to reduce - axis :
Int
- Axis of reduction - dims :
Bool
- Indicate if the axis of reduction should remain in the result
Examples
a = Tensor.new([2, 2]) { |i| i }
Num.mean(a, 0) # => [1, 2]
Num.mean(a, 1, dims: true)
# [[0],
# [2]]
Reduces a Tensor
along an axis, finding the average of each
view into the Tensor
Arguments
- a :
Tensor(U, ARROW(U))
-Tensor
to reduce - axis :
Int
- Axis of reduction - dims :
Bool
- Indicate if the axis of reduction should remain in the result
Examples
a = Tensor.new([2, 2]) { |i| i }
Num.mean(a, 0) # => [1, 2]
Num.mean(a, 1, dims: true)
# [[0],
# [2]]
Reduces a Tensor
to a scalar by finding the average
Arguments
Examples
a = [1, 2, 3]
Num.mean(a) # => 2.0
Reduces a Tensor
to a scalar by finding the average
Arguments
Examples
a = [1, 2, 3]
Num.mean(a) # => 2.0
Implements the stdlib Math method min on two Tensor
s,
broadcasting the Tensor
s together.
Arguments
- a :
Tensor(U, CPU(U))
- LHS argument to the method - b :
Tensor(V, CPU(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.min(a, b)
Reduces a Tensor
along an axis, finding the min of each
view into the Tensor
Arguments
- a :
Tensor(U, CPU(U))
-Tensor
to reduce - axis :
Int
- Axis of reduction - dims :
Bool
- Indicate if the axis of reduction should remain in the result
Examples
a = Tensor.new([2, 2]) { |i| i }
Num.min(a, 0) # => [0, 1]
Num.min(a, 1, dims: true)
# [[0],
# [2]]
Implements the stdlib Math method min on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.min(a, b)
Implements the stdlib Math method min on a Number
and a
Tensor
, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = 1.5
b = [2.0, 3.65, 3.141].to_tensor
Num.min(a, b)
Implements the OpenCL builtin function fmin between two Tensor
s
Arguments
- a :
Tensor(U, OCL(U))
- LHSTensor
for the operation - b :
Tensor(U, OCL(U))
- RHSTensor
for the operation
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
b = [0.2, 0.5, 0.1].to_tensor(OCL)
Num.fmin(a, b)
Implements the OpenCL builtin function fmin between two a Tensor
and a Number
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.fmin(a, 3_f64)
Implements the OpenCL builtin function fmin between two a Tensor
and a Number
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.fmin(3_f64, a)
Implements the stdlib Math method min on two Tensor
s,
broadcasting the Tensor
s together.
Arguments
- a :
Tensor(U, ARROW(U))
- LHS argument to the method - b :
Tensor(V, ARROW(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.min(a, b)
Reduces a Tensor
along an axis, finding the min of each
view into the Tensor
Arguments
- a :
Tensor(U, ARROW(U))
-Tensor
to reduce - axis :
Int
- Axis of reduction - dims :
Bool
- Indicate if the axis of reduction should remain in the result
Examples
a = Tensor.new([2, 2]) { |i| i }
Num.min(a, 0) # => [0, 1]
Num.min(a, 1, dims: true)
# [[0],
# [2]]
Implements the stdlib Math method min on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.min(a, b)
Implements the stdlib Math method min on a Number
and a
Tensor
, broadcasting the method across all elements of a Tensor
Arguments
Examples
a = 1.5
b = [2.0, 3.65, 3.141].to_tensor
Num.min(a, b)
Reduces a Tensor
to a scalar by finding the minimum value
Arguments
Examples
a = [1, 2, 3]
Num.min(a) # => 3
Reduces a Tensor
to a scalar by finding the minimum value
Arguments
Examples
a = [1, 2, 3]
Num.min(a) # => 3
Implements the stdlib Math method min on a Tensor
,
broadcasting the Tensor
s together. The second Tensor
must
broadcast against the shape of the first, as the first Tensor
is modified inplace.
Arguments
- a :
Tensor(U, CPU(U))
- LHS argument to the method - b :
Tensor(V, CPU(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.min!(a, b)
Implements the stdlib Math method min on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
.
The Tensor
is modified inplace
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.min!(a, b)
Implements the OpenCL builtin function fmin between two Tensor
s,
mutating the first Tensor
, modifying it to store the result of the
operation
Arguments
- a :
Tensor(U, OCL(U))
- LHSTensor
for the operation - b :
Tensor(U, OCL(U))
- RHSTensor
for the operation
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
b = [0.2, 0.5, 0.1].to_tensor(OCL)
Num.fmin!(a, b)
Implements the stdlib Math method min on a Tensor
,
broadcasting the Tensor
s together. The second Tensor
must
broadcast against the shape of the first, as the first Tensor
is modified inplace.
Arguments
- a :
Tensor(U, ARROW(U))
- LHS argument to the method - b :
Tensor(V, ARROW(V))
- RHS argument to the method
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = [1.45, 3.2, 1.18]
Num.min!(a, b)
Implements the stdlib Math method min on a Tensor
and a
Number, broadcasting the method across all elements of a Tensor
.
The Tensor
is modified inplace
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
b = 1.5
Num.min!(a, b)
Implements the :% operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.modulo(a, b)
Implements the :% operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.modulo(a, b)
Implements the :% operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.modulo(b, a)
Implements the :% operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise_arrow.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.modulo(a, b)
Implements the :% operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.modulo(a, b)
Implements the :% operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.modulo(b, a)
Implements the :% operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.modulo!(a, b) # a is modified
Implements the :% operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.modulo!(a, b)
Implements the :% operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.modulo!(a, b) # a is modified
Implements the :% operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.modulo!(a, b)
Move axes of a Tensor to new positions, other axes remain in their original order
Arguments
- arr :
Tensor(U, CPU(U))
-Tensor
to permute - source :
Array(Int)
- Original positions of axes - destination :
Array(Int)
- Destination positions of axes
Examples
a = Tensor(Int8, CPU(Int8)).new([3, 4, 5])
Num.moveaxis(a, [0], [-1]).shape # => 4, 5, 3
Move axes of a Tensor to new positions, other axes remain in their original order
Arguments
- arr :
Tensor(U, CPU(U))
-Tensor
to permute - source :
Int
- Original position of axis - destination :
Int
- Destination position of axis
Examples
a = Tensor(Int8, CPU(Int8)).new([3, 4, 5])
Num.moveaxis(a, 0, 1).shape # => 4, 5, 3
Move axes of a Tensor to new positions, other axes remain in their original order
Arguments
- arr :
Tensor(U, ARROW(U))
-Tensor
to permute - source :
Array(Int)
- Original positions of axes - destination :
Array(Int)
- Destination positions of axes
Examples
a = Tensor(Int8, ARROW(Int8)).new([3, 4, 5])
Num.moveaxis(a, [0], [-1]).shape # => 4, 5, 3
Move axes of a Tensor to new positions, other axes remain in their original order
Arguments
- arr :
Tensor(U, ARROW(U))
-Tensor
to permute - source :
Int
- Original position of axis - destination :
Int
- Destination position of axis
Examples
a = Tensor(Int8, ARROW(Int8)).new([3, 4, 5])
Num.moveaxis(a, 0, 1).shape # => 4, 5, 3
Implements the :* operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.multiply(a, b)
Implements the :* operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.multiply(a, b)
Implements the :* operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.multiply(b, a)
Multiply two Tensor
s elementwise
Arguments
Examples
a = [1.5, 2.2, 3.2].to_tensor(OCL)
Num.multiply(a, a)
Multiply a Tensor
and a Number
elementwise
Arguments
Examples
a = [1.5, 2.2, 3.2].to_tensor(OCL)
Num.multiply(a, 3.5)
Multiply a Number
and a Tensor
elementwise
Arguments
Examples
a = [1.5, 2.2, 3.2].to_tensor(OCL)
Num.multiply(a, 3.5)
Implements the :* operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise_arrow.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.multiply(a, b)
Implements the :* operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.multiply(a, b)
Implements the :* operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.multiply(b, a)
Implements the :* operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.multiply!(a, b) # a is modified
Implements the :* operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.multiply!(a, b)
"Multiply" two Tensor
s elementwise, storing
the result in the first Tensor
Arguments
- a :
Tensor(U, OCL(U))
- LHS argument to multiply, will be modified inplace - b :
Tensor(U, OCL(U))
- RHS argument to multiply
Examples
a = [1.5, 2.2, 3.2].to_tensor(OCL)
Num.multiply!(a, a)
Multiply a Tensor
and a Number
elementwise,
modifying the Tensor
inplace.
Arguments
Examples
a = [1.5, 2.2, 3.2].to_tensor(OCL)
Num.multiply(a, 3.5)
Implements the :* operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.multiply!(a, b) # a is modified
Implements the :* operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.multiply!(a, b)
Implements the negation operator on a Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
Num.negate(a) # => [-1, -2, -3]
Implements the negation operator on a Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
Num.negate(a) # => [-1, -2, -3]
Implements the negation operator on a Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
Num.negate(a) # => [-1, -2, -3]
Implements the :!= operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.not_equal(a, b)
Implements the :!= operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.not_equal(a, b)
Implements the :!= operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.not_equal(b, a)
Implements the comparison operator "!=" between two Tensor
s.
The returned result of OpenCL relational operators will always be
Tensor(Int32, OCL(Int32))
.
Arguments
- a :
Tensor(U, OCL(U))
- LHS argument to the "!=" operator - b :
Tensor(U, OCL(U))
- RHS argument to the "!=" operator
Examples
a = [12, 3, 5].to_tensor(OCL)
b = [1, 8, 5.to_tensor(OCL)
Num.not_equal(a, a)
Implements the comparison operator "!=" between a Tensor
and a Number
.
The returned result of OpenCL relational operators will always be
Tensor(Int32, OCL(Int32))`.
Arguments
Examples
a = [12, 3, 5].to_tensor(OCL)
Num.not_equal(a, 3)
Implements the comparison operator "!=" between a Number
and a Tensor
.
The returned result of OpenCL relational operators will always be
Tensor(Int32, OCL(Int32))`.
Arguments
Examples
a = [12, 3, 5].to_tensor(OCL)
Num.not_equal(3, a)
Implements the :!= operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise_arrow.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.not_equal(a, b)
Implements the :!= operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.not_equal(a, b)
Implements the :!= operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.not_equal(b, a)
Implements the :!= operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.not_equal!(a, b) # a is modified
Implements the :!= operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.not_equal!(a, b)
Implements the :!= operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.not_equal!(a, b) # a is modified
Implements the :!= operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.not_equal!(a, b)
Places a Tensor
stored on a CPU onto an OpenCL Device.
Arguments
Examples
a = Tensor.new([2, 2]) { |i| i }
a.opencl # => "<4> on OpenCL Backend"
Places a Tensor
stored on a ARROW onto an OpenCL Device.
Arguments
Examples
a = Tensor.new([2, 2]) { |i| i }
a.opencl # => "<4> on OpenCL Backend"
Implements the :** operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.power(a, b)
Implements the :** operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.power(a, b)
Implements the :** operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.power(b, a)
Implements the OpenCL builtin function pow between two Tensor
s
Arguments
- a :
Tensor(U, OCL(U))
- LHSTensor
for the operation - b :
Tensor(U, OCL(U))
- RHSTensor
for the operation
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
b = [0.2, 0.5, 0.1].to_tensor(OCL)
Num.pow(a, b)
Implements the OpenCL builtin function pow between two a Tensor
and a Number
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.pow(a, 3_f64)
Implements the OpenCL builtin function pow between two a Tensor
and a Number
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.pow(3_f64, a)
Implements the :** operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise_arrow.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.power(a, b)
Implements the :** operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.power(a, b)
Implements the :** operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.power(b, a)
Implements the :** operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.power!(a, b) # a is modified
Implements the :** operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.power!(a, b)
Implements the OpenCL builtin function pow between two Tensor
s,
mutating the first Tensor
, modifying it to store the result of the
operation
Arguments
- a :
Tensor(U, OCL(U))
- LHSTensor
for the operation - b :
Tensor(U, OCL(U))
- RHSTensor
for the operation
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
b = [0.2, 0.5, 0.1].to_tensor(OCL)
Num.pow!(a, b)
Implements the :** operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.power!(a, b) # a is modified
Implements the :** operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.power!(a, b)
Reduces a Tensor
along an axis, multiplying each view into
the Tensor
Arguments
- a :
Tensor(U, CPU(U))
-Tensor
to reduce - axis :
Int
- Axis of reduction - dims :
Bool
- Indicate if the axis of reduction should remain in the result
Examples
a = Tensor.new([2, 2]) { |i| i }
Num.prod(a, 0) # => [0, 3]
Num.prod(a, 1, dims: true)
# [[0],
# [6]]
Reduces a Tensor
along an axis, multiplying each view into
the Tensor
Arguments
- a :
Tensor(U, ARROW(U))
-Tensor
to reduce - axis :
Int
- Axis of reduction - dims :
Bool
- Indicate if the axis of reduction should remain in the result
Examples
a = Tensor.new([2, 2]) { |i| i }
Num.prod(a, 0) # => [0, 3]
Num.prod(a, 1, dims: true)
# [[0],
# [6]]
Reduces a Tensor
to a scalar by multiplying all of its
elements
Arguments
Examples
a = [1, 2, 3]
Num.prod(a) # => 6
Reduces a Tensor
to a scalar by multiplying all of its
elements
Arguments
Examples
a = [1, 2, 3]
Num.prod(a) # => 6
Finds the difference between the maximum and minimum
elements of a Tensor
along an axis
Arguments
- a :
Tensor(U, CPU(U))
-Tensor
to reduce - axis :
Int
- Axis of reduction - dims :
Bool
- Indicate if the axis of reduction should remain in the result
Examples
a = [[3, 4], [1, 2], [6, 2]]
Num.ptp(a, 1) # [1, 1, 4]
Finds the difference between the maximum and minimum
elements of a Tensor
along an axis
Arguments
- a :
Tensor(U, ARROW(U))
-Tensor
to reduce - axis :
Int
- Axis of reduction - dims :
Bool
- Indicate if the axis of reduction should remain in the result
Examples
a = [[3, 4], [1, 2], [6, 2]]
Num.ptp(a, 1) # [1, 1, 4]
Finds the difference between the maximum and minimum
elements of a Tensor
Arguments
Examples
a = [1, 2, 3]
Num.ptp(a) # => 2
Finds the difference between the maximum and minimum
elements of a Tensor
Arguments
Examples
a = [1, 2, 3]
Num.ptp(a) # => 2
Reduces a Tensor
along an axis. Returns a Tensor
, with the axis
of reduction either removed, or reduced to 1 if dims
is True, which
allows the result to broadcast against its previous shape
Arguments
- a0 :
Tensor(U, CPU(U))
-Tensor
to reduce along an axis - axis :
Int
- Axis of reduction - dims :
Bool
- Flag determining whether the axis of reduction should be kept in the result - block :
Proc(U, U, _)
-Proc
to apply to values along an axis
Examples
a = Tensor.new([2, 2]) { |i| i }
a.reduce_axis(0) { |i, j| i + j } # => [2, 4]
Reduces a Tensor
along an axis. Returns a Tensor
, with the axis
of reduction either removed, or reduced to 1 if dims
is True, which
allows the result to broadcast against its previous shape
Arguments
- a0 :
Tensor(U, OCL(U))
-Tensor
to reduce along an axis - axis :
Int
- Axis of reduction - dims :
Bool
- Flag determining whether the axis of reduction should be kept in the result - block :
Proc(Tensor(U, OCL(U)), Tensor(U, OCL(U)), _)
-Proc
to apply to values along an axis
Examples
a = Tensor.new([2, 2]) { |i| i }
a.reduce_axis(0) { |i, j| Num.add!(i, j) } # => "<2> on OpenCL Backend"
Reduces a Tensor
along an axis. Returns a Tensor
, with the axis
of reduction either removed, or reduced to 1 if dims
is True, which
allows the result to broadcast against its previous shape
Arguments
- a0 :
Tensor(U, ARROW(U))
-Tensor
to reduce along an axis - axis :
Int
- Axis of reduction - dims :
Bool
- Flag determining whether the axis of reduction should be kept in the result - block :
Proc(U, U, _)
-Proc
to apply to values along an axis
Examples
a = Tensor.new([2, 2]) { |i| i }
a.reduce_axis(0) { |i, j| i + j } # => [2, 4]
Repeat elements of a Tensor
along an axis
Arguments
- a :
Tensor(U, CPU(U))
-Tensor
to repeat - n :
Int
- Number of times to repeat - axis :
Int
- Axis along which to repeat
Examples
a = [[1, 2, 3], [4, 5, 6]]
Num.repeat(a, 2, 1)
# [[1, 1, 2, 2, 3, 3],
# [4, 4, 5, 5, 6, 6]]
Repeat elements of a Tensor
along an axis
Arguments
- a :
Tensor(U, ARROW(U))
-Tensor
to repeat - n :
Int
- Number of times to repeat - axis :
Int
- Axis along which to repeat
Examples
a = [[1, 2, 3], [4, 5, 6]]
Num.repeat(a, 2, 1)
# [[1, 1, 2, 2, 3, 3],
# [4, 4, 5, 5, 6, 6]]
Repeat elements of a Tensor
, treating the Tensor
as flat
Arguments
Examples
a = [1, 2, 3]
Num.repeat(a, 2) # => [1, 1, 2, 2, 3, 3]
Repeat elements of a Tensor
, treating the Tensor
as flat
Arguments
Examples
a = [1, 2, 3]
Num.repeat(a, 2) # => [1, 1, 2, 2, 3, 3]
Transform's a Tensor
's shape. If a view can be created,
the reshape will not copy data. The number of elements
in the Tensor
must remain the same.
Arguments
Examples
a = Tensor.from_array [1, 2, 3, 4]
a.reshape([2, 2])
# [[1, 2],
# [3, 4]]
Transform's a Tensor
's shape. If a view can be created,
the reshape will not copy data. The number of elements
in the Tensor
must remain the same.
Arguments
Examples
a = Tensor.from_array [1, 2, 3, 4]
a.reshape([2, 2])
# [[1, 2],
# [3, 4]]
Transform's a Tensor
's shape. If a view can be created,
the reshape will not copy data. The number of elements
in the Tensor
must remain the same.
Arguments
Examples
a = Tensor.from_array [1, 2, 3, 4]
a.reshape([2, 2])
# [[1, 2],
# [3, 4]]
Transform's a Tensor
's shape. If a view can be created,
the reshape will not copy data. The number of elements
in the Tensor
must remain the same.
Arguments
Examples
a = Tensor.from_array [1, 2, 3, 4]
a.reshape([2, 2])
# [[1, 2],
# [3, 4]]
Implements the :>> operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.right_shift(a, b)
Implements the :>> operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.right_shift(a, b)
Implements the :>> operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.right_shift(b, a)
Implements the bitwise operator ">>" between two Tensor
s.
Only Int32
and UInt32
Tensor
s are supported
Arguments
- a :
Tensor(U, OCL(U))
- LHS argument to the ">>" operator - b :
Tensor(U, OCL(U))
- RHS argument to the ">>" operator
Examples
a = [12, 3, 5].to_tensor(OCL)
b = [1, 8, 5.to_tensor(OCL)
Num.right_shift(a, a)
Implements the bitwise operator ">>" between a Tensor
and
a Number
Only Int32
and UInt32
Tensor
s are supported
Arguments
Examples
a = [12, 3, 5].to_tensor(OCL)
Num.right_shift(a, 3)
Implements the bitwise operator ">>" between a Tensor
and
a Number
Only Int32
and UInt32
Tensor
s are supported
Arguments
Examples
a = [12, 3, 5].to_tensor(OCL)
Num.right_shift(3, a)
Implements the :>> operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise_arrow.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.right_shift(a, b)
Implements the :>> operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.right_shift(a, b)
Implements the :>> operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.right_shift(b, a)
Implements the :>> operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.right_shift!(a, b) # a is modified
Implements the :>> operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.right_shift!(a, b)
Implements the :>> operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.right_shift!(a, b) # a is modified
Implements the :>> operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.right_shift!(a, b)
Implements the OpenCL builtin function rint for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.rint(a)
Implements the OpenCL builtin function rint for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.rint!(a)
Implements the OpenCL builtin function round for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.round(a)
Implements the OpenCL builtin function round for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.round!(a)
Implements the OpenCL builtin function rsqrt for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.rsqrt(a)
Implements the OpenCL builtin function rsqrt for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.rsqrt!(a)
The primary method of setting Tensor values. The slicing behavior
for this method is identical to the []
method.
If a Tensor
is passed as the value to set, it will be broadcast
to the shape of the slice if possible. If a scalar is passed, it will
be tiled across the slice.
Arguments
- arr :
Tensor(U, CPU(U))
-Tensor
to which values will be assigned - args :
Array
- Array of arguments. All arguments must be valid indexers, so aRange
,Int
, orTuple(Range, Int)
. - value :
Tensor(V, CPU(V))
- Argument to assign to theTensor
Examples
a = Tensor.new([2, 2]) { |i| i }
a[1.., 1..] = 99
a
# [[ 0, 1],
# [ 2, 99]]
The primary method of setting Tensor values. The slicing behavior
for this method is identical to the []
method.
If a Tensor
is passed as the value to set, it will be broadcast
to the shape of the slice if possible. If a scalar is passed, it will
be tiled across the slice.
Arguments
- arr :
Tensor(U, CPU(U))
-Tensor
to which values will be assigned - args :
Array
- Tuple of arguments. All arguments must be valid indexers, so aRange
,Int
, orTuple(Range, Int)
. - value :
V
- Argument to assign to theTensor
Examples
a = Tensor.new([2, 2]) { |i| i }
a[1.., 1..] = 99
a
# [[ 0, 1],
# [ 2, 99]]
The primary method of setting Tensor values. The slicing behavior
for this method is identical to the []
method.
If a Tensor
is passed as the value to set, it will be broadcast
to the shape of the slice if possible. If a scalar is passed, it will
be tiled across the slice.
Arguments
- arr :
Tensor(U, OCL(U))
-Tensor
to which values will be assigned - args :
Array
- Array of arguments. All arguments must be valid indexers, so aRange
,Int
, orTuple(Range, Int)
. - value :
Tensor(U, OCL(U))
- Argument to assign to theTensor
Examples
a = Tensor.new([2, 2], device: OCL) { |i| i }
a[1.., 1..] = 99
a
# [[ 0, 1],
# [ 2, 99]]
The primary method of setting Tensor values. The slicing behavior
for this method is identical to the []
method.
If a Tensor
is passed as the value to set, it will be broadcast
to the shape of the slice if possible. If a scalar is passed, it will
be tiled across the slice.
Arguments
- arr :
Tensor(U, OCL(U))
-Tensor
to which values will be assigned - args :
Array
- Array of arguments. All arguments must be valid indexers, so aRange
,Int
, orTuple(Range, Int)
. - value :
U
- Argument to assign to theTensor
Examples
a = Tensor.new([2, 2], device: OCL) { |i| i }
a[1.., 1..] = 99
a
# [[ 0, 1],
# [ 2, 99]]
The primary method of setting Tensor values. The slicing behavior
for this method is identical to the []
method.
If a Tensor
is passed as the value to set, it will be broadcast
to the shape of the slice if possible. If a scalar is passed, it will
be tiled across the slice.
Arguments
- arr :
Tensor(U, ARROW(U))
-Tensor
to which values will be assigned - args :
Array
- Array of arguments. All arguments must be valid indexers, so aRange
,Int
, orTuple(Range, Int)
. - value :
Tensor(V, ARROW(V))
- Argument to assign to theTensor
Examples
a = Tensor.new([2, 2]) { |i| i }
a[1.., 1..] = 99
a
# [[ 0, 1],
# [ 2, 99]]
The primary method of setting Tensor values. The slicing behavior
for this method is identical to the []
method.
If a Tensor
is passed as the value to set, it will be broadcast
to the shape of the slice if possible. If a scalar is passed, it will
be tiled across the slice.
Arguments
- arr :
Tensor(U, ARROW(U))
-Tensor
to which values will be assigned - args :
Array
- Tuple of arguments. All arguments must be valid indexers, so aRange
,Int
, orTuple(Range, Int)
. - value :
V
- Argument to assign to theTensor
Examples
a = Tensor.new([2, 2]) { |i| i }
a[1.., 1..] = 99
a
# [[ 0, 1],
# [ 2, 99]]
The primary method of setting Tensor values. The slicing behavior
for this method is identical to the []
method.
If a Tensor
is passed as the value to set, it will be broadcast
to the shape of the slice if possible. If a scalar is passed, it will
be tiled across the slice.
Arguments
- arr :
Tensor(U, CPU(U))
-Tensor
to which values will be assigned - args :
Tuple
- Tuple of arguments. All arguments must be valid indexers, so aRange
,Int
, orTuple(Range, Int)
. - value :
Tensor | Number
- Argument to assign to theTensor
Examples
a = Tensor.new([2, 2]) { |i| i }
a[1.., 1..] = 99
a
# [[ 0, 1],
# [ 2, 99]]
The primary method of setting Tensor values. The slicing behavior
for this method is identical to the []
method.
If a Tensor
is passed as the value to set, it will be broadcast
to the shape of the slice if possible. If a scalar is passed, it will
be tiled across the slice.
Arguments
- arr :
Tensor(U, OCL(U))
-Tensor
to which values will be assigned - args :
Tuple
- Tuple of arguments. All arguments must be valid indexers, so aRange
,Int
, orTuple(Range, Int)
. - value :
Tensor | Number
- Argument to assign to theTensor
Examples
a = Tensor.new([2, 2], device: OCL) { |i| i }
a[1.., 1..] = 99
a.cpu
# [[ 0, 1],
# [ 2, 99]]
The primary method of setting Tensor values. The slicing behavior
for this method is identical to the []
method.
If a Tensor
is passed as the value to set, it will be broadcast
to the shape of the slice if possible. If a scalar is passed, it will
be tiled across the slice.
Arguments
- arr :
Tensor(U, ARROW(U))
-Tensor
to which values will be assigned - args :
Tuple
- Tuple of arguments. All arguments must be valid indexers, so aRange
,Int
, orTuple(Range, Int)
. - value :
Tensor | Number
- Argument to assign to theTensor
Examples
a = Tensor.new([2, 2]) { |i| i }
a[1.., 1..] = 99
a
# [[ 0, 1],
# [ 2, 99]]
Implements the stdlib Math method sin on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.sin(a)
Implements the OpenCL builtin function sin for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.sin(a)
Implements the stdlib Math method sin on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.sin(a)
Implements the stdlib Math method sin on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.sin(a)
Implements the OpenCL builtin function sin for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.sin!(a)
Implements the stdlib Math method sin on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.sin(a)
Implements the stdlib Math method sinh on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.sinh(a)
Implements the OpenCL builtin function sinh for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.sinh(a)
Implements the stdlib Math method sinh on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.sinh(a)
Implements the stdlib Math method sinh on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.sinh(a)
Implements the OpenCL builtin function sinh for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.sinh!(a)
Implements the stdlib Math method sinh on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.sinh(a)
Implements the OpenCL builtin function sinpi for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.sinpi(a)
Implements the OpenCL builtin function sinpi for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.sinpi!(a)
Returns a view of a Tensor
from any valid indexers. This view
must be able to be represented as valid strided/shaped view, slicing
as a copy is not supported.
When an Integer argument is passed, an axis will be removed from
the Tensor
, and a view at that index will be returned.
a = Tensor.new([2, 2]) { |i| i }
a[0] # => [0, 1]
When a Range argument is passed, an axis will be sliced based on the endpoints of the range.
a = Tensor.new([2, 2, 2]) { |i| i }
a[1...]
# [[[4, 5],
# [6, 7]]]
When a Tuple containing a Range and an Integer step is passed, an axis is sliced based on the endpoints of the range, and the strides of the axis are updated to reflect the step. Negative steps will reflect the array along an axis.
a = Tensor.new([2, 2]) { |i| i }
a[{..., -1}]
# [[2, 3],
# [0, 1]]
Returns a view of a Tensor
from any valid indexers. This view
must be able to be represented as valid strided/shaped view, slicing
as a copy is not supported.
When an Integer argument is passed, an axis will be removed from
the Tensor
, and a view at that index will be returned.
a = Tensor.new([2, 2]) { |i| i }
a[0] # => [0, 1]
When a Range argument is passed, an axis will be sliced based on the endpoints of the range.
a = Tensor.new([2, 2, 2]) { |i| i }
a[1...]
# [[[4, 5],
# [6, 7]]]
When a Tuple containing a Range and an Integer step is passed, an axis is sliced based on the endpoints of the range, and the strides of the axis are updated to reflect the step. Negative steps will reflect the array along an axis.
a = Tensor.new([2, 2]) { |i| i }
a[{..., -1}]
# [[2, 3],
# [0, 1]]
Sorts a Tensor
along an axis.
Arguments
Examples
t = Tensor.random(0...10, [3, 3, 2])
puts Num.sort(t, axis: 1)
# [[[1, 1],
# [4, 5],
# [5, 7]],
#
# [[0, 0],
# [2, 3],
# [8, 4]],
#
# [[2, 5],
# [5, 7],
# [5, 7]]]
Sorts a Tensor
along an axis.
Arguments
Examples
t = Tensor.random(0...10, [3, 3, 2])
puts Num.sort(t, axis: 1)
# [[[1, 1],
# [4, 5],
# [5, 7]],
#
# [[0, 0],
# [2, 3],
# [8, 4]],
#
# [[2, 5],
# [5, 7],
# [5, 7]]]
Sorts a Tensor
, treating it's elements like the Tensor
is flat.
Arguments
Examples
a = [3, 2, 1].to_tensor
Num.sort(a) # => [1, 2, 3]
Sorts a Tensor
along an axis.
Arguments
- a :
Tensor(U, CPU(U))
-Tensor
to sort - axis :
Int
- Axis along which to sort - block :
Proc(U, U, _)
-Proc
to use to sort
Examples
t = Tensor.random(0...10, [3, 3, 2])
puts Num.sort(t, axis: 1) { |i, j| i <=> j }
# [[[3, 1],
# [4, 3],
# [6, 8]],
#
# [[4, 2],
# [5, 3],
# [9, 7]],
#
# [[0, 1],
# [2, 2],
# [4, 9]]]
Sorts a Tensor
along an axis.
Arguments
- a :
Tensor(U, ARROW(U))
-Tensor
to sort - axis :
Int
- Axis along which to sort - block :
Proc(U, U, _)
-Proc
to use to sort
Examples
t = Tensor.random(0...10, [3, 3, 2])
puts Num.sort(t, axis: 1) { |i, j| i <=> j }
# [[[3, 1],
# [4, 3],
# [6, 8]],
#
# [[4, 2],
# [5, 3],
# [9, 7]],
#
# [[0, 1],
# [2, 2],
# [4, 9]]]
Sorts a Tensor
, treating it's elements like the Tensor
is flat.
Arguments
Examples
a = [3, 2, 1].to_tensor
Num.sort(a) # => [1, 2, 3]
Sorts a Tensor
, treating it's elements like the Tensor
is flat.
Arguments
Examples
a = [3, 2, 1].to_tensor
Num.sort(a) # => [1, 2, 3]
Sorts a Tensor
, treating it's elements like the Tensor
is flat.
Arguments
Examples
a = [3, 2, 1].to_tensor
Num.sort(a) # => [1, 2, 3]
Split a Tensor
into multiple sub-Tensor
s. The number of sections
must divide the Tensor
equally.
Arguments
- a :
Tensor(U, CPU(U))
-Tensor
to split` - ind :
Int
- Number of sections of resultingArray
- axis :
Int
- Axis along which to split
Examples
a = Tensor.range(1, 9)
puts Num.array_split(a, 2) # => [[1, 2, 3, 4], [5, 6, 7, 8]]
Split a Tensor
into multiple sub-Tensor
s, using an explicit mapping
of indices to split the Tensor
Arguments
- a :
Tensor(U, CPU(U))
-Tensor
to split` - ind :
Int
- Array of indices to use when splitting theTensor
- axis :
Int
- Axis along which to split
Examples
a = Tensor.range(9)
puts Num.array_split(a, [1, 3, 5]) # => [[0], [1, 2], [3, 4], [5, 6, 7, 8]]
Split a Tensor
into multiple sub-Tensor
s. The number of sections
must divide the Tensor
equally.
Arguments
- a :
Tensor(U, ARROW(U))
-Tensor
to split` - ind :
Int
- Number of sections of resultingArray
- axis :
Int
- Axis along which to split
Examples
a = Tensor.range(1, 9)
puts Num.array_split(a, 2) # => [[1, 2, 3, 4], [5, 6, 7, 8]]
Split a Tensor
into multiple sub-Tensor
s, using an explicit mapping
of indices to split the Tensor
Arguments
- a :
Tensor(U, ARROW(U))
-Tensor
to split` - ind :
Int
- Array of indices to use when splitting theTensor
- axis :
Int
- Axis along which to split
Examples
a = Tensor.range(9)
puts Num.array_split(a, [1, 3, 5]) # => [[0], [1, 2], [3, 4], [5, 6, 7, 8]]
Implements the stdlib Math method sqrt on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.sqrt(a)
Implements the OpenCL builtin function sqrt for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.sqrt(a)
Implements the stdlib Math method sqrt on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.sqrt(a)
Implements the stdlib Math method sqrt on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.sqrt(a)
Implements the OpenCL builtin function sqrt for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.sqrt!(a)
Implements the stdlib Math method sqrt on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.sqrt(a)
Reduces a Tensor
along an axis, finding the std of each
view into the Tensor
Arguments
- a :
Tensor(U, CPU(U))
-Tensor
to reduce - axis :
Int
- Axis of reduction - dims :
Bool
- Indicate if the axis of reduction should remain in the result
Examples
a = Tensor.new([2, 2]) { |i| i }
Num.std(a, 0) # => [1, 1]
Num.std(a, 1, dims: true)
# [[0.707107],
# [0.707107]]
Reduces a Tensor
along an axis, finding the std of each
view into the Tensor
Arguments
- a :
Tensor(U, ARROW(U))
-Tensor
to reduce - axis :
Int
- Axis of reduction - dims :
Bool
- Indicate if the axis of reduction should remain in the result
Examples
a = Tensor.new([2, 2]) { |i| i }
Num.std(a, 0) # => [1, 1]
Num.std(a, 1, dims: true)
# [[0.707107],
# [0.707107]]
Reduces a Tensor
to a scalar by finding the standard deviation
Arguments
Examples
a = [1, 2, 3]
Num.std(a) # => 0.816496580927726
Reduces a Tensor
to a scalar by finding the standard deviation
Arguments
Examples
a = [1, 2, 3]
Num.std(a) # => 0.816496580927726
Implements the :- operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.subtract(a, b)
Implements the :- operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.subtract(a, b)
Implements the :- operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.subtract(b, a)
Subtract two Tensor
s elementwise
Arguments
Examples
a = [1.5, 2.2, 3.2].to_tensor(OCL)
Num.subtract(a, a)
Subtract a Tensor
and a Number
elementwise
Arguments
Examples
a = [1.5, 2.2, 3.2].to_tensor(OCL)
Num.subtract(a, 3.5)
Subtract a Number
and a Tensor
elementwise
Arguments
Examples
a = [1.5, 2.2, 3.2].to_tensor(OCL)
Num.subtract(a, 3.5)
Implements the :- operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise_arrow.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.subtract(a, b)
Implements the :- operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.subtract(a, b)
Implements the :- operator between a scalar and Tensor
.
The scalar is broadcasted across all elements of the Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.subtract(b, a)
Implements the :- operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.subtract!(a, b) # a is modified
Implements the :- operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.subtract!(a, b)
"Subtract" two Tensor
s elementwise, storing
the result in the first Tensor
Arguments
- a :
Tensor(U, OCL(U))
- LHS argument to subtract, will be modified inplace - b :
Tensor(U, OCL(U))
- RHS argument to subtract
Examples
a = [1.5, 2.2, 3.2].to_tensor(OCL)
Num.subtract!(a, a)
Subtract a Tensor
and a Number
elementwise,
modifying the Tensor
inplace.
Arguments
Examples
a = [1.5, 2.2, 3.2].to_tensor(OCL)
Num.subtract(a, 3.5)
Implements the :- operator between two Tensor
s.
Broadcasting rules apply, the method is applied elementwise.
This method applies the operation inplace, storing the result
in the LHS argument. Broadcasting cannot occur for the LHS
operand, so the second argument must broadcast to the first
operand's shape.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = [4, 5, 6].to_tensor
Num.subtract!(a, b) # a is modified
Implements the :- operator between a Tensor
and scalar.
The scalar is broadcasted across all elements of the Tensor
, and the
Tensor
is modified inplace.
Arguments
Examples
a = [1, 2, 3].to_tensor
b = 4
Num.subtract!(a, b)
Reduces a Tensor
along an axis, summing each view into
the Tensor
Arguments
- a :
Tensor(U, CPU(U))
-Tensor
to reduce - axis :
Int
- Axis of reduction - dims :
Bool
- Indicate if the axis of reduction should remain in the result
Examples
a = Tensor.new([2, 2]) { |i| i }
Num.sum(a, 0) # => [2, 4]
Num.sum(a, 1, dims: true)
# [[1],
# [5]]
Reduces a Tensor
along an axis, summing each view into
the Tensor
Arguments
- a :
Tensor(U, OCL(U))
-Tensor
to reduce - axis :
Int
- Axis of reduction - dims :
Bool
- Indicate if the axis of reduction should remain in the result
Examples
a = Tensor.new([2, 2], device: OCL) { |i| i }
Num.sum(a, 0).cpu # => [2, 4]
Num.sum(a, 1, dims: true).cpu
# [[1],
# [5]]
Reduces a Tensor
along an axis, summing each view into
the Tensor
Arguments
- a :
Tensor(U, ARROW(U))
-Tensor
to reduce - axis :
Int
- Axis of reduction - dims :
Bool
- Indicate if the axis of reduction should remain in the result
Examples
a = Tensor.new([2, 2]) { |i| i }
Num.sum(a, 0) # => [2, 4]
Num.sum(a, 1, dims: true)
# [[1],
# [5]]
Reduces a Tensor
to a scalar by summing all of its
elements
Arguments
Examples
a = [1, 2, 3]
Num.sum(a) # => 6
Reduces a Tensor
to a scalar by summing all of its
elements
Arguments
Examples
a = [1, 2, 3]
Num.sum(a) # => 6
Permutes two axes of a Tensor
. This will always create a view
of the permuted Tensor
Arguments
- arr :
Tensor(U, CPU(U))
-Tensor
to permute - source :
Int
- First axis to swap - destination :
Int
- Second axis to swap
Examples
a = Tensor.new([4, 3, 2]) { |i| i }
a.swap_axes(2, 0)
# [[[ 0, 6, 12, 18]
# [ 2, 8, 14, 20]
# [ 4, 10, 16, 22]]
#
# [[ 1, 7, 13, 19]
# [ 3, 9, 15, 21]
# [ 5, 11, 17, 23]]]
Permutes two axes of a Tensor
. This will always create a view
of the permuted Tensor
Arguments
- arr :
Tensor(U, ARROW(U))
-Tensor
to permute - source :
Int
- First axis to swap - destination :
Int
- Second axis to swap
Examples
a = Tensor.new([4, 3, 2]) { |i| i }
a.swap_axes(2, 0)
# [[[ 0, 6, 12, 18]
# [ 2, 8, 14, 20]
# [ 4, 10, 16, 22]]
#
# [[ 1, 7, 13, 19]
# [ 3, 9, 15, 21]
# [ 5, 11, 17, 23]]]
Implements the stdlib Math method tan on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.tan(a)
Implements the OpenCL builtin function tan for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.tan(a)
Implements the stdlib Math method tan on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.tan(a)
Implements the stdlib Math method tan on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.tan(a)
Implements the OpenCL builtin function tan for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.tan!(a)
Implements the stdlib Math method tan on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.tan(a)
Implements the stdlib Math method tanh on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.tanh(a)
Implements the OpenCL builtin function tanh for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.tanh(a)
Implements the stdlib Math method tanh on a Tensor
,
broadcasting the operation across all elements of the Tensor
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.tanh(a)
Implements the stdlib Math method tanh on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.tanh(a)
Implements the OpenCL builtin function tanh for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.tanh!(a)
Implements the stdlib Math method tanh on a Tensor
,
broadcasting the operation across all elements of the Tensor
.
The Tensor
is modified inplace to store the result
Arguments
Examples
a = [2.0, 3.65, 3.141].to_tensor
Num.tanh(a)
Implements the OpenCL builtin function tanpi for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.tanpi(a)
Implements the OpenCL builtin function tanpi for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.tanpi!(a)
Implements the OpenCL builtin function tgamma for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.tgamma(a)
Implements the OpenCL builtin function tgamma for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.tgamma!(a)
Tile elements of a Tensor
Arguments
Examples
a = [[1, 2, 3], [4, 5, 6]]
puts Num.tile(a, 2)
# [[1, 2, 3, 1, 2, 3],
# [4, 5, 6, 4, 5, 6]]
Tile elements of a Tensor
Arguments
Examples
a = [[1, 2, 3], [4, 5, 6]]
puts Num.tile(a, 2)
# [[1, 2, 3, 1, 2, 3],
# [4, 5, 6, 4, 5, 6]]
Tile elements of a Tensor
Arguments
Examples
a = [[1, 2, 3], [4, 5, 6]]
puts Num.tile(a, 2)
# [[1, 2, 3, 1, 2, 3],
# [4, 5, 6, 4, 5, 6]]
Tile elements of a Tensor
Arguments
Examples
a = [[1, 2, 3], [4, 5, 6]]
puts Num.tile(a, 2)
# [[1, 2, 3, 1, 2, 3],
# [4, 5, 6, 4, 5, 6]]
Converts a Tensor
to a standard library array. The returned array
will always be one-dimensional to avoid return type ambiguity
Arguments
Examples
a = Tensor.new([2, 2]) { |i| i }
a.to_a # => [0, 1, 2, 3]
Converts a Tensor
to a standard library array. The returned array
will always be one-dimensional to avoid return type ambiguity
Arguments
Examples
a = Tensor.new([2, 2], device: OCL) { |i| i }
a.to_a # => [0, 1, 2, 3]
Converts a Tensor
to a standard library array. The returned array
will always be one-dimensional to avoid return type ambiguity
Arguments
Examples
a = Tensor.new([2, 2]) { |i| i }
a.to_a # => [0, 1, 2, 3]
Permutes a Tensor
's axes to a different order. This will
always create a view of the permuted Tensor
.
Arguments
Arguments
Examples
a = Tensor.new([4, 3, 2]) { |i| i }
a.transpose([2, 0, 1])
# [[[ 0, 2, 4],
# [ 6, 8, 10],
# [12, 14, 16],
# [18, 20, 22]],
#
# [[ 1, 3, 5],
# [ 7, 9, 11],
# [13, 15, 17],
# [19, 21, 23]]]
Permutes a Tensor
's axes to a different order. This will
always create a view of the permuted Tensor
.
Arguments
axes : Array(Int)
New ordering of axes for the permuted Tensor
. If empty,
a full transpose will occur
Examples
a = Tensor.new([4, 3, 2]) { |i| i }
a.transpose([2, 0, 1])
# [[[ 0, 2, 4],
# [ 6, 8, 10],
# [12, 14, 16],
# [18, 20, 22]],
#
# [[ 1, 3, 5],
# [ 7, 9, 11],
# [13, 15, 17],
# [19, 21, 23]]]
Permutes a Tensor
's axes to a different order. This will
always create a view of the permuted Tensor
.
Arguments
Arguments
Examples
a = Tensor.new([4, 3, 2]) { |i| i }
a.transpose([2, 0, 1])
# [[[ 0, 2, 4],
# [ 6, 8, 10],
# [12, 14, 16],
# [18, 20, 22]],
#
# [[ 1, 3, 5],
# [ 7, 9, 11],
# [13, 15, 17],
# [19, 21, 23]]]
Permutes a Tensor
's axes to a different order. This will
always create a view of the permuted Tensor
.
Arguments
Arguments
Examples
a = Tensor.new([4, 3, 2]) { |i| i }
a.transpose([2, 0, 1])
# [[[ 0, 2, 4],
# [ 6, 8, 10],
# [12, 14, 16],
# [18, 20, 22]],
#
# [[ 1, 3, 5],
# [ 7, 9, 11],
# [13, 15, 17],
# [19, 21, 23]]]
Permutes a Tensor
's axes to a different order. This will
always create a view of the permuted Tensor
.
Arguments
axes : Array(Int)
New ordering of axes for the permuted Tensor
. If empty,
a full transpose will occur
Examples
a = Tensor.new([4, 3, 2]) { |i| i }
a.transpose([2, 0, 1])
# [[[ 0, 2, 4],
# [ 6, 8, 10],
# [12, 14, 16],
# [18, 20, 22]],
#
# [[ 1, 3, 5],
# [ 7, 9, 11],
# [13, 15, 17],
# [19, 21, 23]]]
Permutes a Tensor
's axes to a different order. This will
always create a view of the permuted Tensor
.
Arguments
Arguments
Examples
a = Tensor.new([4, 3, 2]) { |i| i }
a.transpose([2, 0, 1])
# [[[ 0, 2, 4],
# [ 6, 8, 10],
# [12, 14, 16],
# [18, 20, 22]],
#
# [[ 1, 3, 5],
# [ 7, 9, 11],
# [13, 15, 17],
# [19, 21, 23]]]
Implements the OpenCL builtin function trunc for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.trunc(a)
Implements the OpenCL builtin function trunc for a single Tensor
.
Only Float32
and Float64
Tensor
s are supported. This method
mutates the original Tensor
, modifying it in place.
Arguments
Examples
a = [0.45, 0.3, 2.4].to_tensor(OCL)
Num.trunc!(a)
Return a shallow copy of a Tensor
with a new dtype. The underlying
data buffer is shared, but the Tensor
owns its other attributes.
The size of the new dtype must be a multiple of the current dtype
Arguments
- arr :
Tensor(U, CPU(U))
-Tensor
to view as a different data type - u :
V.class
- The data type used to reintepret the underlying data buffer of aTensor
Examples
a = Tensor.new([3]) { |i| i }
a.view(Int8) # => [0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0]
Return a shallow copy of a Tensor
with a new dtype. The underlying
data buffer is shared, but the Tensor
owns its other attributes.
The size of the new dtype must be a multiple of the current dtype
Arguments
- arr :
Tensor(U, ARROW(U))
-Tensor
to view as a different data type - u :
V.class
- The data type used to reintepret the underlying data buffer of aTensor
Examples
a = Tensor.new([3]) { |i| i }
a.view(Int8) # => [0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0]
Stack an array of Tensor
s in sequence row-wise. While this
method can take Tensor
s with any number of dimensions, it makes
the most sense with rank <= 3
Arguments
Examples
a = [1, 2, 3].to_tensor
Num.vstack([a, a])
# [[1, 2, 3],
# [1, 2, 3]]
Stack an array of Tensor
s in sequence row-wise. While this
method can take Tensor
s with any number of dimensions, it makes
the most sense with rank <= 3
Arguments
Examples
a = [1, 2, 3].to_tensor
Num.vstack([a, a])
# [[1, 2, 3],
# [1, 2, 3]]
Expands a Tensor
s dimensions n times by broadcasting
the shape and strides. No data is copied, and the result
is a read-only view of the original Tensor
Arguments
Examples
a = [1, 2, 3].to_tensor
a.with_broadcast(2)
# [[[1]],
#
# [[2]],
#
# [[3]]]
Similar to #each_axis
, but instead of yielding slices of
an axis, it yields slices along an axis, useful for methods
that require an entire view of an axis
slice for a reduction
operation, such as #std
, rather than being able to incrementally
reduce.
Arguments
Examples
a = Tensor.new([3, 3, 3]) { |i| i }
a.yield_along_axis(0) do |ax|
puts ax
end
# [ 0, 9, 18]
# [ 1, 10, 19]
# [ 2, 11, 20]
# [ 3, 12, 21]
# [ 4, 13, 22]
# [ 5, 14, 23]
# [ 6, 15, 24]
# [ 7, 16, 25]
# [ 8, 17, 26]
Similar to #each_axis
, but instead of yielding slices of
an axis, it yields slices along an axis, useful for methods
that require an entire view of an axis
slice for a reduction
operation, such as #std
, rather than being able to incrementally
reduce.
Arguments
Examples
a = Tensor.new([3, 3, 3]) { |i| i }
a.yield_along_axis(0) do |ax|
puts ax
end
# [ 0, 9, 18]
# [ 1, 10, 19]
# [ 2, 11, 20]
# [ 3, 12, 21]
# [ 4, 13, 22]
# [ 5, 14, 23]
# [ 6, 15, 24]
# [ 7, 16, 25]
# [ 8, 17, 26]
Yields the elements of two Tensor
s, always in RowMajor order,
as if the Tensor
s were flat.
Arguments
- a :
Tensor(U, CPU(U))
- FirstTensor
of iteration - b :
Tensor(U, CPU(U))
- SecondTensor
of iteration
Examples
a = Tensor.new(2, 2) { |i| i }
b = Tensor.new(2, 2) { |i| i + 2 }
a.zip(b) do |el|
puts el
end
# { 0, 2}
# { 1, 3}
# { 2, 4}
# { 3, 5}
Yields the elements of two Tensor
s, always in RowMajor order,
as if the Tensor
s were flat.
Arguments
- a :
Tensor(U, ARROW(U))
- FirstTensor
of iteration - b :
Tensor(U, ARROW(U))
- SecondTensor
of iteration
Examples
a = Tensor.new(2, 2) { |i| i }
b = Tensor.new(2, 2) { |i| i + 2 }
a.zip(b) do |el|
puts el
end
# { 0, 2}
# { 1, 3}
# { 2, 4}
# { 3, 5}