Error handling in simulator.py


#1

I am a newbie in nengo and nengo-dl. I’ve a large file as input and I’m getting “type error” from simulator.py line 365.
It turned out that it is actually an OOM error after I modified it to:

            try:
                if e.op.type == "PyFunc":
                    raise SimulationError(
                            "Function '%s' caused an error (see error log above)" %
                            e.op.name)
                else:
                    raise e  # pragma: no cover
            except:
                raise e

#2

So what was the output you were seeing before and after that change? From my reading it seems like that outer try: except should just be re-raising the errors within the try block, so I’m surprised that it made a difference.


#3

Here is what I was getting before:

File “/home/ark/Downloads/nengo-dl/nengo_dl/simulator.py”, line 358, in run_steps
if e.op.type == “PyFunc”:

AttributeError: ‘NoneType’ object has no attribute ‘type’

and here is what I am getting now:

raise type(e)(node_def, op, message)

ResourceExhaustedError: OOM when allocating tensor with shape[2400000,1]


#4

Ah interesting, I didn’t know it was possible for TensorFlow to raise an error there where the op would be None. I’ll fix that up, thanks!