lib/torch/nn/parameter.rb in torch-rb-0.1.1 vs lib/torch/nn/parameter.rb in torch-rb-0.1.2
- old
+ new
@@ -3,8 +3,12 @@
class Parameter < Tensor
def self.new(data = nil, requires_grad: true)
data = Tensor.new unless data
Tensor._make_subclass(data, requires_grad)
end
+
+ def grad
+ _grad if _grad_defined
+ end
end
end
end