diff --git a/aten/src/ATen/core/UndefinedTensorImpl.h b/aten/src/ATen/core/UndefinedTensorImpl.h index fcfdffa75dd..885f6e195f0 100644 --- a/aten/src/ATen/core/UndefinedTensorImpl.h +++ b/aten/src/ATen/core/UndefinedTensorImpl.h @@ -1,34 +1 @@ -#pragma once - -#include - -namespace at { - -struct CAFFE2_API UndefinedTensorImpl final : public TensorImpl { - public: - // Without this, we get: - // error: identifier "at::UndefinedTensorImpl::_singleton" is undefined in device code - // (ostensibly because the constexpr tricks MSVC into trying to compile this - // function for device as well). -#ifdef _WIN32 - static inline TensorImpl * singleton() { -#else - static constexpr inline TensorImpl * singleton() { -#endif - return &_singleton; - } - IntList sizes() const override; - IntList strides() const override; - int64_t size(int64_t d) const override; - int64_t stride(int64_t d) const override; - int64_t dim() const override; - const Storage& storage() const override; - int64_t storage_offset() const override; -private: - UndefinedTensorImpl(); - static UndefinedTensorImpl _singleton; -public: - friend struct UndefinedType; -}; - -} // namespace at +#include diff --git a/aten/src/ATen/core/UndefinedTensorImpl.cpp b/c10/core/UndefinedTensorImpl.cpp similarity index 94% rename from aten/src/ATen/core/UndefinedTensorImpl.cpp rename to c10/core/UndefinedTensorImpl.cpp index 704f975bd95..2e2265397ea 100644 --- a/aten/src/ATen/core/UndefinedTensorImpl.cpp +++ b/c10/core/UndefinedTensorImpl.cpp @@ -1,7 +1,7 @@ -#include +#include #include -namespace at { +namespace c10 { // should this use the globalContext? Can it get a context passed in somehow? UndefinedTensorImpl::UndefinedTensorImpl() diff --git a/c10/core/UndefinedTensorImpl.h b/c10/core/UndefinedTensorImpl.h new file mode 100644 index 00000000000..5d268b7b821 --- /dev/null +++ b/c10/core/UndefinedTensorImpl.h @@ -0,0 +1,34 @@ +#pragma once + +#include + +namespace c10 { + +struct C10_API UndefinedTensorImpl final : public TensorImpl { + public: + // Without this, we get: + // error: identifier "at::UndefinedTensorImpl::_singleton" is undefined in device code + // (ostensibly because the constexpr tricks MSVC into trying to compile this + // function for device as well). +#ifdef _WIN32 + static inline TensorImpl * singleton() { +#else + static constexpr inline TensorImpl * singleton() { +#endif + return &_singleton; + } + IntList sizes() const override; + IntList strides() const override; + int64_t size(int64_t d) const override; + int64_t stride(int64_t d) const override; + int64_t dim() const override; + const Storage& storage() const override; + int64_t storage_offset() const override; +private: + UndefinedTensorImpl(); + static UndefinedTensorImpl _singleton; +public: + friend struct UndefinedType; +}; + +} // namespace c10