class ARROW(T)

Defined in:

tensor/backends/arrow/impl_allocation.cr
tensor/backends/arrow/impl_data_structure.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from class Num::Backend::Storage(T)

to_unsafe to_unsafe, update_metadata(shape : Array(Int32), strides : Array(Int32)) update_metadata

Constructor methods inherited from class Num::Backend::Storage(T)

new(shape : Array(Int), order : Num::OrderType, value : T)
new(shape : Array(Int), strides : Array(Int), value : T)
new(hostptr : Pointer(T), shape : Array(Int), strides : Array(Int))
new(shape : Array(Int), order : Num::OrderType)
new(shape : Array(Int), strides : Array(Int))
new

Constructor Detail

def self.new(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 parent Tensor
  • order : Array(Int) - Memory layout of the parent Tensor
  • value : T - Initial value to populate the buffer

Examples

ARROW.new([10, 10], 3.4)

[View source]
def self.new(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 parent Tensor
  • strides : Array(Int) - Strides of the parent Tensor
  • value : T - Initial value to populate the buffer

Examples

ARROW.new([10, 10], [10, 1], 3.4)

[View source]
def self.new(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 a Tensor
  • shape : Array(Int) - Shape of the parent Tensor
  • strides : Array(Int) - Strides of the parent Tensor

Examples

a = Pointer(Int32).malloc(10)
s = ARROW.new(a, [5, 2])

[View source]
def self.new(shape : Array(Int), order : Num::OrderType) #

Initialize an ARROW backed storage from an initial capacity. The data will be filled with zeros

Arguments

Examples

CPU.new([2, 3, 4])

[View source]
def self.new(shape : Array(Int), strides : Array(Int)) #

Initialize an ARROW storage from an initial capacity. The data will be filled with zeros

Arguments

Examples

ARROW(Int32).new([2, 3, 4])

[View source]

Class Method Detail

def self.base(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])

[View source]

Instance Method Detail

def data : Arrow::NumericArray #

Raw Crystal pointer that holds an ARROW(T)s data


[View source]
def to_hostptr : Pointer(T) #

Converts ARROW storage to a crystal pointer

Examples

a = ARROW(Int32).new([3, 3, 2])
a.to_hostptr

[View source]
def to_unsafe #

Returns the raw Arrow::Array associated with an ARROW(T)


[View source]