Module: NDAV::Torch::Tensor::Converter

Defined in:
lib/ndav/torch/tensor.rb

Instance Method Summary collapse

Instance Method Details

#TorchTensor(array) ⇒ Object



83
84
85
86
87
88
89
90
91
92
93
# File 'lib/ndav/torch/tensor.rb', line 83

def TorchTensor(array, *, **)
  if array.kind_of? ::NDAV
    array.to_torch_tensor
  elsif array.respond_to? :to_torch_tensor
    array.to_torch_tensor
  elsif array.respond_to? :to_ndav
    array.to_ndav(*, **).to_torch_tensor
  else
    ::NDAV.new(array, *, **).to_torch_tensor
  end
end