I want to do the integration over one input of the neural network. Is it possible?

Could you elaborate more? What do you want to integrate exactly?

Thank you for your reply.

def fun(x):

#print("calling this function\t ",x_val)

d_x=x[:, 0]

in_Q2=[d_x[i].item() for i in range(len(d_x))]

in_xy=[[in_Q2[i],x_val] for i in range(len(in_Q2))]

in_xy=torch.tensor(in_xy,dtype=torch.float32).clone().detach()

output_net=model(in_xy)

output_net.requires_grad_(True)

#print(f"Out put of the model:\t {list(model.parameters())} ",)

```
return output_net
```

pred = torch.tensor([mc.integrate(fun,dim=1,N=100,integration_domain=[[0, 1]],backend=“torch”,).item()],requires_grad=True).float()

loss = loss_fn(pred, val_yb)

opt.zero_grad()

loss.backward()

opt.step()

sorry for the late reply. I have done the integration of the neural network but now the problem is that not updating the model parameters(weights and biases)