• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #pragma once
2 
3 #include <torch/csrc/python_headers.h>
4 
5 #include <ATen/Layout.h>
6 
7 #include <string>
8 
9 const int LAYOUT_NAME_LEN = 64;
10 
11 struct THPLayout {
12   PyObject_HEAD at::Layout layout;
13   // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays)
14   char name[LAYOUT_NAME_LEN + 1];
15 };
16 
17 extern PyTypeObject THPLayoutType;
18 
THPLayout_Check(PyObject * obj)19 inline bool THPLayout_Check(PyObject* obj) {
20   return Py_TYPE(obj) == &THPLayoutType;
21 }
22 
23 PyObject* THPLayout_New(at::Layout layout, const std::string& name);
24 
25 void THPLayout_init(PyObject* module);
26