1#pragma once
2
3// Provides conversions between Python tensor objects and at::Tensor.
4
5#include <torch/csrc/python_headers.h>
6
7#include <ATen/Device.h>
8#include <c10/core/Backend.h>
9#include <c10/core/Layout.h>
10#include <c10/core/ScalarType.h>
11#include <c10/core/ScalarTypeToTypeMeta.h>
12#include <torch/csrc/Export.h>
13
14#include <memory>
15#include <string>
16
17struct THPDtype;
18struct THPLayout;
19
20namespace c10 {
21struct Storage;
22}
23
24namespace torch {
25void registerDtypeObject(THPDtype* dtype, at::ScalarType scalarType);
26void registerLayoutObject(THPLayout* thp_layout, at::Layout layout);
27
28TORCH_PYTHON_API PyObject* createPyObject(const at::Storage& storage);
29at::Storage createStorage(PyObject* obj);
30at::Storage createStorageGetType(
31 PyObject* obj,
32 at::ScalarType& scalar_type,
33 bool& is_typed_storage);
34bool isStorage(PyObject* obj);
35
36THPDtype* getTHPDtype(at::ScalarType scalarType);
37THPLayout* getTHPLayout(at::Layout layout);
38} // namespace torch
39