AttributeError: module '' has no attribute 'random_split

Hello ,
I am getting error “AttributeError: module ‘’ has no attribute 'random_split”

in following code.

train_dataset, test_dataset =, [train_size, test_size])

Anybody know the reason ?
My does not suggest random_split in import section even.

Which PyTorch version are you using?
You can check it using print(torch.__version__).
The current stable version is 1.1.0, so if you are using an older one, I would recommend to install the latest version following the instructions from the website.

1 Like

Thank you verymuch.
I upgraded the version and now it is working.


1 Like