Class: Torch::Autograd::Variable

Inherits:
Object
  • Object
show all
Defined in:
lib/torch.rb

Class Method Summary collapse

Class Method Details

.new(x) ⇒ Object

Raises:

  • (ArgumentError)


215
216
217
218
219
# File 'lib/torch.rb', line 215

def self.new(x)
  raise ArgumentError, "Variable data has to be a tensor, but got #{x.class.name}" unless x.is_a?(Tensor)
  warn "[torch] The Variable API is deprecated. Use tensors with requires_grad: true instead."
  x
end