MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / PyTensorIndexCheck

Function PyTensorIndexCheck

oneflow/api/python/functional/common.cpp:309–313  ·  view source on GitHub ↗

Tensor index

Source from the content-addressed store, hash-verified

307
308// Tensor index
309bool PyTensorIndexCheck(PyObject* obj) {
310 return PySlice_Check(obj) || PyLong_Check(obj) || obj == Py_Ellipsis || obj == Py_None
311 || PyTensor_Check(obj) || PySequence_Check(obj) || PyUnicode_Check(obj)
312 || numpy::PyArrayCheckLongScalar(obj);
313}
314TensorIndex PyUnpackTensorIndex(PyObject* obj) {
315 TensorIndex tensor_index;
316 // Obvious single-entry cases.

Callers 2

PyTensorObject_setitemFunction · 0.85
TypeCheckMethod · 0.85

Calls 2

PyTensor_CheckFunction · 0.85
PyArrayCheckLongScalarFunction · 0.85

Tested by

no test coverage detected