For this pytorch coding , why do I have this runtime issue : Cannot insert a Tensor that requires grad as a constant. Consider making it a parameter or input, or detaching the gradient
After some debugging, it seems that the runtime error revolves around the variable self.edges_results
which had in some way modified how tensorflow sees it.
So, setting variables VISUALIZER
and DEBUG
to zero (which will remove any tensorflow dependencies) will just temporarily eliminate the runtime error.
Any suggestions/advice ?
One possible solution:
It seems that tensorflow does not like the use of self.variable
inside def forward()
unlike in Pytorch. Tensorflow prefers the use of a new intermediate variable instead of self.variable
So, the following major change is what seems to have resolved the issue.
Any comments ?
Note: Some more coding effort is needed to further modify the code since the output tensorboard graph seems so much smaller and rather unconnected as a result.