title: "Runtimeerror: bool value of tensor with more than one value is ambiguous" fastai
body: <p>I am doing semantic segmentation using cityscapes dataset in fastai. I want to ignore some classes while calculating accuracy. this is how I defined accuracy according to fastai deep learning course:</p>
  
  <pre><code>name2id = {v:k for k,v in enumerate(classes)}
  unlabeled = name2id['unlabeled']
  ego_v = name2id['ego vehicle']
  rectification = name2id['rectification border']
  roi = name2id['out of roi']
  static = name2id['static']
  dynamic = name2id['dynamic']
  ground = name2id['ground']
  
  def acc_cityscapes(input, target):
      target = target.squeeze(1)
  
      mask=(target!=unlabeled and target!= ego_v and target!= rectification
      and target!=roi and target !=static and target!=dynamic and 
      target!=ground)
  
  return (input.argmax(dim=1)[mask]==target[mask]).float().mean()
  </code></pre>
  
  <p>This code works if I ignore only one of the classes:</p>
  
  <pre><code>mask=target!=unlabeled
  </code></pre>
  
  <p>But when I am trying to ignore multiple classes like this:</p>
  
  <pre><code>mask=(target!=unlabeled and target!= ego_v and target!= rectification
      and target!=roi and target !=static and target!=dynamic and 
      target!=ground)
  </code></pre>
  
  <p>I am getting this error:</p>
  
  <pre><code>runtimeError: bool value of tensor with more than one value is ambiguous
  </code></pre>
  
  <p>Any Idea how do I solve this?</p>