MCPcopy Create free account
hub / github.com/alibaba/graph-learn / get_dag_value

Function get_dag_value

graphlearn/python/c/py_wrapper.h:639–669  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

637}
638
639PyObject* get_dag_value(GetDagValuesResponse* res,
640 int32_t node_id,
641 const std::string& key) {
642 auto t = res->GetValue(node_id, key);
643 if (t == nullptr) {
644 Py_RETURN_NONE;
645 }
646 int32_t size = t->Size();
647 npy_intp shape[1];
648 shape[0] = size;
649
650 PyObject* obj = nullptr;
651
652 switch (t->DType()) {
653 case kInt32:
654 obj = PyArrayFromIntVector(t->GetInt32(), shape);
655 break;
656 case kInt64:
657 obj = PyArrayFromInt64Vector(t->GetInt64(), shape);
658 break;
659 case kFloat:
660 obj = PyArrayFromFloatVector(t->GetFloat(), shape);
661 break;
662 case kString:
663 obj = PyArrayFromStringVector(t->GetString(), shape);
664 break;
665 default:
666 break;
667 }
668 return PyArray_Return(reinterpret_cast<PyArrayObject*>(obj));
669}
670
671#endif // GRAPHLEARN_PYTHON_C_PY_WRAPPER_H_

Callers 1

init_client_moduleFunction · 0.85

Calls 11

PyArrayFromIntVectorFunction · 0.85
PyArrayFromInt64VectorFunction · 0.85
PyArrayFromFloatVectorFunction · 0.85
PyArrayFromStringVectorFunction · 0.85
GetValueMethod · 0.80
SizeMethod · 0.45
DTypeMethod · 0.45
GetInt32Method · 0.45
GetInt64Method · 0.45
GetFloatMethod · 0.45
GetStringMethod · 0.45

Tested by

no test coverage detected