| 126 | } |
| 127 | |
| 128 | void ParseArrayToTensor(PyObject* object, |
| 129 | const std::shared_ptr<vm::EagerBlobObject>& eager_blob_object) { |
| 130 | const DataType dtype = eager_blob_object->data_type(); |
| 131 | const int ndims = eager_blob_object->shape().NumAxes(); |
| 132 | DimVector strides(ndims); |
| 133 | int64_t size = 1; |
| 134 | for (int i = ndims - 1; i >= 0; --i) { |
| 135 | strides[i] = size; |
| 136 | size *= eager_blob_object->shape().At(i); |
| 137 | } |
| 138 | RecursiveParseAndAssign(object, eager_blob_object->mut_dptr<char>(), ndims, 0, |
| 139 | eager_blob_object->shape(), strides, dtype); |
| 140 | } |
| 141 | |
| 142 | Shape InferArraySizes(PyObject* object) { |
| 143 | DimVector sizes; |
no test coverage detected