Reputation: 11
data_root = os.path.join(os.getcwd(), "data")
transform = transforms.Compose(
[
transforms.ToTensor(),
transforms.Normalize([0.5], [0.5]),
]
)
fashion_mnist_dataset = FashionMNIST(data_root, download = True, train = True, transform = transform)
Error Message
/usr/local/lib/python3.7/dist-packages/torchvision/datasets/mnist.py in read_sn3_pascalvincent_tensor(path, strict) 524 # we need to reverse the bytes before we can read them with torch.frombuffer(). 525 needs_byte_reversal = sys.byteorder == "little" and num_bytes_per_value > 1 --> 526 parsed = torch.frombuffer(bytearray(data), dtype=torch_type, offset=(4 * (nd + 1))) 527 if needs_byte_reversal: 528 parsed = parsed.flip(0)
AttributeError: module 'torch' has no attribute 'frombuffer'
what can i do for this err in Colab
Upvotes: 1
Views: 8159
Reputation: 82
I tried your code in my Google Colab by adding the codes (to import the libraries) below, but it works well without errors.
import os
from torchvision import transform
from torchvision.datasets import FashionMNIST
I used
Do you get errors when you also use the same codes above? Do you use another versions?
Upvotes: 1