pytorch/torch/csrc/Generator.h
Peter Bell cd9da3267c Rationalize API exports in torch_python (#68095)
Summary:
This renames `WindowsTorchApiMacro.h` to `Export.h` to mirror the c10 header `c10/macros/Export.h` and also updates it to use `C10_EXPORT`/`C10_IMPORT`. This also removes the `THP_API` macro from `THP_export.h` which appears to serve the same purpose.

cc pietern mrshenli pritamdamania87 zhaojuanmao satgera rohan-varma gqchen aazzolini osalpekar jiayisuse SciPioneer H-Huang

Pull Request resolved: https://github.com/pytorch/pytorch/pull/68095

Reviewed By: jbschlosser

Differential Revision: D32810881

Pulled By: albanD

fbshipit-source-id: d6949ccd0d80d6c3e5ec1264207611fcfe2503e3
2021-12-07 15:24:37 -08:00

30 lines
964 B
C

#pragma once
#include <torch/csrc/Export.h>
#include <torch/csrc/python_headers.h>
#include <ATen/ATen.h>
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init)
struct THPGenerator {
PyObject_HEAD
at::Generator cdata;
};
// Creates a new Python object wrapping the default at::Generator. The reference is
// borrowed. The caller should ensure that the at::Generator object lifetime
// last at least as long as the Python wrapper.
TORCH_PYTHON_API PyObject * THPGenerator_initDefaultGenerator(at::Generator cdata);
#define THPGenerator_Check(obj) \
PyObject_IsInstance(obj, THPGeneratorClass)
TORCH_PYTHON_API extern PyObject *THPGeneratorClass;
bool THPGenerator_init(PyObject *module);
TORCH_PYTHON_API PyObject * THPGenerator_Wrap(at::Generator gen);
// Creates a new Python object for a Generator. The Generator must not already
// have a PyObject* associated with it.
PyObject* THPGenerator_NewWithVar(PyTypeObject* type, at::Generator gen);