Home
last modified time | relevance | path

Searched refs:block_shape (Results 1 – 25 of 29) sorted by relevance

12

/third_party/mindspore/mindspore/ccsrc/backend/optimizer/ascend/mindir/
Dspace_batch_nd_attr_update.cc46 auto block_shape = AnfAlgo::GetNodeAttr<std::vector<int64_t>>(node, kAttrBlockShape); in Process() local
47 if (block_shape.size() == kBlockShapeDimNum) { in Process()
48 block_shape.insert(block_shape.begin(), 1); in Process()
49 AnfAlgo::SetNodeAttr(kAttrBlockShape, MakeValue(block_shape), node); in Process()
70 auto block_shape = AnfAlgo::GetNodeAttr<std::vector<int64_t>>(node, kAttrBlockShape); in Process() local
71 if (block_shape.size() == kBlockShapeDimNum) { in Process()
72 block_shape.insert(block_shape.begin(), 1); in Process()
73 AnfAlgo::SetNodeAttr(kAttrBlockShape, MakeValue(block_shape), node); in Process()
/third_party/mindspore/mindspore/core/ops/
Dspace_to_batch_nd.cc38 auto block_shape = GetValue<std::vector<int64_t>>(primitive->GetAttr(kBlockShape)); in InferShape() local
40 size_t size = block_shape.size(); in InferShape()
43 if (padded % block_shape[i] != 0) { in InferShape()
45 << i << "]" << block_shape[i]; in InferShape()
47 out_shape[i + offset] = int64_t(floor(padded / static_cast<float>(block_shape[i]))); in InferShape()
48 block_shape_prod = block_shape_prod * block_shape[i]; in InferShape()
82 void SpaceToBatchND::set_block_shape(std::vector<int64_t> block_shape) { in set_block_shape() argument
84 …(void)CheckAndConvertUtils::CheckInteger(kBlockShape, SizeToLong(block_shape.size()), kEqual, bloc… in set_block_shape()
86 for (size_t i = 0; i < block_shape.size(); i++) { in set_block_shape()
87 …(void)CheckAndConvertUtils::CheckInteger(kBlockShape, block_shape[i], kGreaterEqual, 1LL, this->na… in set_block_shape()
[all …]
Dbatch_to_space_nd.cc38 auto block_shape = GetValue<std::vector<int64_t>>(primitive->GetAttr(kBlockShape)); in InferShape() local
40 size_t size = block_shape.size(); in InferShape()
42 block_shape_prod = block_shape_prod * block_shape[i]; in InferShape()
43 auto x_block_prod = out_shape[i + offset] * block_shape[i]; in InferShape()
84 void BatchToSpaceND::set_block_shape(std::vector<int64_t> block_shape) { in set_block_shape() argument
86 …(void)CheckAndConvertUtils::CheckInteger(kBlockShape, SizeToLong(block_shape.size()), kEqual, bloc… in set_block_shape()
88 for (size_t i = 0; i < block_shape.size(); i++) { in set_block_shape()
89 …(void)CheckAndConvertUtils::CheckInteger(kBlockShape, block_shape[i], kGreaterEqual, 1, this->name… in set_block_shape()
91 (void)this->AddAttr(kBlockShape, MakeValue(block_shape)); in set_block_shape()
99 void BatchToSpaceND::Init(const std::vector<int64_t> block_shape, const std::vector<std::vector<int… in Init() argument
[all …]
Dspace_to_batch_nd.h41 …void Init(const std::vector<int64_t> block_shape, const std::vector<std::vector<int64_t>> paddings…
45 void set_block_shape(std::vector<int64_t> block_shape);
Dbatch_to_space_nd.h41 void Init(const std::vector<int64_t> block_shape, const std::vector<std::vector<int64_t>> crops);
45 void set_block_shape(std::vector<int64_t> block_shape);
/third_party/mindspore/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/
Dbatch_to_space_infer.c30 const int32_t *block_shape = param->block_shape_; in SetOutputShapeFromParam() local
35 if (block_shape[i] <= 0) { in SetOutputShapeFromParam()
38 if (input_shape[kNHWC_N] % block_shape[i]) { in SetOutputShapeFromParam()
41 mul_block_shape *= block_shape[i]; in SetOutputShapeFromParam()
58 output_shape[kNHWC_H] = input_shape[kNHWC_H] * block_shape[0] - crops[0] - crops[1]; in SetOutputShapeFromParam()
59 output_shape[kNHWC_W] = input_shape[kNHWC_W] * block_shape[1] - crops[2] - crops[3]; in SetOutputShapeFromParam()
72 int *block_shape = (int *)(inputs[1]->data_); in SetOutputShapeFromInput() local
83 if (block_shape[i] <= 0) { in SetOutputShapeFromInput()
86 if (input_shape[kNHWC_N] % block_shape[i]) { in SetOutputShapeFromInput()
89 mul_block_shape_ *= block_shape[i]; in SetOutputShapeFromInput()
[all …]
Dspace_to_batch_nd_infer.c31 const int *block_shape = param->block_sizes_; in SpaceSetOutputShapeFromParam() local
40 block_w = block_shape[1]; in SpaceSetOutputShapeFromParam()
42 if (input->shape_[kNHWC_N] == 0 || block_shape[0] * block_w > INT_MAX / input->shape_[kNHWC_N]) { in SpaceSetOutputShapeFromParam()
45 outputs[0]->shape_[kNHWC_N] = input->shape_[kNHWC_N] * block_shape[0] * block_w; in SpaceSetOutputShapeFromParam()
49 if (block_shape[0] == 0 || block_w == 0) { in SpaceSetOutputShapeFromParam()
52 outputs[0]->shape_[kNHWC_H] = (input->shape_[kNHWC_H] + padding[0] + padding[1]) / block_shape[0]; in SpaceSetOutputShapeFromParam()
73 int *block_shape = (int *)(inputs[1]->data_); in SpaceSetOutputShapeFromInput() local
81 block_w = block_shape[1]; in SpaceSetOutputShapeFromInput()
85 if (input->shape_[kNHWC_N] == 0 || block_shape[0] * block_w > INT_MAX / input->shape_[kNHWC_N]) { in SpaceSetOutputShapeFromInput()
88 output_shape[kNHWC_N] = input->shape_[kNHWC_N] * block_shape[0] * block_w; in SpaceSetOutputShapeFromInput()
[all …]
Dspace_to_batch_infer.c40 int *block_shape = param->block_sizes_; in SpaceToBatchInferShape() local
49 block_w = block_shape[1]; in SpaceToBatchInferShape()
52 NNACL_CHECK_ZERO_RETURN_ERR(block_shape[0]); in SpaceToBatchInferShape()
54 MS_CHECK_INT_MUL_NOT_OVERFLOW(block_shape[0], block_w, NNACL_ERR); in SpaceToBatchInferShape()
55 MS_CHECK_INT_MUL_NOT_OVERFLOW(input->shape_[kNHWC_N], block_shape[0] * block_w, NNACL_ERR); in SpaceToBatchInferShape()
56 outputs[0]->shape_[kNHWC_N] = input->shape_[kNHWC_N] * (block_shape[0] * block_w); in SpaceToBatchInferShape()
57 …outputs[0]->shape_[kNHWC_H] = (input->shape_[kNHWC_H] + paddings[0] + paddings[1]) / block_shape[0… in SpaceToBatchInferShape()
/third_party/mindspore/mindspore/lite/test/ut/src/runtime/kernel/opencl/
Dbatch_to_space_nd_tests.cc26 OpParameter *CreateParameter(int block_shape[], int crops[], const std::vector<int> &input_shape, in CreateParameter() argument
29 memcpy(param->block_shape_, block_shape, sizeof(param->block_shape_)); in CreateParameter()
40 int block_shape[] = {2, 2}; in TEST_F() local
77 auto *param = CreateParameter(block_shape, crops, input_shape, &output_shape); in TEST_F()
84 int block_shape[] = {3, 3}; in TEST_F() local
118 auto *param = CreateParameter(block_shape, crops, input_shape, &output_shape); in TEST_F()
/third_party/mindspore/mindspore/lite/src/ops/populate/
Dspace_to_batch_nd_populate.cc39 auto block_shape = value->block_shape(); in PopulateSpaceToBatchNDParameter() local
40 if (block_shape == nullptr) { in PopulateSpaceToBatchNDParameter()
43 auto block_shapes = std::vector<int64_t>(block_shape->begin(), block_shape->end()); in PopulateSpaceToBatchNDParameter()
Dbatch_to_space_populate.cc41 auto block_shape = std::vector<int64_t>(block_size->begin(), block_size->end()); in PopulateBatchToSpaceParameter() local
42 if (block_shape.size() != BATCH_TO_SPACE_BLOCK_SHAPE_SIZE) { in PopulateBatchToSpaceParameter()
78 param->block_shape_[i] = static_cast<int>(block_shape[i]); in PopulateBatchToSpaceParameter()
/third_party/mindspore/mindspore/lite/src/ops/populate/v0/
Dbatch_to_space_populate_v0.cc31 auto block_shape = attr->blockShape(); in PopulateBatchToSpaceParameter() local
32 MS_CHECK_TRUE_RET(block_shape != nullptr, nullptr); in PopulateBatchToSpaceParameter()
33 if (block_shape->size() != BATCH_TO_SPACE_BLOCK_SHAPE_SIZE) { in PopulateBatchToSpaceParameter()
58 batch_space_param->block_shape_[i] = *(block_shape->begin() + i); in PopulateBatchToSpaceParameter()
/third_party/mindspore/mindspore/lite/src/runtime/kernel/arm/fp32/
Dspace_to_batch_fp32.cc38 auto block_shape = static_cast<int *>(block_shape_data); in ProcessInput() local
39 MS_ASSERT(block_shape != nullptr); in ProcessInput()
41 param_->block_sizes_[i] = block_shape[i]; in ProcessInput()
Dbatch_to_space_fp32.cc35 auto block_shape = static_cast<int *>(block_shape_data); in Processinput() local
40 block_shape_[i] = block_shape[i]; in Processinput()
/third_party/mindspore/tests/st/networks/models/deeplabv3/src/backbone/
Dresnet_deeplab.py186 def __init__(self, block_shape, paddings): argument
188 self.space_to_batch = P.SpaceToBatch(block_shape, paddings)
189 self.bs = block_shape
197 def __init__(self, block_shape, crops): argument
199 self.batch_to_space = P.BatchToSpace(block_shape, crops)
200 self.bs = block_shape
/third_party/mindspore/mindspore/ops/operations/
Darray_ops.py5173 def __init__(self, block_shape, paddings): argument
5175 if isinstance(block_shape, int):
5176 block_shape = (block_shape,) * 2
5177 self.add_prim_attr("block_shape", block_shape)
5178 validator.check_value_type('block_shape type', block_shape, [list, tuple], self.name)
5179 … validator.check('block_shape shape', len(np.array(block_shape).shape), '', 1, Rel.EQ, self.name)
5180 block_rank = len(block_shape)
5182 for elem in block_shape:
5185 self.block_shape = block_shape
5206 for i in range(len(self.block_shape)):
[all …]
/third_party/mindspore/mindspore/ccsrc/transform/graph_ir/op_declare/
Dtransformation_ops_declare.cc73 {"block_shape", ATTR_DESC(block_shape, AnyTraits<std::vector<int64_t>>())},
89 {"block_shape", ATTR_DESC(block_shape, AnyTraits<std::vector<int64_t>>())},
/third_party/mindspore/tests/ut/python/ops/
Dtest_array_ops.py299 block_shape = [2, 2]
301 self.batch_to_space_nd = P.BatchToSpaceND(block_shape, crops)
310 block_shape = [2, 2]
312 self.space_to_batch_nd = P.SpaceToBatchND(block_shape, paddings)
/third_party/mindspore/mindspore/lite/test/ut/tools/converter/parser/tflite/
Dtflite_space_to_batch_nd_parser_test.cc39 ASSERT_EQ(val->block_shape, blockshape); in TEST_F()
/third_party/mindspore/mindspore/lite/mindir/include/
Dmindir.h93 PrimitivePtr MindIR_BatchToSpaceND_CreatePrimitive(const std::vector<int64_t> &block_shape,
96 …dIR_BatchToSpaceND_SetBlockShape(PrimitivePtr *primitive, const std::vector<int64_t> &block_shape);
350 PrimitivePtr MindIR_SpaceToBatchND_CreatePrimitive(const std::vector<int64_t> &block_shape,
353 …dIR_SpaceToBatchND_SetBlockShape(PrimitivePtr *primitive, const std::vector<int64_t> &block_shape);
/third_party/mindspore/mindspore/lite/mindir/src/
Dmindir_nnrt_lite_graph_to_model.cc297 if (value->block_shape() == nullptr || value->block_shape()->size() < kNumTwo) { in ConvertBatchToSpaceND()
300 … blockShape = std::vector<int64_t>(value->block_shape()->begin(), value->block_shape()->end()); in ConvertBatchToSpaceND()
1071 if (value->block_shape() == nullptr || value->block_shape()->size() < kNumTwo) { in ConvertSpaceToBatchND()
1074 … blockShape = std::vector<int64_t>(value->block_shape()->begin(), value->block_shape()->end()); in ConvertSpaceToBatchND()
Dmindir.cc696 PrimitivePtr MindIR_BatchToSpaceND_CreatePrimitive(const std::vector<int64_t> &block_shape, in MindIR_BatchToSpaceND_CreatePrimitive() argument
699 …_offset = schema::CreateBatchToSpaceND(fbb, fbb.CreateVector(block_shape.data(), block_shape.size(… in MindIR_BatchToSpaceND_CreatePrimitive()
714 auto src = value->block_shape(); in MindIR_BatchToSpaceND_GetBlockShape()
726 …IR_BatchToSpaceND_SetBlockShape(PrimitivePtr *primitive, const std::vector<int64_t> &block_shape) { in MindIR_BatchToSpaceND_SetBlockShape() argument
732 …_offset = schema::CreateBatchToSpaceND(fbb, fbb.CreateVector(block_shape.data(), block_shape.size(… in MindIR_BatchToSpaceND_SetBlockShape()
773 …fbb, fbb.CreateVector(value->block_shape()->data(), value->block_shape()->size()), CreateVec2D(fbb… in MindIR_BatchToSpaceND_SetCrops()
3562 PrimitivePtr MindIR_SpaceToBatchND_CreatePrimitive(const std::vector<int64_t> &block_shape, in MindIR_SpaceToBatchND_CreatePrimitive() argument
3565 …_offset = schema::CreateSpaceToBatchND(fbb, fbb.CreateVector(block_shape.data(), block_shape.size(… in MindIR_SpaceToBatchND_CreatePrimitive()
3580 auto src = value->block_shape(); in MindIR_SpaceToBatchND_GetBlockShape()
3592 …IR_SpaceToBatchND_SetBlockShape(PrimitivePtr *primitive, const std::vector<int64_t> &block_shape) { in MindIR_SpaceToBatchND_SetBlockShape() argument
[all …]
/third_party/mindspore/mindspore/lite/schema/
Dops.fbs341 block_shape: [long];
929 block_shape: [long];
/third_party/mindspore/mindspore/lite/src/ops/
Dops_def.cc341 OP_ATTR(block_shape, [long])
929 OP_ATTR(block_shape, [long])
/third_party/mindspore/mindspore/ops/_grad/
Dgrad_array_ops.py1005 space_to_batch_nd_grad = P.BatchToSpaceND(self.block_shape, self.paddings)
1017 batch_to_space_nd_grad = P.SpaceToBatchND(self.block_shape, self.crops)

12