ky_Pa:

They should be in the form of tensors.


They are most likely tensors, but the squeeze_ operation could remove the single dimension as seen here:
x = torch.tensor([1])
print(x.shape)
> torch.Size([1])
print(x.squeeze().shape)
> torch.Size([])

Could you explain, why label_A = make_variable(src_label.squeeze_()) is needed?
Are you trying to squeeze a specific dimension? If so, you should use the dim argument.



 ky_Pa:

So do I no longer need to use Variables to convert to variables?But I see that there are steps to convert variables in many similar codes.


These code snippets are also using the deprecated Variables.



 ky_Pa:

If I remove it, will pred or label_A still be able to enter the built network smoothly?
Can you tell me how to modify the code?


Yes, you can simply pass tensors to the model.
If your input does not require gradients (which is the usual case), then just remove the Variable(tensor) call completely.