Hi, i’m trying to do multiobjective optimization with using deep learning model.I would like to take the predictions for each task from a deep learning model with more than two dimensional outputs and put them into separate loss functions for consideration, but I don’t know how to do it.

I have been able to implement this to the point where I can extract predictions for each task from a deep learning model with more than two dimensional outputs, so I would like to know how I can properly use the loss function.

Thank you.

code is below

```
・
・
criterion = nn.MSELoss()
for epoch in (range(num_epochs)):
model.train()
train_running_loss = 0.0
for torch_comp, torch_comp_wt, task_num, y in train_loader:
torch_comp = torch_comp.to(device)
torch_comp_wt = torch_comp_wt.to(device)
task_num = task_num.reshape(-1, 1).to(device)
y = torch.Tensor(y).to(device)
optimizer.zero_grad()
y_pred = model(torch_comp, torch_comp_wt) #(256, 2)
# print(task_num)
# print(y_pred[:5])
y_pred = torch.take_along_dim(y_pred, task_num, dim=1) # get Predicted value per task
loss = (criterion(y_pred, y.unsqueeze(1))) # I want to change here!!!!!!
loss.backward()
optimizer.step()
```