RunTime Error from e = Variable(torch.Tensor())
See original GitHub issueSorry for my troubles, but why does using the e = Variable(torch.Tensor)
raise RuntimeError: expected a Variable argument, but got FloatTensor
in a recursive class implementation? I mean, e
is already a Variable as defined on Line 77. The relevant call stack is
RuntimeError: expected a Variable argument, but got FloatTensor
> /home/robotec/catkin_ws/src/RAL2017/pyrnn/src/model.py(77)qp_layer()
75 h = self.h.unsqueeze(0).expand(nBatch, nineq)
76 e = Variable(torch.Tensor())
---> 77 x = QPFunction()(x, Q, p, G, h, e, e)
78 return x
79 self.qp_layer = qp_layer
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
one of the variables needed for gradient computation has ...
[Solved][Pytorch1.5] RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation.
Read more >RuntimeError: one of the variables needed for gradient ...
RuntimeError : one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.LongTensor [128, 1]] ...
Read more >RuntimeError: one of the variables needed for ... - M N – Medium
RuntimeError : one of the variables needed for gradient computation has been modified by an inplace operation: [torch.FloatTensor []], which is output 0...
Read more >pytorch_basics
print(torch.arange(5).exp()) except RuntimeError as E: print(f"Got exception: '{E}'") tensor([ 1.0000, 2.7183, 7.3891, 20.0855, 54.5981]).
Read more >tf.Tensor | TensorFlow v2.11.0
print(e.numpy()) [[1. 3.] [3. 7.]] In TensorFlow, tf.function s are a common way to define graph execution. A Tensor's shape (that is, the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Making everything Variables/Parameters should fix this issue (though let us know if not). Also something new we’ve added is that you don’t have to expand
h
or any other variable across the minibatch,QPFunction
automatically detects that internally.Great, glad things are working!