Clamp() got an unexpected keyword argument 'out'

I built PyTorch from source running

python clean
python install

as described here which mentions a similar problem.

I still get

TypeError: clamp() got an unexpected keyword argument 'out'

after calling either of the following:

x.clamp(-1, 0, out=x) 
torch.clamp (x, -1, 0, out=x)

x.clamp is not expected to take out, but per the documentation it is a bug that torch.clamp does not.
For your case, the inplace x.clamp_ might work.

Best regards


1 Like