Skip to content

Conversation

ezyang
Copy link
Contributor

@ezyang ezyang commented Aug 29, 2018

Get rid of type() method on TensorOptions; use at::getType instead

I'd like TensorOptions to not know anything about Context, so I can
move it to ATen/core without pulling in Context. To do this, the
type() method has to go, since it consults the context to get a Type.

Differential Revision: D9562467

Stacked on #11145

Differential Revision: D9562467
Differential Version: 56443875
@ezyang ezyang changed the title Get rid of type() method on TensorOptions; use at::getType instead [WIP] Get rid of type() method on TensorOptions; use at::getType instead Aug 29, 2018
@ezyang
Copy link
Contributor Author

ezyang commented Aug 29, 2018

(This doesn't compile yet)

function_name,
" is not implemented for sparse types, got: ",
options.type().toString());
at::getType(options).toString());

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.


Tensor eye(int64_t n, int64_t m, const TensorOptions& options) {
auto tensor = options.type().tensor({});
auto tensor = at::getType(options).tensor({});

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

Differential Revision: D9562467
Differential Version: 56445436
@ezyang ezyang changed the title [WIP] Get rid of type() method on TensorOptions; use at::getType instead Get rid of type() method on TensorOptions; use at::getType instead Aug 29, 2018
ezyang added 2 commits August 29, 2018 14:14
Differential Revision: D9562467
Differential Version: 56447016
Differential Revision: D9562467
Differential Version: 56447216
@ezyang
Copy link
Contributor Author

ezyang commented Aug 29, 2018

@pytorchbot retest this please

1 similar comment
@ezyang
Copy link
Contributor Author

ezyang commented Aug 30, 2018

@pytorchbot retest this please

Differential Revision: D9562467
Differential Version: 56473044
}
DeviceGuard guard(options.device());
return options.type().copy(tensor, non_blocking);
return at::getType(options).copy(tensor, non_blocking);

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

function_name,
" expects floating point dtypes, got: ",
options.type().toString());
at::getType(options).toString());

This comment was marked as off-topic.

Copy link
Contributor

@cpuhrsch cpuhrsch left a comment

Choose a reason for hiding this comment

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

accepted, but please work through comments first

ezyang added 2 commits August 30, 2018 20:58
Differential Revision: D9562467
Differential Version: 56608519
Differential Revision: D9562467
Differential Version: 56650790
@ezyang ezyang changed the base branch from export-D9562312 to export-D9613897 August 31, 2018 15:36
ezyang added 3 commits August 31, 2018 08:46
Differential Revision: D9562467
Differential Version: 56651350
Differential Revision: D9562467
Differential Version: 56652506
Differential Revision: D9562467
Differential Version: 56672440
zdevito pushed a commit to zdevito/ATen that referenced this pull request Aug 31, 2018
…11023)

Summary:
Pull Request resolved: pytorch/pytorch#11023

I'd like TensorOptions to not know anything about Context, so I can
move it to ATen/core without pulling in Context.  To do this, the
type() method has to go, since it consults the context to get a Type.

Reviewed By: cpuhrsch

Differential Revision: D9562467

fbshipit-source-id: 61a18a76eb042a5e70b64b963501e9d68c25d4f0
PenghuiCheng pushed a commit to PenghuiCheng/pytorch that referenced this pull request Sep 11, 2018
…ytorch#11023)

Summary:
Pull Request resolved: pytorch#11023

I'd like TensorOptions to not know anything about Context, so I can
move it to ATen/core without pulling in Context.  To do this, the
type() method has to go, since it consults the context to get a Type.

Reviewed By: cpuhrsch

Differential Revision: D9562467

fbshipit-source-id: 61a18a76eb042a5e70b64b963501e9d68c25d4f0
@soumith soumith deleted the export-D9562467 branch February 21, 2019 12:09
@ezyang ezyang added the merged label Jun 26, 2019
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.

4 participants