Is there any suggestions for me.
here is the dataloader
def __init__(self, path, data_name, batchsize=1, steps=None, shuffle=False, transforms=None):
    self.x, self.y = self.load_data(path, data_name)
    self.transforms = transforms
    self.steps = steps
    if steps is not None:
        self.idx_mapping = np.random.randint(0, self.x.shape[0], steps*batchsize)
        self.steps = self.steps * batchsize

def __len__(self):
    return self.steps if self.steps is not None else self.x.shape[0]

def __getitem__(self, index):
    if self.steps is not None:
        index = self.idx_mapping[index]

    if self.transforms is not None:def __init__(self, path, data_name, batchsize=1, steps=None, shuffle=False, transforms=None):
    self.x, self.y = self.load_data(path, data_name)
    self.transforms = transforms
    self.steps = steps
    if steps is not None:
        self.idx_mapping = np.random.randint(0, self.x.shape[0], steps*batchsize)
        self.steps = self.steps * batchsize

def __len__(self):
    return self.steps if self.steps is not None else self.x.shape[0]

def __getitem__(self, index):
    if self.steps is not None:
        index = self.idx_mapping[index]

    if self.transforms is not None:
        x, y = self.transforms(images=self.x[None, index], segmentation_maps=self.y[None, index])
    else:
        x, y = self.x[None, index], self.y[None, index]

    x, y = x.astype('float32')[0]/255., y.astype('float32')[0]/255.
    x, y = ToTensor()(x), ToTensor()(y)

    return x, y
        x, y = self.transforms(images=self.x[None, index], segmentation_maps=self.y[None, index])
    else:
        x, y = self.x[None, index], self.y[None, index]

    x, y = x.astype('float32')[0]/255., y.astype('float32')[0]/255.
    x, y = ToTensor()(x), ToTensor()(y)

    return x, y


loss function
class BCE_soft(nn.BCELoss):
def init(self, beta=0.95):
super(BCE_soft, self).init()
self.beta = beta
def forward(self, predicted, target):
cross_entropy = F.nll_loss(predicted.log(), target, size_average=False)
soft_reed = -predicted * torch.log(predicted + 1e-8)
return self.beta * cross_entropy + (1 - self.beta) * torch.sum(soft_reed)

training part
    model.train()
    for step, (x, y) in enumerate(tqdm(train_loader, desc='[TRAIN] Epoch '+str(epoch+1)+'/'+str(args.epochs))):
        if step >= args.steps:
            break
        x = x.to(device).float()
        y = y.to(device).float()

        y = y.squeeze(1)

        # dim = input.dim(y)

        optimizer.zero_grad()
        output = model(x)

        # loss
        l = criterion(output, y)
        tot_soft += l.item()
        l.backward()
        optimizer.step()