forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Generator.h
31 lines (22 loc) · 816 Bytes
/
Generator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#pragma once
#include "torch/csrc/python_headers.h"
#include <ATen/ATen.h>
#include "THP_export.h"
struct THPGenerator {
PyObject_HEAD
at::Generator *cdata;
bool owner; // if true, frees cdata in destructor
};
#define THPGenerator_Check(obj) \
PyObject_IsInstance(obj, THPGeneratorClass)
#define THPGenerator_TH_CData(obj) \
(THGenerator*)((THPGenerator*)obj)->cdata->unsafeGetTH()
THP_API PyObject * THPGenerator_New();
// Creates a new Python object wrapping the at::Generator. The reference is
// borrowed. The caller should ensure that the THGenerator* object lifetime
// last at least as long as the Python wrapper.
THP_API PyObject * THPGenerator_NewWithGenerator(at::Generator& cdata);
THP_API PyObject *THPGeneratorClass;
#ifdef _THP_CORE
bool THPGenerator_init(PyObject *module);
#endif