numpy array type not supported?
I'm trying to copy a model I was able to follow and run through a tutorial, but this time with my own data.
I was able to convert my own MRI images to numpy arrays in the same dimensions as the arrays the tutorial data is.
I tried replacing the numpy arrays in my tutorial with my own arrays and writing my own fictional csv file for normal or abnormal (case, not case).
However when I run it, I get:
(Pytorch) C:\Users\GlaDOS\PythonProjects\dicomnpy&gt;python train.py  -t acl -p sagittal --epochs=10 --prefix_name hue
Traceback (most recent call last):
  File &quot;train.py&quot;, line 277, in &lt;module&gt;
    run(args)
  File &quot;train.py&quot;, line 214, in run
    mrnet, train_loader, epoch, num_epochs, optimizer, writer, current_lr, log_every)
  File &quot;train.py&quot;, line 34, in train_model
    for i, (image, label, weight) in enumerate(train_loader):
  File &quot;C:\Users\GlaDOS\anaconda3\envs\Pytorch\lib\site-packages\torch\utils\data\dataloader.py&quot;, line 345, in __next__
    data = self._next_data()
  File &quot;C:\Users\GlaDOS\anaconda3\envs\Pytorch\lib\site-packages\torch\utils\data\dataloader.py&quot;, line 385, in _next_data
    data = self._dataset_fetcher.fetch(index)  # may raise StopIteration
  File &quot;C:\Users\GlaDOS\anaconda3\envs\Pytorch\lib\site-packages\torch\utils\data\_utils\fetch.py&quot;, line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File &quot;C:\Users\GlaDOS\anaconda3\envs\Pytorch\lib\site-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;C:\Users\GlaDOS\PythonProjects\dicomnpy\dataloader.py&quot;, line 56, in __getitem__
    array = self.transform(array)
  File &quot;c:\users\glados\src\torchsample\torchsample\transforms\tensor_transforms.py&quot;, line 32, in __call__
    inputs = transform(*inputs)
  File &quot;C:\Users\GlaDOS\anaconda3\envs\Pytorch\lib\site-packages\torchvision\transforms\transforms.py&quot;, line 313, in __call__
    return self.lambd(img)
  File &quot;train.py&quot;, line 167, in &lt;lambda&gt;
    transforms.Lambda(lambda x: torch.Tensor(x)),
TypeError: can't convert np.ndarray of type numpy.uint16. The only supported types are: float64, float32, float16, int64, int32, int16, int8, uint8, and bool.

Now I'm wondering if this error means I somehow didn't convert my MRI's to the &quot;correct&quot; numpy array type? And if so, how do I go about changing them to the correct type?

You can redefining the variable with astype
your_array = your_array.astype(np.uint16)

