I figured out what was causing those error messages. I am posting my findings here for the benefit of anyone else who may run into this issue.
In the “network” function, I had code like the following:
blah = input.slice_axis(axis=1, begin=inXDim-1, end=inXDim)
blah = blah.reshape((numInputs,))
Seems like we can’t have re-assignments like this to the same variable in code that is going to be executed inside autograd.record.
Another variation of the same issue I had was within my network.cost() method where the code was:
costs = 0
for layer in self.layers:
costs += layer.cost()
Here, the variable “costs” gets re-assigned each time through the loop.
I got around the issue by using a different variable in the first case above, and by unrolling the loop in the second case.
Any confirmation/additional comments by more knowledgeable people would be great.