mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
Summary: As GoogleTest `TEST` macro is non-compliant with it as well as `DEFINE_DISPATCH` All changes but the ones to `.clang-tidy` are generated using following script: ``` for i in `find . -type f -iname "*.c*" -or -iname "*.h"|xargs grep cppcoreguidelines-avoid-non-const-global-variables|cut -f1 -d:|sort|uniq`; do sed -i "/\/\/ NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)/d" $i; done ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/62008 Reviewed By: driazati, r-barnes Differential Revision: D29838584 Pulled By: malfet fbshipit-source-id: 1b2f8602c945bd4ce50a9bfdd204755556e31d13
31 lines
934 B
C
31 lines
934 B
C
#pragma once
|
|
|
|
#include <torch/csrc/python_headers.h>
|
|
#include <ATen/ATen.h>
|
|
|
|
#include <torch/csrc/THP_export.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.
|
|
THP_API PyObject * THPGenerator_initDefaultGenerator(at::Generator cdata);
|
|
|
|
#define THPGenerator_Check(obj) \
|
|
PyObject_IsInstance(obj, THPGeneratorClass)
|
|
|
|
THP_API PyObject *THPGeneratorClass;
|
|
|
|
bool THPGenerator_init(PyObject *module);
|
|
|
|
THP_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);
|