Skip to content

Fixes #8508. Upcasted loc to 1-d if a scalar loc is provided to MultivariateNormal#8543

Merged
soumith merged 2 commits intopytorch:masterfrom
praveen-palanisamy:scalar_loc_fix_MVN
Jun 25, 2018
Merged

Fixes #8508. Upcasted loc to 1-d if a scalar loc is provided to MultivariateNormal#8543
soumith merged 2 commits intopytorch:masterfrom
praveen-palanisamy:scalar_loc_fix_MVN

Conversation

@praveen-palanisamy
Copy link
Contributor

This fix unsqueezes the loc argument to make it 1-Dimensional in torch.distributions.MultivariateNormal.__init__ if the provided loc is a scalar thereby preventing the SIGFPE.

This is a simple fix for #8508

@praveen-palanisamy
Copy link
Contributor Author

The failed CI builds are due to docker not being able to pull some images (example: Error response from daemon: manifest for 308535385114.dkr.ecr.us-east-1.amazonaws.com/caffe2/py2-cuda8.0-cudnn7-ubuntu16.04:125 not found) and the other seems unrelated to this commit. Can someone please review/check?

@ezyang
Copy link
Contributor

ezyang commented Jun 15, 2018

@pytorchbot retest this please

@praveen-palanisamy praveen-palanisamy changed the title Fixes #8508 Broadcasted loc to 1-d if a scalar loc is provided to MultivariateNormal Fixes #8508 Upcasted loc to 1-d if a scalar loc is provided to MultivariateNormal Jun 15, 2018
@praveen-palanisamy praveen-palanisamy changed the title Fixes #8508 Upcasted loc to 1-d if a scalar loc is provided to MultivariateNormal Fixes #8508. Upcasted loc to 1-d if a scalar loc is provided to MultivariateNormal Jun 15, 2018
@praveen-palanisamy
Copy link
Contributor Author

Can someone please review this? It will probably take very less time to review but fixes the SIGFPE issue.
cc: @ezyang @zdevito @colesbury @soumith @gchanan @apaszke

Copy link
Collaborator

@fritzo fritzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not update args in-place. Instead use

loc = loc.unsqueeze(0)

Copy link
Collaborator

@fritzo fritzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you avoid updating loc in-place?

Copy link
Collaborator

@soumith soumith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will merge after contbuilds pass

@praveen-palanisamy
Copy link
Contributor Author

@soumith Notification: Builds have passed

@soumith soumith merged commit 49a3e49 into pytorch:master Jun 25, 2018
@soumith
Copy link
Collaborator

soumith commented Jun 25, 2018

thanks Praveen!

@praveen-palanisamy praveen-palanisamy deleted the scalar_loc_fix_MVN branch June 25, 2018 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants