title: TypeError: __array__() takes 1 positional argument but 2 were given
body: <p>I've been doing the pytorch tutorial (<a href="https://pytorch.org/tutorials/intermediate/torchvision_tutorial.html" rel="nofollow noreferrer">https://pytorch.org/tutorials/intermediate/torchvision_tutorial.html</a>) and have been getting this error that I don't know how to fix. The full error is below:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;main.py&quot;, line 146, in &lt;module&gt;
      main()
    File &quot;main.py&quot;, line 138, in main
      train_one_epoch(model, optimizer, data_loader, device, epoch, print_freq=10)
    File &quot;/engine.py&quot;, line 26, in train_one_epoch
      for images, targets in metric_logger.log_every(data_loader, print_freq, header):
    File &quot;/utils.py&quot;, line 180, in log_every
      for obj in iterable:
    File &quot;/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py&quot;, line 521, in __next__
      data = self._next_data()
    File &quot;/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py&quot;, line 1203, in _next_data
      return self._process_data(data)
    File &quot;/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py&quot;, line 1229, in _process_data
      data.reraise()
    File &quot;/usr/local/lib/python3.6/dist-packages/torch/_utils.py&quot;, line 425, in reraise
      raise self.exc_type(msg)
  TypeError: Caught TypeError in DataLoader worker process 0.
  Original Traceback (most recent call last):
    File &quot;/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/worker.py&quot;, line 287, in _worker_loop
      data = fetcher.fetch(index)
    File &quot;/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/fetch.py&quot;, line 44, in fetch
      data = [self.dataset[idx] for idx in possibly_batched_index]
    File &quot;/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/fetch.py&quot;, line 44, in &lt;listcomp&gt;
      data = [self.dataset[idx] for idx in possibly_batched_index]
    File &quot;/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataset.py&quot;, line 311, in __getitem__
      return self.dataset[self.indices[idx]]
    File &quot;main.py&quot;, line 64, in __getitem__
      img, target = self.transforms(img, target)
    File &quot;/transforms.py&quot;, line 26, in __call__
      image, target = t(image, target)
    File &quot;/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py&quot;, line 1051, in _call_impl
      return forward_call(*input, **kwargs)
    File &quot;/transforms.py&quot;, line 50, in forward
      image = F.to_tensor(image)
    File &quot;/usr/local/lib/python3.6/dist-packages/torchvision/transforms/functional.py&quot;, line 129, in to_tensor
      np.array(pic, mode_to_nptype.get(pic.mode, np.uint8), copy=True)
  TypeError: __array__() takes 1 positional argument but 2 were given
  </code></pre>
  <p>I believe it means somewhere I'm using an array with 2 arguments which isn't allowed, but I don't really know where abouts that is happening - perhaps in one of their pre written libraries?</p>
  <p>I can share the code in full if desired, but thought its a bit unwieldy. Does anyone know what might be causing this error?</p>