I am using Learner on a custom model. The model training works with learner.fit_one_cycle() but when I try to predict an output from the model for inference, I get the following error.

RuntimeError: bool value of Tensor with more than one value is ambiguous

This is my model architecture

import torch as th

class model(th.nn.Module):

“”“model structure.”""

```
def __init__(self, n_hiddens=20, kernel_size=3):
"""Init the model structure with the number of hidden units.
:param n_hiddens: Number of hidden units
:type n_hiddens: int
"""
super().__init__()
self.conv = th.nn.Sequential(th.nn.Conv1d(2, n_hiddens, kernel_size),
th.nn.ReLU(),
th.nn.Conv1d(n_hiddens, n_hiddens,
kernel_size),
th.nn.ReLU())
# self.batch_norm = th.nn.BatchNorm1d(n_hiddens, affine=False)
self.dense = th.nn.Sequential(th.nn.Linear(n_hiddens, n_hiddens),
th.nn.ReLU(),
th.nn.Linear(n_hiddens, 1)
)
def forward(self, x):
"""Passing data through the network.
:param x: 2d tensor containing both (x,y) Variables
:return: output of the net
"""
features = self.conv(x).mean(dim=2)
return self.dense(features)
```

My training data is of the form x_train.shape = (n,2, 500) and y_train.shape = (n,1)

Can anyone help me out with where I might be going wrong?