c10d doesn't work with torch namespace (#14042)
authorZeming Lin <ebetica0@gmail.com>
Tue, 4 Dec 2018 21:42:11 +0000 (13:42 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 4 Dec 2018 21:47:20 +0000 (13:47 -0800)
Summary:
If both `Utils.hpp` and the `torch` namespace is included in the same file, the compiler won't know which fmap to use. I believe this is because of ADL. This change fixes that issue for me.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14042

Reviewed By: ezyang

Differential Revision: D13283810

Pulled By: ebetica

fbshipit-source-id: b68233336518230ba730e83ddac1226a66896533

torch/lib/c10d/Utils.hpp

index 752d8e4..1756ebf 100644 (file)
@@ -215,7 +215,7 @@ inline at::Tensor flattenDenseTensors(at::TensorList tensors) {
   if (tensors.size() == 1) {
     return flatten(tensors[0]);
   }
-  return at::cat(fmap(tensors, flatten));
+  return at::cat(::c10d::fmap(tensors, flatten));
 }
 
 inline at::Tensor newLikeFlat(