Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

basiclab lab1 mnist_tensorboard.py have some problems #14

Closed
Georgefwt opened this issue Mar 21, 2021 · 1 comment
Closed

basiclab lab1 mnist_tensorboard.py have some problems #14

Georgefwt opened this issue Mar 21, 2021 · 1 comment

Comments

@Georgefwt
Copy link

my environment : CUDAtoolkit 10.0 pytorch 1.5.0 tensorflow 1.15.0
when i run python mnist_tensorboard.py , some error happened:

2021-03-21 20:15:01.978418: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_100.dll
2021-03-21 20:15:04.781186: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_100.dll
Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same
Error occurs, No graph saved
Traceback (most recent call last):
  File "mnist_tensorboard.py", line 199, in <module>
    main()
  File "mnist_tensorboard.py", line 182, in main
    writer.add_graph(model, images)
  File "D:\Program_Files\Anaconda3\envs\ai-system-learn\lib\site-packages\torch\utils\tensorboard\writer.py", line 707, in add_graph
    self._get_file_writer().add_graph(graph(model, input_to_model, verbose))
  File "D:\Program_Files\Anaconda3\envs\ai-system-learn\lib\site-packages\torch\utils\tensorboard\_pytorch_graph.py", line 291, in graph
    raise e
  File "D:\Program_Files\Anaconda3\envs\ai-system-learn\lib\site-packages\torch\utils\tensorboard\_pytorch_graph.py", line 285, in graph
    trace = torch.jit.trace(model, args)
  File "D:\Program_Files\Anaconda3\envs\ai-system-learn\lib\site-packages\torch\jit\__init__.py", line 875, in trace
    check_tolerance, _force_outplace, _module_class)
  File "D:\Program_Files\Anaconda3\envs\ai-system-learn\lib\site-packages\torch\jit\__init__.py", line 1027, in trace_module
    module._c._create_method_from_trace(method_name, func, example_inputs, var_lookup_fn, _force_outplace)
  File "D:\Program_Files\Anaconda3\envs\ai-system-learn\lib\site-packages\torch\nn\modules\module.py", line 548, in __call__
    result = self._slow_forward(*input, **kwargs)
  File "D:\Program_Files\Anaconda3\envs\ai-system-learn\lib\site-packages\torch\nn\modules\module.py", line 534, in _slow_forward
    result = self.forward(*input, **kwargs)
  File "mnist_tensorboard.py", line 61, in forward
    x = self.conv1(x)
  File "D:\Program_Files\Anaconda3\envs\ai-system-learn\lib\site-packages\torch\nn\modules\module.py", line 548, in __call__
    result = self._slow_forward(*input, **kwargs)
  File "D:\Program_Files\Anaconda3\envs\ai-system-learn\lib\site-packages\torch\nn\modules\module.py", line 534, in _slow_forward
    result = self.forward(*input, **kwargs)
  File "D:\Program_Files\Anaconda3\envs\ai-system-learn\lib\site-packages\torch\nn\modules\conv.py", line 349, in forward
    return self._conv_forward(input, self.weight)
  File "D:\Program_Files\Anaconda3\envs\ai-system-learn\lib\site-packages\torch\nn\modules\conv.py", line 346, in _conv_forward
    self.padding, self.dilation, self.groups)
RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same

I think there are something wrong with tensorboard. How can I fix this?

@TobeyQin
Copy link
Contributor

同学你好,我们的样例程序是CPU版的,如果你使用GPU,请检查是否安装GPU版本的PyTorch。另外,image需要feed到cuda中的话,需要在后面加 .to(torch.device('cuda'))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants