MCPcopy Create free account
hub / github.com/Cambricon/mlu-ops / resetTensorDescriptor

Method resetTensorDescriptor

core/tensor.cpp:376–400  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

374}
375
376mluOpStatus_t mluOpTensorStruct::resetTensorDescriptor() {
377 if MLUOP_PREDICT_FALSE (this->dims != this->normal_dims) {
378 delete[] this->dims;
379 this->dims = this->normal_dims;
380 }
381 if MLUOP_PREDICT_FALSE (this->strides != this->normal_strides) {
382 delete[] this->strides;
383 this->strides = this->normal_strides;
384 }
385
386 this->dim = 0;
387 this->dtype = MLUOP_DTYPE_FLOAT;
388 this->onchip_dtype = MLUOP_DTYPE_INVALID;
389 this->layout = MLUOP_LAYOUT_ARRAY;
390 this->pointer_mode = MLUOP_POINTER_MODE_DEVICE;
391
392 this->total_element_num = 0;
393 this->total_tensor_size = 0;
394
395 this->position = 0;
396 this->scale = 1.0f;
397 this->offset = 0;
398
399 return MLUOP_STATUS_SUCCESS;
400}
401
402mluOpStatus_t mluOpTensorStruct::setTensorDescriptorEx(
403 mluOpTensorLayout_t layout, mluOpDataType_t dtype, int dimNb,

Calls

no outgoing calls

Tested by

no test coverage detected