Skip to content

BUG torch.bernoulli(p.expand(shape)) is broken #9917

@fritzo

Description

@fritzo

Issue description

This is blocking Pyro from updating from Pytorch 0.4.0 to 0.4.1. (along with #9521)

Code examples

torch.set_default_tensor_type('torch.DoubleTensor')
for i in range(10000):
    probs = torch.tensor([0.25, 0.25])
    torch.bernoulli(probs.expand([2, 1, 2]))
Traceback (most recent call last):
  File "<stdin>", line 3, in <module>
RuntimeError: invalid argument 1: must be >= 0 and <= 1 at /Users/soumith/code/builder/wheel/pytorch-src/aten/src/TH/THRandom.cpp:314

System info

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

OS: Mac OSX 10.13.3
GCC version: Could not collect
CMake version: version 3.9.6

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] torch                     0.4.1                     <pip>
[conda] torchfile                 0.1.0                     <pip>
[conda] torchvision               0.2.1                     <pip>

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions