To be specific, I have the following code:
import torch
import torch.nn as nn
from torch.autograd import Variable
import pandas as pd

class Linear_Reg(nn.Module):
    def __init__(self, inp_sz, out_sz):    
        super(Linear_Reg, self).__init__()
        self.linear = nn.Linear(inp_sz, out_sz)
        
    def forward(self, x):
        out = self.linear(x)
        return out
    
train = pd.read_csv('C:\\Users\\hgstr\\Jupyter_Files\\Data_Sets\\linear_regression\\train.csv')
test = pd.read_csv('C:\\Users\\hgstr\\Jupyter_Files\\Data_Sets\\linear_regression\\test.csv')

x_train = torch.Tensor(train['x'])
y_train = torch.Tensor(train['y'])

x_test = torch.Tensor(test['x'])
y_test = torch.Tensor(test['y'])

x_train = torch.Tensor(x_train)
y_train = torch.Tensor(y_train)
x_train = x_train.view(700,1)
y_train = y_train.view(700,1)
print(x_train.shape)
print(y_train.shape)

#================================
input_sz = 1;
output_sz = 1
epochs = 60
learning_rate = 0.001
#================================

model = Linear_Reg(input_sz, output_sz)
crit = nn.MSELoss()
opt = torch.optim.SGD(model.parameters(), learning_rate)

for e in range(epochs):
    
    opt.zero_grad()
    out = model(x_train)
    
    loss = crit(out, y_train)
    loss.backward()
    opt.step()
    
    print('epoch {}, loss {}'.format(e,loss.data[0]))

A simple linear regression program,
You will notice that I reshape the x_train and y_train tensors with the view function because I was getting a size mismatch problem before, but now I am getting a Nan loss.
the attributes of train.csv is just x, and y, with 700 samples.
Also, could you explain how to calculate batch size?