title: PyTorch - AttributeError: 'bool' object has no attribute 'sum'
body: <p>I am running a deep learning model using PyTorch and getting the following error. </p>
  
  <pre><code>'correct+=(yhat==y_test).sum().int()'
  </code></pre>
  
  <p>AttributeError: 'bool' object has no attribute 'sum'</p>
  
  <p>Below is a larger snippet of the code.</p>
  
  <p>'''</p>
  
  <pre><code>for x_test, y_test in validation_loader:
              model.eval()
              z = model(x_test)
              yhat = torch.max(z.data,1)
              correct+=(yhat==y_test).sum().int()
              accuracy = correct / n_test
              accuracy_list.append(accuracy)
  </code></pre>
  
  <p>'''</p>