| 1006 | } |
| 1007 | |
| 1008 | tensorflow::Status Initialize() { |
| 1009 | num_elements_ = PyObject_GetAttrString(py_vspace_, "num_elements_fn"); |
| 1010 | if (num_elements_ == nullptr) { |
| 1011 | return tensorflow::errors::InvalidArgument("invalid vspace"); |
| 1012 | } |
| 1013 | aggregate_fn_ = PyObject_GetAttrString(py_vspace_, "aggregate_fn"); |
| 1014 | if (aggregate_fn_ == nullptr) { |
| 1015 | return tensorflow::errors::InvalidArgument("invalid vspace"); |
| 1016 | } |
| 1017 | zeros_fn_ = PyObject_GetAttrString(py_vspace_, "zeros_fn"); |
| 1018 | if (zeros_fn_ == nullptr) { |
| 1019 | return tensorflow::errors::InvalidArgument("invalid vspace"); |
| 1020 | } |
| 1021 | ones_fn_ = PyObject_GetAttrString(py_vspace_, "ones_fn"); |
| 1022 | if (ones_fn_ == nullptr) { |
| 1023 | return tensorflow::errors::InvalidArgument("invalid vspace"); |
| 1024 | } |
| 1025 | graph_shape_fn_ = PyObject_GetAttrString(py_vspace_, "graph_shape_fn"); |
| 1026 | if (graph_shape_fn_ == nullptr) { |
| 1027 | return tensorflow::errors::InvalidArgument("invalid vspace"); |
| 1028 | } |
| 1029 | return tensorflow::Status::OK(); |
| 1030 | } |
| 1031 | |
| 1032 | ~PyVSpace() override { |
| 1033 | Py_XDECREF(num_elements_); |
no test coverage detected