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

How to solve the RuntimeError: data set to a tensor that requires gradients must be floating point or complex dtype #334

Open
liaoyil opened this issue Feb 27, 2024 · 0 comments

Comments

@liaoyil
Copy link

liaoyil commented Feb 27, 2024

my test_A and test_B is png photo ,
when I use "python test.py --name arch2cons --netG local --ngf 32 --resize_or_crop none --label_nc 0 --dataroot "datasets/arch2cons" --input_nc 3 --no_instance ",
my terminal show me "
Pretrained network G has fewer layers; The following are not initialized:
['model', 'model1_1', 'model1_2', 'model2_1', 'model2_2', 'model3_1', 'model3_2']
Traceback (most recent call last):
File "D:\DC\Code\Code\pix2pixHD-master\test.py", line 33, in
model.type(torch.uint8)
File "D:\anaconda3\envs\pytorch\Lib\site-packages\torch\nn\modules\module.py", line 974, in type
return self._apply(lambda t: t.type(dst_type))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\anaconda3\envs\pytorch\Lib\site-packages\torch\nn\modules\module.py", line 802, in _apply
module._apply(fn)
File "D:\anaconda3\envs\pytorch\Lib\site-packages\torch\nn\modules\module.py", line 802, in _apply
module._apply(fn)
File "D:\anaconda3\envs\pytorch\Lib\site-packages\torch\nn\modules\module.py", line 802, in _apply
module._apply(fn)
File "D:\anaconda3\envs\pytorch\Lib\site-packages\torch\nn\modules\module.py", line 828, in _apply
param.data = param_applied
^^^^^^^^^^
RuntimeError: data set to a tensor that requires gradients must be floating point or complex dtype"
I'm just a sophomore with very little understanding about this , who can help me?

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

1 participant