I have the following code:https://gist.github.com/vorlkets/f38c91aa52cb4e68976e1f638d251a85 . When run I get RuntimeError: bool value of Tensor with more than one value is ambiguous. Can someone tell me what’s going on? The following is the error trace:
python hw2main.py
Using device: cpu
Traceback (most recent call last):
File “hw2main.py”, line 142, in
main()
File “hw2main.py”, line 73, in main
loss = lossFunc(ratingOutput, categoryOutput, rating, businessCategory)
File “C:\Users\Cliff\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\nn\modules\module.py”, line 532, in call
result = self.forward(*input, **kwargs)
File “F:\Master of Information Technology at UNSW\COMP9444 Neural Networks and Deep Learning\Assignment\Assignment 2\hw2\student.py”, line 120, in forward
if categoryOutput[0] == torch.max(categoryOutput): buscat = 0
RuntimeError: bool value of Tensor with more than one value is ambiguous