Could you post the model definition, please?
Sometimes these errors are caused by an accidental training comma in a line of code, e.g.
x = self.layer(x), 
x = F.relu(x)

(note the comma in the first line of code).