33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/ndav/numo/narray.rb', line 33
def ndav_descriptor(**)
unless contiguous?
warn "only contiguous NArray is supported"
return false
end
format = CLASS_TO_FORMAT[self.class]
unless format
warn "unsupported class: #{self.class}, currently supported: #{CLASS_TO_FORMAT.keys}"
return false
end
{
data: ::Fiddle::Pointer.new(::NDAV::Numo::NArray.address_for_read(self), byte_size),
shape:,
strides: ::NDAV::Numo::NArray.strides(self),
format:,
byte_size:,
readonly?: ::NDAV::Numo::NArray.readonly?(self),
sub_offsets: nil
}
end
|