It is hard to look at the stack trace and conclusively say what’s going wrong. One suggestion for debugging would be to reduce the size of your network and see if you continue to see this issue. If you need help debugging, I would suggest posting a minimal example that reproduces this issue.I also find it suspect that the traceback shows an error while trying to serialize the tensor for printing, so maybe you should consider removing that print statement to get a cleaner error trace.