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

Function MLUOP_WIN_API mluOpCreateTensorSetDescriptor

core/tensor.cpp:867–893  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

865}
866
867mluOpStatus_t MLUOP_WIN_API mluOpCreateTensorSetDescriptor(
868 mluOpTensorSetDescriptor_t *tensorSet, const int tensorSetDimNb,
869 const int *tensorSetDimSize) {
870 mluOpTensorSetStruct *tss = new (std::nothrow) mluOpTensorSetStruct();
871 tss->dim_num = tensorSetDimNb;
872 int set_size = 1;
873 for (int i = 0; i < tensorSetDimNb; i++) {
874 set_size *= tensorSetDimSize[i];
875 tss->dim_set.push_back(tensorSetDimSize[i]);
876 int j = i + 1;
877 int offset_base = 1;
878 while (j < tensorSetDimNb) {
879 offset_base *= tensorSetDimSize[j];
880 j++;
881 }
882 tss->dim_offset_base.push_back(offset_base);
883 }
884 for (int i = 0; i < set_size; i++) {
885 auto ts = std::make_shared<mluOpTensorStruct>();
886 tss->tensor_set.push_back(ts);
887 }
888 tss->tensor_num = set_size;
889 tss->dataOffsetInit(set_size);
890 tss->user_indices.resize(set_size);
891 *tensorSet = tss;
892 return MLUOP_STATUS_SUCCESS;
893}
894
895mluOpStatus_t MLUOP_WIN_API mluOpGetTensorSetDescriptor(
896 mluOpTensorSetDescriptor_t tensorSet, int *tensorSetDimNb, int *dimSize) {

Callers

nothing calls this directly

Calls 2

dataOffsetInitMethod · 0.80
resizeMethod · 0.80

Tested by

no test coverage detected