class ARROW(T)
inherits Num::Backend::Storage
#
Constructors#
.new(shape : Array(Int), order : Num::OrderType, value : T)
#
(shape : Array(Int), order : Num::OrderType, value : T)
Initialize an ARROW storage from an initial capacity and an initial value, which will fill the buffer
Arguments#
- shape :
Array(Int)
- Shape of the parentTensor
- order :
Array(Int)
- Memory layout of the parentTensor
- value :
T
- Initial value to populate the buffer
Examples#
ARROW.new([10, 10], 3.4)
.new(shape : Array(Int), strides : Array(Int), value : T)
#
(shape : Array(Int), strides : Array(Int), value : T)
Initialize an ARROW storage from an initial capacity and an initial value, which will fill the buffer
Arguments#
- shape :
Array(Int)
- Shape of the parentTensor
- strides :
Array(Int)
- Strides of the parentTensor
- value :
T
- Initial value to populate the buffer
Examples#
ARROW.new([10, 10], [10, 1], 3.4)
.new(data : Pointer(T), shape : Array(Int), strides : Array(Int))
#
(data : Pointer(T), shape : Array(Int), strides : Array(Int))
Initialize an ARROW storage from a hostptr and initial shape. The shape is not required for this storage type, but is needed by other implementations to ensure copy requirements have the right pointer size.
Arguments#
- data :
Pointer(T)
- Existing databuffer for aTensor
- shape :
Array(Int)
- Shape of the parentTensor
- strides :
Array(Int)
- Strides of the parentTensor
Examples#
a = Pointer(Int32).malloc(10)
s = ARROW.new(a, [5, 2])
.new(shape : Array(Int), order : Num::OrderType)
#
(shape : Array(Int), order : Num::OrderType)
Initialize an ARROW backed storage from an initial capacity. The data will be filled with zeros
Arguments#
- shape :
Array(Int)
- Shape of the parentTensor
- order :
Array(Int)
- Memory layout of the parentTensor
Examples#
CPU.new([2, 3, 4])
.new(shape : Array(Int), strides : Array(Int))
#
(shape : Array(Int), strides : Array(Int))
Initialize an ARROW storage from an initial capacity. The data will be filled with zeros
Arguments#
- shape :
Array(Int)
- Shape of the parentTensor
- strides :
Array(Int)
- Strides of the parentTensor
Examples#
ARROW(Int32).new([2, 3, 4])
Class methods#
.base(dtype : U.class) : ARROW(U).class forall U
#
(dtype : U.class) : ARROW(U).class forall U
Return a generic class of a specific generic type, to allow for explicit return types in functions that return a different storage type than the parent Tensor
Examples#
a = ARROW(Float32).new([10])
# Cannot do
# a.class.new ...
a.class.base(Float64).new([10])
Methods#
#to_hostptr : Pointer(T)
#
View source
: Pointer(T)