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

Replace type().ScalarType() with scalar_type() #272

Merged
merged 8 commits into from
Apr 26, 2019

Conversation

ptrblck
Copy link
Contributor

@ptrblck ptrblck commented Apr 24, 2019

Fixes #267

PyTorch PR pytorch/pytorch#17991 introduced some breaking changes which broke building apex using PyTorch master.

This PR replaces all deprecated .type().ScalarType() calls with .scalar_type() as well as at::ScalarType::Type with at::kType.

@Stonesjtu
Copy link

Hi, I think we should tag the current master as a compatible version for the latest pytorch stable release.

csrc/type_shim.h Outdated

#define DISPATCH_FLOAT_AND_HALF(TYPE, LEVEL, NAME, ...) \
switch(TYPE) \
{ \
case at::ScalarType::Float: \
case at::kFloat: \
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel more comfortable with the existing at::ScalarType::Float syntax because that's what the upstream dispatch macros currently use https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/Dispatch.h

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've changed it back to the at::ScalarType::Type usage for most of the code. I only left the usage of at::kType for creating new tensors (in case tensor.scalar_type() wasn't used), as it seems to be the recommended way (link).

Would this be alright or should I revert all usages of at::kType?

Copy link
Contributor

Choose a reason for hiding this comment

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

I feel most comfortable mirroring what upstream does, so this seems fine

@mcarilli mcarilli merged commit 855808f into NVIDIA:master Apr 26, 2019
@ptrblck ptrblck deleted the scalar_type branch April 26, 2019 16:54
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

Successfully merging this pull request may close these issues.

error: class "at::Type" has no member "scalarType"
3 participants