train
device = get_device()
print(device)
def train(train_set):
epochs = 1000
learning_rate = 0.01
optimizer = torch.optim.SGD(model.parameters(),lr=learning_rate)
loss_f = nn.MSELoss()
epoch = 0
while epoch < epochs:
for input,label in train_set:
optimizer.zero_grad()
input = input.to(device)
label = label.to(device)
print(input.shape)
print(label.shape)
output = model(input)
print(output.shape)
loss = loss_f(output,label)
loss.backward()
optimizer.step()
print("epoch:{},loss:{}".format(epoch,loss))
epoch+=1
output
cuda
torch.Size([270, 93])
torch.Size([270])
torch.Size([270])
How can i fix this