Value_error: only one element tensors can be converted to Python scalars

While generating predictions for my trained RNN model, I was getting the

too many values to unpack (expected 2)

error. Which got resolved using .item() function. However, after resolving the above error now I am getting this error.

only one element tensors can be converted to Python scalars

My prediction_loader instance consist of training data having the labels and training set.
labels are denoted by batch_y and training set as batch_x

Code and error snippets:

for batch in loader:
if your loader returns both inputs and labels, batch will contain tuple (x,y), replace it with
for batch_x, batch_y in loader:
also item() does not give you single tensor. It extracts value of that tensor in Python format (like simple float64). Backprop will not work on item()