I expect for the code to train and be able to predict. other points that help clarify my general problem:.RuntimeError: Expected object of scalar type Long but got scalar type Float for argument #2 'target' in call to _thnn_nll_loss_forward Ret = torch._C._nn.nll_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index) Return nll_loss(log_softmax(input, 1), target, weight, None, ignore_index, None, reduction)įile "C:\Users\User\Anaconda3\envs\torch\lib\site-packages\torch\nn\functional.py", line 1838, in nll_loss Ignore_index=self.ignore_index, reduction=self.reduction)įile "C:\Users\User\Anaconda3\envs\torch\lib\site-packages\torch\nn\functional.py", line 2009, in cross_entropy Pydev_imports.execfile(file, globals, locals) # execute the scriptįile "C:\Program Files\JetBrains\P圜harm Community Edition 2019.2\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfileĮxec(compile(contents+"\n", file, 'exec'), glob, loc)įile "C:/Users/User/Desktop/paper_recreation/PCA_CNN/CNN_DEBUG.py", line 109, in įile "C:\Users\User\Anaconda3\envs\torch\lib\site-packages\torch\nn\modules\module.py", line 541, in _call_įile "C:\Users\User\Anaconda3\envs\torch\lib\site-packages\torch\nn\modules\loss.py", line 916, in forward Return self._exec(is_module, entry_point_fn, module_name, file, globals, locals)įile "C:\Program Files\JetBrains\P圜harm Community Edition 2019.2\helpers\pydev\pydevd.py", line 1412, in _exec Globals = n(setup, None, None, is_module)įile "C:\Program Files\JetBrains\P圜harm Community Edition 2019.2\helpers\pydev\pydevd.py", line 1405, in run The program is throwing the following error: Traceback (most recent call last):įile "C:\Program Files\JetBrains\P圜harm Community Edition 2019.2\helpers\pydev\pydevd.py", line 2060, in įile "C:\Program Files\JetBrains\P圜harm Community Edition 2019.2\helpers\pydev\pydevd.py", line 2054, in main Optimizer = (model.parameters(), lr=learning_rate) Test_loader = (dataset=custom_dataset.MNIST_test, Shuffle=True) # outputs (sample, targets) -> (64圆6, 64x1) Train_loader = (dataset=custom_dataset.MNIST_train, I don't know how to properly share data, but long-story short the input has 66 features between (using PCA to decompose the MNIST image) import torch I have re-written my code, fact checked my methodology with a colleague, and also done some rubber-duck programming to no avail. What have you done to try and solve the problem?.I predict it has something to do with the way that my Net is setup/outputting. float() when entering into the loss function. I have done a lot of online searching, and others had similar problems. have you done some research before asking the question?.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |