MCPcopy Create free account
hub / github.com/RedisGears/RedisGears / _loadTensorToDAG

Function _loadTensorToDAG

plugins/python/redisgears_python.c:2305–2330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2303 RAI_Tensor *tensor);
2304
2305static 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
2333static PyObject* DAGAddInput(PyObject *self, PyObject *args) {

Callers 2

DAGAddInputFunction · 0.85
DAGAddTensorSetFunction · 0.85

Calls 2

_IsDagAPISupportedFunction · 0.85
_IsValidDagFunction · 0.85

Tested by

no test coverage detected