Skip to content

Add conversions between DataType and ScalarType.#10472

Closed
ezyang wants to merge 3 commits intopytorch:masterfrom
ezyang:export-D9298048
Closed

Add conversions between DataType and ScalarType.#10472
ezyang wants to merge 3 commits intopytorch:masterfrom
ezyang:export-D9298048

Conversation

@ezyang
Copy link
Contributor

@ezyang ezyang commented Aug 13, 2018

Differential Revision: D9298048

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.

ezyang added 3 commits August 15, 2018 14:50
Summary:
Have you ever written an operator<< overload in the caffe2 namespace
in a core Caffe2 header, and then been stunned when some completely
unrelated code started breaking?  This diff fixes this problem!

The problem looks like this:
1. You're building against a really old version of glog (think 0.3.2,
   or something like that)
2. This version of glog defines operator<< overloads for std containers
   in the global namespace
3. You add a new overload in your current namespace (e.g., caffe2).
   Congratulations: this overload is *preferentially* chosen over
   the global namespace one for all calls to << in that namespace.
   And since it doesn't actually have std::vector overloads, unrelated
   Caffe2 code breaks.

Newer versions of glog have a fix for this: they have the line:

  namespace std { using ::operator<<; }

in their header.  So let's help old versions of glog out and do this ourselves.

In our new world order, operator<< overloads defined in the global namespace
won't work (unless they're for std containers, which work because of ADL).
So this diff also moves all those overloads to the correct namespace.

Differential Revision: D9344540

fbshipit-source-id: 258f7eadfa1969267ef198a60c1886a761d094d3
Differential Revision: D9346040

fbshipit-source-id: 5d25f118c1926fd242ad0229fc5f4fdd17724dca
Summary: Pull Request resolved: pytorch#10472

Reviewed By: gchanan

Differential Revision: D9298048

fbshipit-source-id: 79bcf6107fa32af442a9d1263ea0c8a2c80be637
zdevito pushed a commit to zdevito/ATen that referenced this pull request Aug 16, 2018
Summary: Pull Request resolved: pytorch/pytorch#10472

Reviewed By: gchanan

Differential Revision: D9298048

fbshipit-source-id: c58efa582eab64c58d0771d90d90862911c168d1
@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.

2 participants