pytorch/torch/csrc/Generator.h
Syed Tousif Ahmed ae342fd076 Refactor Random Number Generators in ATen (#21364)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/21364
ghimport-source-id: ca7d37e10190ba46dc8512f437404ca9216d3369

Differential Revision: D15696497

Pulled By: ezyang

fbshipit-source-id: 2e713b8566ae915e175b5a79ac1dd9b86cc2a23d
2019-06-12 13:01:30 -07:00

27 lines
702 B
C

#pragma once
#include <torch/csrc/python_headers.h>
#include <ATen/ATen.h>
#include <torch/csrc/THP_export.h>
struct THPGenerator {
PyObject_HEAD
at::Generator *cdata;
bool owner; // if true, frees cdata in destructor
};
// Creates a new Python object wrapping the default 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_initDefaultGenerator(at::Generator* cdata);
#define THPGenerator_Check(obj) \
PyObject_IsInstance(obj, THPGeneratorClass)
THP_API PyObject *THPGeneratorClass;
#ifdef _THP_CORE
bool THPGenerator_init(PyObject *module);
#endif