1#pragma once
2
3#include <c10/core/TensorImpl.h>
4
5namespace c10 {
6
7struct C10_API UndefinedTensorImpl final : public TensorImpl {
8 public:
9 // Without this, we get:
10 // error: identifier "at::UndefinedTensorImpl::_singleton" is undefined in
11 // device code
12 // (ostensibly because the constexpr tricks MSVC into trying to compile this
13 // function for device as well).
14#ifdef _WIN32
15 static inline TensorImpl* singleton() {
16#else
17 static constexpr inline TensorImpl* singleton() {
18#endif
19 return &_singleton;
20 }
21#ifdef DEBUG
22 bool has_storage() const override;
23#endif
24 void set_storage_offset(int64_t offset) override;
25
26 protected:
27 bool is_contiguous_custom(MemoryFormat format) const override;
28 IntArrayRef strides_custom() const override;
29 SymIntArrayRef sym_strides_custom() const override;
30
31 private:
32 UndefinedTensorImpl();
33 static UndefinedTensorImpl _singleton;
34 const char* tensorimpl_type_name() const override;
35};
36
37} // namespace c10
38