1import torch
2import torchvision
3import torch.nn as nn 4import torch.optim as optim
5from torch.utils.data import DataLoader, Dataset
6import numpy as np
Imports for the same package are scattered and not grouped together. It is recommended to keep the imports from the same package together. It makes the code easier to read.
Not preferred:
import os
import sys
from os import listdir
import time
from os.path import isfile, join
Preferred:
import os
from os import listdir
from os.path import isfile, join
import sys
import time