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

AttributeError: 'Tensor' object has no attribute 'clip' #14

Closed
mingyanglei opened this issue Jun 19, 2021 · 1 comment
Closed

AttributeError: 'Tensor' object has no attribute 'clip' #14

mingyanglei opened this issue Jun 19, 2021 · 1 comment

Comments

@mingyanglei
Copy link

mingyanglei commented Jun 19, 2021

Hi there, it seemed that your latest commit(5ef88c3) didn't work well with PyTorch 1.6? After python run.py, I got the following error,

Traceback (most recent call last):
File "run.py", line 154, in
PIL.Image.fromarray((tenOutput.clip(0.0, 1.0).numpy().transpose(1, 2, 0)[:, :, 0] * 255.0).astype(numpy.uint8)).save(arguments_strOut)
AttributeError: 'Tensor' object has no attribute 'clip'

When I changed the clip back to clamp, it worked. Could you be so kind to provide me with any clues on this? Thanks.

@sniklaus
Copy link
Owner

The two are doing the same thing, clip is an alias for clamp: https://pytorch.org/docs/stable/generated/torch.clip.html

I switched it to clip, which got added to PyTorch in version 1.7.0, since that is what NumPy is using too.

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