forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Generator.h
30 lines (21 loc) · 974 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
#pragma once
#include <torch/csrc/Export.h>
#include <torch/csrc/python_headers.h>
#include <ATen/core/Generator.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);