TypeError: cannot unpack non-iterable NoneType object

I am training CNNs through transfer learning, following pytorch transfer learning tutorial. As shown below, after completion of training, type error occurs.
image
I shall be grateful, If anybody help me out.

Can you further show, how the function train_model() look like.

Here is the train code.

looks alright to me.
What are the last few printouts you get?
Please also share the return line of the function, maybe there is some issues?
I don’t know what the return hist would be.

The error is raised, since train_model doesn’t return anything, so you might want to add a return statement. This code snippet raises the same error:

def fun():
    print("don't return anything")

fun() # works
a, b = fun() # fails
> TypeError: cannot unpack non-iterable NoneType object
1 Like