Runtime error after scaling

Hi. I was preprocessing my audio file. after scaling my mel spectogram with standard scaler , minmax (I’ve tried both) It occurs a runtime error. but the input without scaling was also float type.
:rofl:

RuntimeError Traceback (most recent call last)
in ()
5 criterion_multioutput = nn.CrossEntropyLoss()
6 optimizer = optim.SGD(model.parameters(), lr=0.001, momentum=0.9)
----> 7 model =train_model(model, criterion_multioutput, optimizer)
8
9 SAVE_PATH = os.path.join(os.getcwd(),‘models’)

11 frames
/usr/local/lib/python3.6/dist-packages/torch/nn/modules/conv.py in _conv_forward(self, input, weight)
418 _pair(0), self.dilation, self.groups)
419 return F.conv2d(input, weight, self.bias, self.stride,
–> 420 self.padding, self.dilation, self.groups)
421
422 def forward(self, input: Tensor) -> Tensor:

RuntimeError: expected scalar type Double but found Float

The input tensor or the model parameters seem to be DoubleTensors while the others are FloatTensors. You could transform the data type via model.float() or tensor.float() depending which of these two objects is using the double type.

1 Like