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

Pytorch Error #3

Open
cap-jmk opened this issue Mar 14, 2020 · 3 comments
Open

Pytorch Error #3

cap-jmk opened this issue Mar 14, 2020 · 3 comments

Comments

@cap-jmk
Copy link

cap-jmk commented Mar 14, 2020

When trying to reproduce the examples I recieve the following error when using the mirror flag:

Output

outputFolderolder results/milano/archimboldo/2020-03-14_12-29-31/
Namespace(LS=False, N=80, Ubottleneck=-1, WGAN=True, batchSize=8, beta1=0.5, blendMode=0, cLoss=0, contentPath='samples/archimboldo/', contentScale=1.0, coordCopy=True, dIter=2, fAdvM=0.0, fAlpha=0.1, fContent=1.0, fContentM=1.0, fDiversity=1, fEntropy=0.5, fTV=0.1, firstNoise=False, imageSize=160, lr=0.0002, manualSeed=None, mirror=True, multiScale=False, nBlocks=0, nDep=4, nDepD=4, ndf=80, ngf=80, niter=100, outputFolder='results/milano/archimboldo/2020-03-14_12-29-31/', refine=False, skipConnections=True, testImage='None', texturePath='samples/milano/', textureScale=1.0, trainOverfit=False, workers=0, zGL=20, zLoc=10, zPeriodic=0)
Random Seed:  2593
m1.png img added (1702, 806) total length 1
m2.png img added (1698, 804) total length 2
m4.png img added (1777, 744) total length 3
m3.png img added (1700, 818) total length 4
1200px-Giuseppe_Arcimboldo_-_Self_Portrait_-_Google_Art_Project.jpg img added (1200, 1782) total length 1
image input torch.Size([1, 3, 1760, 1184])
/usr/local/lib/python3.6/site-packages/torch/nn/functional.py:2764: UserWarning: Default grid_sample and affine_grid behavior has changed to align_corners=False since 1.3.0. Please specify align_corners=True if the old behavior is desired. See the documentation of grid_sample for details.
  warnings.warn("Default grid_sample and affine_grid behavior has changed "
tcmalloc: large alloc 2000486400 bytes == 0x555ed222e000 @  0x7fb535602b6b 0x7fb535622379 0x7fb4db742b4a 0x7fb4db7445fa 0x7fb4dd86c78a 0x7fb4ddab530b 0x7fb4ddafcb37 0x7fb526983ad5 0x7fb52698417b 0x7fb526988160 0x7fb52696009b 0x555e58295965 0x555e58205d7b 0x555e582957ce 0x555e582b7cba 0x555e5828ea94 0x555e5828f941 0x555e58295755 0x555e582b8a7a 0x555e58290459 0x555e582911ec 0x555e5830b9a4 0x555e5830bda1 0x555e5830bfa4 0x555e5830fa9e 0x555e581d74be 0x7fb534ffeb97 0x555e582be773
image input torch.Size([1, 3, 806, 1702])
Traceback (most recent call last):
  File "mosaicFAMOS.py", line 69, in <module>
    targetMosaic,templates=getTemplates(opt,N,vis=True,path=opt.outputFolder+desc)
  File "/content/drive/My Drive/Colab Notebooks/SatelliteFAMOS/prepareTemplates.py", line 139, in getTemplates
    out[n:n+1] = randomTile(flow,z)
  File "/content/drive/My Drive/Colab Notebooks/SatelliteFAMOS/prepareTemplates.py", line 96, in randomTile
    f=reflect(f)
  File "/content/drive/My Drive/Colab Notebooks/SatelliteFAMOS/prepareTemplates.py", line 82, in reflect
    return reflect_mirror(x)
  File "/content/drive/My Drive/Colab Notebooks/SatelliteFAMOS/prepareTemplates.py", line 74, in reflect_mirror
    f=torch.where(torch.ByteTensor(f>1), 2-f, f) #so 1:3 maps to 1:-1 - -reflection
TypeError: expected Byte (got Bool)```
@stay-cnsj
Copy link

I removed torch.ByteTensor(.) then fixed the error.

@cap-jmk
Copy link
Author

cap-jmk commented Dec 17, 2020

Thank you :)

@Daya2821
Copy link

When trying to reproduce the examples I receive the following error : I use torch===0.4.1 torchvision===0.4.2.

template size torch.Size([8, 80, 3, 160, 160]) /usr/local/lib/python3.7/dist-packages/torch/nn/functional.py:1698: UserWarning: nn.functional.tanh is deprecated. Use torch.tanh instead. warnings.warn("nn.functional.tanh is deprecated. Use torch.tanh instead.") /usr/local/lib/python3.7/dist-packages/torch/nn/functional.py:1709: UserWarning: nn.functional.sigmoid is deprecated. Use torch.sigmoid instead. warnings.warn("nn.functional.sigmoid is deprecated. Use torch.sigmoid instead.") Traceback (most recent call last): File "/content/drive/MyDrive/ColabNotebooks/famos-master/mosaicFAMOS.py", line 173, in <module> output = netD(fake.detach())#???why detach File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/content/drive/MyDrive/ColabNotebooks/famos-master/network.py", line 63, in forward output = self.main(input) File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/container.py", line 119, in forward input = module(input) File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/conv.py", line 399, in forward return self._conv_forward(input, self.weight, self.bias) File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/conv.py", line 396, in _conv_forward self.padding, self.dilation, self.groups) RuntimeError: set_sizes_and_strides is not allowed on a Tensor created from .data or .detach(). If your intent is to change the metadata of a Tensor (such as sizes / strides / storage / storage_offset) without autograd tracking the change, remove the .data / .detach() call and wrap the change in a with torch.no_grad():` block.
For example, change:
x.data.set_(y)
to:
with torch.no_grad():
x.set_(y)

`

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

3 participants