Skip to content

[Solved][PyTorch] TypeError: not a sequence

TypeError: not a sequence

When using PyTorch to build a deep learning model, I think the above error is the most troublesome. The biggest problem is that this error report basically doesn't tell what kind of error happened. It's up to the user to look at his own data format.

Here I want to record a clearer solution direction: confirm the format of all your in formation.

Is all the data a List or Numpy Array? If there are tuples or simple numbers, I would suggest to change to List. I suffered a lot from the error report, but finally realized that not all of my data was in the sequence type, which made it impossible to convert to pytorch tensor.

I hope I will not come back to read this record of mine.


References

Leave a Reply