mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/56830 Opt into formatting on GitHub and format everything. This is a trial run before turning on formatting for more and eventually all of the codebase. Test Plan: CI Reviewed By: zertosh Differential Revision: D27979080 fbshipit-source-id: a80f0c48691c08ae8ca0af06377b87e6a2351151
36 lines
911 B
C++
36 lines
911 B
C++
#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;
|
|
}
|
|
IntArrayRef strides() const override;
|
|
int64_t size(int64_t d) const override;
|
|
int64_t stride(int64_t d) const override;
|
|
#ifdef DEBUG
|
|
bool has_storage() const override;
|
|
#endif
|
|
void set_storage_offset(int64_t offset) override;
|
|
|
|
private:
|
|
UndefinedTensorImpl();
|
|
static UndefinedTensorImpl _singleton;
|
|
const char* tensorimpl_type_name() const override;
|
|
};
|
|
|
|
} // namespace c10
|