I tried to import default_collate from torch.utils as shown

from import default_collate

The problem is the default_collate is not found and I found _collate_fn_t are they similar functions?

Hi @Mohamed_Nabih,

I tried the import you shown and it works for me. Which version are you using?. Also, I remember I recently imported the same function using: from import default_collate.

To check if the import you used pointed at the same funciton, I checked with the following code:

from import default_collate as dc1
from import default_collate as dc2

print(dc1 is dc2)
# >> True

So yes, both ways import the actual default_collate method. I couldn’t find _collate_fn_t, but I think they refer to the same method (*.pyi files seem to be related with annotations, so they’re not actual declarations).

Thanks, Antonio for your help it works.