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

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

Instance Method Summary collapse

Instance Method Details

#TorchTensor(array) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
# File 'lib/ndav/torch/tensor.rb', line 72

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