Hi guys,

```
x = torch.tensor([[1,2], [3, 4], [5, 6]])
(x<2).numpy().sum()
```

I’m able to do the above but is there a way to do it just using torch?

Thanks.

Hi guys,

```
x = torch.tensor([[1,2], [3, 4], [5, 6]])
(x<2).numpy().sum()
```

I’m able to do the above but is there a way to do it just using torch?

Thanks.

The sum() method exists in torch. Simply removing the `.numpy()`

will make it work.

Do you see an error when you do that?

Indeed it is. Thanks