mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
Move UndefinedTensorImpl to c10 (meh) (#14817)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/14817 unfortunately, we still need this. Reviewed By: ezyang Differential Revision: D13348041 fbshipit-source-id: e8dcc89f5c71bd1ea2c9813990dac6e58e63b1fd
This commit is contained in:
parent
2dfdbef91d
commit
63db95dd11
3 changed files with 37 additions and 36 deletions
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include <ATen/core/UndefinedTensorImpl.h>
|
||||
#include <c10/core/UndefinedTensorImpl.h>
|
||||
#include <c10/util/Exception.h>
|
||||
|
||||
namespace at {
|
||||
namespace c10 {
|
||||
|
||||
// should this use the globalContext? Can it get a context passed in somehow?
|
||||
UndefinedTensorImpl::UndefinedTensorImpl()
|
||||
34
c10/core/UndefinedTensorImpl.h
Normal file
34
c10/core/UndefinedTensorImpl.h
Normal file
|
|
@ -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
|
||||
Loading…
Reference in a new issue