The model input should reflect your dataset, in the tutorial, the class Neural_Network is designed for 2d input vectors, hence inputSize = 2. In your dataset, if entries are (Tensor, str), I guest input is the tensor and the label is the str, but the model in the tutorial the output is scalar .