| 178 | } |
| 179 | |
| 180 | PyObject* get_node_weights(LookupNodesResponse* res) { |
| 181 | npy_intp shape[1]; |
| 182 | shape[0] = res->Size(); |
| 183 | PyArray_Descr* descr = PyArray_DescrFromType(NPY_FLOAT32); |
| 184 | PyObject* obj = PyArray_Zeros(1, shape, descr, 0); |
| 185 | PyArrayObject* np_array = reinterpret_cast<PyArrayObject*>(obj); |
| 186 | memcpy(PyArray_DATA(np_array), res->Weights(), |
| 187 | res->Size() * FLOAT32_BYTES); |
| 188 | return obj; |
| 189 | } |
| 190 | |
| 191 | PyObject* get_node_labels(LookupNodesResponse* res) { |
| 192 | npy_intp shape[1]; |
no test coverage detected