KEMBAR78
Incorrect size for __rpow__(scalar, float) · Issue #16685 · pytorch/pytorch · GitHub
Skip to content

Incorrect size for __rpow__(scalar, float) #16685

@fritzo

Description

@fritzo

🐛 Bug

>>> 4 ** torch.tensor(0.5)
torch.tensor([2.])

To Reproduce

Here is a regression test:

def test_rpow_scalar_float_shape():
    assert (4 ** torch.tensor(0.5)).shape == ()

Expected behavior

Binary op of (scalar, number) should be a scalar.

Environment

PyTorch version: 1.0.0
Is debug build: No
CUDA used to build PyTorch: None

OS: Mac OSX 10.14.1
GCC version: Could not collect
CMake version: version 3.12.0

Python version: 2.7
Is CUDA available: No
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA

Versions of relevant libraries:
[pip] Could not collect
[conda] mkl                       2018.0.2                      1
[conda] mkl_fft                   1.0.1            py27h917ab60_0
[conda] mkl_random                1.0.1            py27h78cc56f_0
[conda] torch                     1.0.0                     <pip>
[conda] torch-nightly             1.0.0.dev20181206           <pip>
[conda] torchfile                 0.1.0                     <pip>
[conda] torchvision               0.2.1                     <pip>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions