Method: Torch::Tensor#numo

Defined in:
lib/torch/tensor.rb

#numoObject

TODO read directly from memory


135
136
137
138
139
140
141
142
143
# File 'lib/torch/tensor.rb', line 135

def numo
  if dtype == :bool
    Numo::UInt8.from_string(_data_str).ne(0).reshape(*shape)
  else
    cls = Torch._dtype_to_numo[dtype]
    raise Error, "Cannot convert #{dtype} to Numo" unless cls
    cls.from_string(_data_str).reshape(*shape)
  end
end