| 2303 | RAI_Tensor *tensor); |
| 2304 | |
| 2305 | static PyObject* _loadTensorToDAG(PyObject *self, PyObject *args, RAI_LoadTensorFunc loadTensor) { |
| 2306 | verifyRedisAILoaded(); |
| 2307 | PyDAGRunner *pyDag = (PyDAGRunner *)self; |
| 2308 | if(!_IsDagAPISupported(loadTensor) || !_IsValidDag(pyDag)) { |
| 2309 | return NULL; |
| 2310 | } |
| 2311 | if(PyTuple_Size(args) != 2) { |
| 2312 | PyErr_SetString(GearsError, "Wrong number of args to DAG load input"); |
| 2313 | return NULL; |
| 2314 | } |
| 2315 | PyObject* tensorName = PyTuple_GetItem(args, 0); |
| 2316 | if(!PyUnicode_Check(tensorName)) { |
| 2317 | PyErr_SetString(GearsError, "Tensor name argument must be a string"); |
| 2318 | return NULL; |
| 2319 | } |
| 2320 | const char* inputNameStr = PyUnicode_AsUTF8AndSize(tensorName, NULL); |
| 2321 | PyTensor* pyt = (PyTensor*) PyTuple_GetItem(args, 1); |
| 2322 | if(!PyObject_IsInstance((PyObject*) pyt, (PyObject * ) & PyTensorType)) { |
| 2323 | PyErr_SetString(GearsError, |
| 2324 | "Given argument is not of type PyTensorType"); |
| 2325 | return NULL; |
| 2326 | } |
| 2327 | loadTensor(pyDag->dag, inputNameStr, pyt->t); |
| 2328 | Py_INCREF(self); |
| 2329 | return self; |
| 2330 | } |
| 2331 | |
| 2332 | |
| 2333 | static PyObject* DAGAddInput(PyObject *self, PyObject *args) { |
no test coverage detected