pytorch/torch/csrc/Generator.h
Pavel Belevich 358ba59f01 Add THP_API to THPGenerator_Wrap (#35194)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/35194

Fixes:
```
error LNK2001: unresolved external symbol "struct _object * __cdecl THPGenerator_Wrap(struct at::Generator)" (?THPGenerator_Wrap@YAPEAU_object@UGenerator@at@@Z)
build\lib.win-amd64-3.6\torch_test_cpp_extension\rng.cp36-win_amd64.pyd : fatal error LNK1120: 1 unresolved externals
```

I forgot it, my fault

Test Plan: Imported from OSS

Differential Revision: D20591604

Pulled By: pbelevich

fbshipit-source-id: e8986948fb50aec50db99a72ad112702cbbe831f
2020-03-23 05:58:09 -07:00

30 lines
876 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;
};
// 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);