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

Make some fixes for PyTorch 1.0 #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

terrybroad
Copy link

I made some small fixes for PyTorch 1.0.

transforms.Scale has been deprecated and transforms.Resize should not be used.

And I was getting this bug:

Traceback (most recent call last):
  File "train_svg_lp.py", line 367, in <module>
    plot(x, epoch)
  File "train_svg_lp.py", line 251, in plot
    utils.save_tensors_image(fname, to_plot)
  File "/home/terence/repos/my_code/svg/utils.py", line 187, in save_tensors_image
    return save_image(filename, images)
  File "/home/terence/repos/my_code/svg/utils.py", line 182, in save_image
    img = make_image(tensor)
  File "/home/terence/repos/my_code/svg/utils.py", line 153, in make_image
    channel_axis=0)
  File "/home/terence/.local/lib/python3.6/site-packages/numpy/lib/utils.py", line 101, in newfu$
    return func(*args, **kwds)
  File "/home/terence/.local/lib/python3.6/site-packages/scipy/misc/pilutil.py", line 381, in to$
    bytedata = bytescale(data, high=high, low=low, cmin=cmin, cmax=cmax)
  File "/home/terence/.local/lib/python3.6/site-packages/numpy/lib/utils.py", line 101, in newfu$
    return func(*args, **kwds)
  File "/home/terence/.local/lib/python3.6/site-packages/scipy/misc/pilutil.py", line 105, in by$
    return (bytedata.clip(low, high) + 0.5).astype(uint8)
AttributeError: 'Tensor' object has no attribute 'astype'

When images were trying to be saved so I had to call detach() on the tensor before converting it to a numpy array.

@terrybroad terrybroad changed the title Makes fixes for PyTorch 1.0 Make some fixes for PyTorch 1.0 Feb 26, 2019
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

Successfully merging this pull request may close these issues.

1 participant