Hi,
I am trying to use a Dataset loader in order to load the CIFAR-1O data set from a local drive.
For learning purposes, I do NOT wish to use the already available loader as shown here:

  
      github.com
  
  
    pytorch/tutorials/blob/master/beginner_source/blitz/cifar10_tutorial.py 51
# -*- coding: utf-8 -*-
"""
Training a classifier
=====================

This is it. You have seen how to define neural networks, compute loss and make
updates to the weights of the network.

Now you might be thinking,

What about data?
----------------

Generally, when you have to deal with image, text, audio or video data,
you can use standard python packages that load data into a numpy array.
Then you can convert this array into a ``torch.*Tensor``.

-  For images, packages such as Pillow, OpenCV are useful.
-  For audio, packages such as scipy and librosa
-  For text, either raw Python or Cython based loading, or NLTK and


  This file has been truncated. show original

  
  
    
    
  
  


E.g. torchvision.datasets.CIFAR10.
I downloaded the data manually from here: https://www.kaggle.com/c/cifar-10/data 17
Few questions:


Using the original example, I can see that the original labels, are NOT one hot encoded, do I assume correctly that
cross-entropy and neg. log-likelihood losses in pytorch do NOT require one-hot encodings?


In my custom code (https://github.com/QuantScientist/Deep-Learning-Boot-Camp/blob/master/day%2002%20PyTORCH%20and%20PyCUDA/PyTorch/19%20PyTorch%20CIFAR-10.ipynb 49), I can see that the data as well as the labels are loaded correctly, when I tried (wrongly?) to one hot encode them, an exception was thrown during iteration.


However, now I do not one hot encode them (assuming 1 above is true), and the following exception is thrown while iterating the dataset:
TypeError: ufunc 'add' did not contain a loop with signature matching types dtype('S55') dtype('S55') dtype('S55')
This is the code for iterating:

imagesToShow=4
for i, data in enumerate(train_loader, 0):
lgr.info 2('i=%d: '%(i))
images, labels = data
num = len(images)

ax = plt.subplot(1, imagesToShow, i + 1)
plt.tight_layout()
ax.set_title('Sample #{}'.format(i))
ax.axis('off')

for n in range(num):
    image=images[n]
    label=labels[n]
    plt.imshow (GenericImageDataset.flaotTensorToImage(image))
    
if i==imagesToShow-1:
    break    

Thanks for any help,