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)


217
218
219
220
221
# File 'lib/torch.rb', line 217

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