-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move UndefinedTensorImpl to c10 (meh) (#14817)
Summary: Pull Request resolved: pytorch/pytorch#14817 unfortunately, we still need this. Reviewed By: ezyang Differential Revision: D13348041 fbshipit-source-id: e8dcc89f5c71bd1ea2c9813990dac6e58e63b1fd
- Loading branch information
1 parent
2dfdbef
commit 63db95d
Showing
3 changed files
with
37 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1 @@ | ||
#pragma once | ||
|
||
#include <c10/core/TensorImpl.h> | ||
|
||
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 <c10/core/UndefinedTensorImpl.h> |
4 changes: 2 additions & 2 deletions
4
aten/src/ATen/core/UndefinedTensorImpl.cpp → c10/core/UndefinedTensorImpl.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#pragma once | ||
|
||
#include <c10/core/TensorImpl.h> | ||
|
||
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 |