1#pragma once
2
3#include <torch/csrc/python_headers.h>
4
5#include <c10/core/MemoryFormat.h>
6
7#include <string>
8
9const int MEMORY_FORMAT_NAME_LEN = 64;
10
11struct THPMemoryFormat {
12 PyObject_HEAD at::MemoryFormat memory_format;
13 // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays)
14 char name[MEMORY_FORMAT_NAME_LEN + 1];
15};
16
17extern PyTypeObject THPMemoryFormatType;
18
19inline bool THPMemoryFormat_Check(PyObject* obj) {
20 return Py_TYPE(obj) == &THPMemoryFormatType;
21}
22
23PyObject* THPMemoryFormat_New(
24 at::MemoryFormat memory_format,
25 const std::string& name);
26
27void THPMemoryFormat_init(PyObject* module);
28