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)


208
209
210
211
212
# File 'lib/torch.rb', line 208

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