how can i change these two instructions in pytorch ?
these instructions used in chainer code
(knowing that vrn is a resnet+unet model )
x_train = vrn.xp.asarray(image)
y_train = vrn.xp.asarray(label)

for i in range(args.iteration):
        vrn.zero_grad()
        #vrn.cleargrads()
        image, label = load_sample(
            train_df,
            args.n_batch,
            args.input_shape,
            args.output_shape
        )
        x_train = vrn.xp.asarray(image)
        y_train = vrn.xp.asarray(label)
        logits = vrn(x_train, train=True)
        logits = [logit[slices_in] for logit in logits]
        loss = F.softmax_cross_entropy(logits[-1], y_train)