/third_party/mindspore/mindspore/ |
D | _checkparam.py | 99 def _check_3d_int_or_tuple(arg_name, arg_value, prim_name, allow_five=False, ret_five=False, argument 127 Validator.check_value_type(arg_name, arg_value, (int, tuple), prim_name) 147 def check_number(arg_value, value, rel, arg_type=int, arg_name=None, prim_name=None): argument 155 prim_name = f'in `{prim_name}`' if prim_name else '' 174 def check_is_number(arg_value, arg_type, arg_name=None, prim_name=None): argument 183 prim_name = f"For \'{prim_name}\', the" if prim_name else 'The' 192 …_number_range(arg_value, lower_limit, upper_limit, rel, value_type, arg_name=None, prim_name=None): argument 201 prim_name = f'in `{prim_name}`' if prim_name else '' 206 arg_name, prim_name, value_type.__name__, type(arg_value).__name__)) 210 arg_name, prim_name, rel_str, arg_value, type(arg_value).__name__)) [all …]
|
/third_party/mindspore/mindspore/core/ops/grad/ |
D | relu_grad.cc | 32 auto prim_name = primitive->name(); in InferShape() local 34 …rtUtils::CheckInteger("input number", SizeToLong(input_args.size()), kEqual, input_num, prim_name); in InferShape() 38 auto dout = CheckAndConvertUtils::CheckArgs<abstract::AbstractTensor>(prim_name, input_args, 0); in InferShape() 39 auto out = CheckAndConvertUtils::CheckArgs<abstract::AbstractTensor>(prim_name, input_args, 1); in InferShape() 40 (void)abstract::CheckShapeSame(prim_name, out, dout); in InferShape() 50 auto prim_name = prim->name(); in InferType() local 52 …rtUtils::CheckInteger("input number", SizeToLong(input_args.size()), kEqual, input_num, prim_name); in InferType() 54 auto dout = CheckAndConvertUtils::CheckArgs<abstract::AbstractTensor>(prim_name, input_args, 0); in InferType() 55 auto out = CheckAndConvertUtils::CheckArgs<abstract::AbstractTensor>(prim_name, input_args, 1); in InferType() 56 (void)abstract::CheckDtypeSame(prim_name, out, dout); in InferType() [all …]
|
D | conv2d_backprop_filter.cc | 34 auto prim_name = primitive->name(); in TransStrideTo4D() local 35 auto x_shape = CheckAndConvertUtils::GetTensorInputShape(prim_name, input_args, kInputIndex); in TransStrideTo4D() 36 auto dout_shape = CheckAndConvertUtils::GetTensorInputShape(prim_name, input_args, kDoutIndex); in TransStrideTo4D() 55 auto prim_name = primitive->name(); in Conv2DBackpropFilterInferShape() local 65 … out_shape = CheckAndConvertUtils::CheckTensorIntValue("filter size", filter_size_v, prim_name); in Conv2DBackpropFilterInferShape() 68 …auto shape_ptr = CheckAndConvertUtils::GetTensorInputShape(prim_name, input_args, kFilterSizeIdex); in Conv2DBackpropFilterInferShape() 72 MS_LOG(EXCEPTION) << "The " << prim_name << "'s filter size must be 1-D."; in Conv2DBackpropFilterInferShape() 88 MS_LOG(EXCEPTION) << "For " << prim_name << ", filter size's min or max value is valid."; in Conv2DBackpropFilterInferShape() 102 … out_shape = CheckAndConvertUtils::CheckAttrIntOrTupleInt("filter_size", filter_size_v, prim_name); in Conv2DBackpropFilterInferShape() 113 auto prim_name = prim->name(); in Conv2DBackpropFilterInferType() local [all …]
|
D | conv2d_backprop_input.cc | 35 auto prim_name = primitive->name(); in SetPadList() local 38 …AndConvertUtils::CheckAttrIntOrTupleInt("kernel_size", primitive->GetAttr(kKernelSize), prim_name); in SetPadList() 39 …e = CheckAndConvertUtils::CheckAttrIntOrTupleInt("stride", primitive->GetAttr(kStride), prim_name); in SetPadList() 40 …CheckAndConvertUtils::CheckAttrIntOrTupleInt("dilation", primitive->GetAttr(kDilation), prim_name); in SetPadList() 85 auto prim_name = primitive->name(); in Conv2DBackpropInputInferShape() local 94 … out_shape = CheckAndConvertUtils::CheckTensorIntValue("input x size", input_size_v, prim_name); in Conv2DBackpropInputInferShape() 97 auto shape_ptr = CheckAndConvertUtils::GetTensorInputShape(prim_name, input_args, kSizeIndex); in Conv2DBackpropInputInferShape() 101 MS_LOG(EXCEPTION) << "The " << prim_name << "'s x size must be 1-D."; in Conv2DBackpropInputInferShape() 117 MS_LOG(EXCEPTION) << "For " << prim_name << ", x size's min or max value is valid."; in Conv2DBackpropInputInferShape() 131 … out_shape = CheckAndConvertUtils::CheckAttrIntOrTupleInt("input x size", input_size_v, prim_name); in Conv2DBackpropInputInferShape() [all …]
|
/third_party/mindspore/mindspore/ops/composite/ |
D | math_ops.py | 122 def _check_axes(axes, prim_name=None): argument 126 msg_prefix = f"For '{prim_name}', the" if prim_name else "The" 142 def _typecheck_input(x1_type, x2_type, prim_name=None): argument 146 msg_prefix = f"For '{prim_name}', the" if prim_name else "The" 155 def _axes_int_check(x1_shape, x2_shape, axes, prim_name=None): argument 159 msg_prefix = f"For '{prim_name}', the" if prim_name else "The" 177 def _validate_axes(x1_shape, x2_shape, axes, prim_name=None): argument 183 msg_prefix = f"For '{prim_name}', the" if prim_name else "The" 235 def tensor_dot(x1, x2, axes, prim_name='tensor_dot'): argument 287 axes = _check_axes(axes, prim_name) [all …]
|
/third_party/mindspore/mindspore/core/ops/ |
D | gather_d.cc | 30 auto prim_name = primitive->name(); in GatherDInferShape() local 35 …ertUtils::Check("x_rank", x_rank, kEqual, "index_rank", SizeToLong(index_shape.size()), prim_name); in GatherDInferShape() 39 …dConvertUtils::Check("dim value", dim_v, kGreaterEqual, "negative index_rank", -x_rank, prim_name); in GatherDInferShape() 40 CheckAndConvertUtils::Check("dim value", dim_v, kLessThan, "index_rank", x_rank, prim_name); in GatherDInferShape() 48 …heckAndConvertUtils::Check("x shape", x_shape[i], kEqual, "index_rank", index_shape[i], prim_name); in GatherDInferShape() 55 auto prim_name = prim->name(); in GatherDInferType() local 58 …eckAndConvertUtils::CheckTensorTypeValid("x", input_args[0]->BuildType(), valid_x_type, prim_name); in GatherDInferType() 65 auto prim_name = primitive->name(); in GatherDInfer() local 69 prim_name); in GatherDInfer() 70 …dConvertUtils::CheckSubClass("dim", input_args[kInputIndex1]->BuildType(), valid_types, prim_name); in GatherDInfer()
|
D | reverse_sequence.cc | 41 auto prim_name = primitive->name(); in ReverseSequenceInfer() local 44 prim_name); in ReverseSequenceInfer() 53 …vertUtils::CheckInteger("seq_dim", seq_dim, kLessEqual, SizeToLong(input_shape.size()), prim_name); in ReverseSequenceInfer() 55 prim_name); in ReverseSequenceInfer() 56 (void)CheckAndConvertUtils::CheckInteger("batch_dim", batch_dim, kNotEqual, seq_dim, prim_name); in ReverseSequenceInfer() 57 …nvertUtils::CheckInteger("seq_lengths rank", SizeToLong(seq_lengths.size()), kEqual, 1, prim_name); in ReverseSequenceInfer() 59 input_shape[LongToSize(batch_dim)], prim_name); in ReverseSequenceInfer() 66 …ered_type = CheckAndConvertUtils::CheckTensorTypeValid("x_type", x_type, valid_x_types, prim_name); in ReverseSequenceInfer() 67 …(void)CheckAndConvertUtils::CheckTensorTypeValid("seq_type", seq_type, valid_seq_types, prim_name); in ReverseSequenceInfer()
|
D | batch_to_space.cc | 50 auto prim_name = primitive->name(); in BatchToSpaceInfer() local 51 …AndConvertUtils::CheckInteger("input number", SizeToLong(input_args.size()), kEqual, 1, prim_name); in BatchToSpaceInfer() 56 prim_name); in BatchToSpaceInfer() 64 …heckAndConvertUtils::CheckInteger("x rank", SizeToLong(x_shape.size()), kEqual, x_rank, prim_name); in BatchToSpaceInfer() 66 prim_name); in BatchToSpaceInfer() 67 …ndConvertUtils::CheckInteger("crops size", SizeToLong(crops.size()), kEqual, attr_size, prim_name); in BatchToSpaceInfer() 68 …ertUtils::CheckInteger("crops[0] size", SizeToLong(crops[0].size()), kEqual, attr_size, prim_name); in BatchToSpaceInfer() 69 …ertUtils::CheckInteger("crops[1] size", SizeToLong(crops[1].size()), kEqual, attr_size, prim_name); in BatchToSpaceInfer() 73 …tUtils::Check("x block shape prod", x_block_prod, kGreaterThan, "crops sum", attr_size, prim_name); in BatchToSpaceInfer() 77 … out_shape[0] % (block_size[0] * block_size[1]), kEqual, 0, prim_name); in BatchToSpaceInfer()
|
D | adam.cc | 26 auto prim_name = primitive->name(); in AdamInfer() local 28 CheckAndConvertUtils::CheckInputArgs(input_args, kGreaterEqual, input_num, prim_name); in AdamInfer() 35 CheckAndConvertUtils::Check("var_shape", var_shape, kEqual, "m_shape", m_shape, prim_name); in AdamInfer() 36 CheckAndConvertUtils::Check("var_shape", var_shape, kEqual, "v_shape", v_shape, prim_name); in AdamInfer() 37 CheckAndConvertUtils::Check("var_shape", var_shape, kEqual, "grad_shape", grad_shape, prim_name); in AdamInfer() 44 … = CheckAndConvertUtils::CheckTensorTypeValid("var_type", var_type, common_valid_types, prim_name); in AdamInfer() 45 …type = CheckAndConvertUtils::CheckTensorTypeValid("m_type", m_type, common_valid_types, prim_name); in AdamInfer() 46 …type = CheckAndConvertUtils::CheckTensorTypeValid("v_type", v_type, common_valid_types, prim_name); in AdamInfer() 47 …)CheckAndConvertUtils::CheckTensorTypeValid("grad_type", grad_type, common_valid_types, prim_name); in AdamInfer()
|
D | bias_add.cc | 33 auto prim_name = primitive->name(); in InferShape() local 34 auto x = CheckAndConvertUtils::CheckArgs<abstract::AbstractTensor>(prim_name, input_args, 0); in InferShape() 35 auto bias = CheckAndConvertUtils::CheckArgs<abstract::AbstractTensor>(prim_name, input_args, 1); in InferShape() 39 …onvertUtils::CheckInteger("arg size", SizeToLong(input_args.size()), kEqual, input_num, prim_name); in InferShape() 47 prim_name); in InferShape() 49 …eckAndConvertUtils::CheckInteger("bias rank", SizeToLong(bias_shape.size()), kEqual, 1, prim_name); in InferShape() 51 …ertUtils::CheckInteger("x rank", SizeToLong(input_shape.size()), kGreaterEqual, x_size, prim_name); in InferShape() 78 auto prim_name = prim->name(); in InferType() local 81 prim_name); in InferType() 89 (void)CheckAndConvertUtils::CheckTensorTypeValid("x_dtype", x_type, valid_x_type, prim_name); in InferType() [all …]
|
D | dynamic_broadcast_gradient_args.cc | 30 int64_t CheckInputsAndGetShape(const AbstractBasePtr &input_arg, const string &prim_name) { in CheckInputsAndGetShape() argument 36 MS_EXCEPTION(TypeError) << prim_name << " input must be 1-D, but dims is " << input_size; in CheckInputsAndGetShape() 41 MS_LOG(EXCEPTION) << prim_name << " input shape is dynamic, but max shape is empty."; in CheckInputsAndGetShape() 51 MS_EXCEPTION(TypeError) << prim_name << " input must be a tuple or Tensor."; in CheckInputsAndGetShape() 57 auto prim_name = primitive->name(); in Infer() local 59 …rtUtils::CheckInteger("input number", SizeToLong(input_args.size()), kEqual, input_num, prim_name); in Infer() 60 auto x_shape0 = CheckInputsAndGetShape(input_args[0], prim_name); in Infer() 61 auto y_shape0 = CheckInputsAndGetShape(input_args[1], prim_name); in Infer()
|
D | sparse_apply_r_m_s_prop.cc | 31 auto prim_name = primitive->name(); in InferShape() local 56 CheckAndConvertUtils::Check(elem.first, elem.second, kEqual, "var shape", var_shape, prim_name); in InferShape() 61 prim_name); in InferShape() 64 prim_name); in InferShape() 67 prim_name); in InferShape() 74 auto prim_name = prim->name(); in InferType() local 75 …AndConvertUtils::CheckInteger("input number", SizeToLong(input_args.size()), kEqual, 6, prim_name); in InferType() 92 (void)CheckAndConvertUtils::CheckTensorTypeSame(args, valid_types, prim_name); in InferType() 96 (void)CheckAndConvertUtils::CheckScalarOrTensorTypesSame(args2, valid_types, prim_name); in InferType() 101 (void)CheckAndConvertUtils::CheckScalarOrTensorTypesSame(args3, valid_types1, prim_name); in InferType()
|
D | batch_norm.cc | 75 auto prim_name = primitive->name(); in BatchNormInfer() local 77 …rtUtils::CheckInteger("input number", SizeToLong(input_args.size()), kEqual, input_num, prim_name); in BatchNormInfer() 98 …d)CheckAndConvertUtils::CheckInteger("scale rank", SizeToLong(scale.size()), kEqual, 1, prim_name); in BatchNormInfer() 99 …CheckAndConvertUtils::Check("scale shape", scale, kEqual, "bias shape", bias, prim_name, TypeError… in BatchNormInfer() 100 …Utils::Check("scale shape[0]", scale[0], kEqual, "input_x channel", input_shape_norm[1], prim_name, in BatchNormInfer() 104 …oid)CheckAndConvertUtils::CheckInteger("mean rank", SizeToLong(mean.size()), kEqual, 1, prim_name); in BatchNormInfer() 105 …CheckAndConvertUtils::Check("mean shape", mean, kEqual, "variance shape", variance, prim_name, Typ… in BatchNormInfer() 106 …CheckAndConvertUtils::Check("mean shape", mean, kEqual, "scale shape", scale, prim_name, TypeError… in BatchNormInfer() 115 …ertUtils::CheckTensorTypeValid("x", input_args[kInputIndex0]->BuildType(), valid_types, prim_name); in BatchNormInfer() 119 (void)CheckAndConvertUtils::CheckTensorTypeSame(args, valid_types, prim_name); in BatchNormInfer() [all …]
|
D | relu.cc | 32 auto prim_name = primitive->name(); in InferShape() local 33 …rtUtils::CheckInteger("input numbers", SizeToLong(input_args.size()), kGreaterEqual, 1, prim_name); in InferShape() 34 (void)CheckAndConvertUtils::CheckArgs<abstract::AbstractTensor>(prim_name, input_args, 0); in InferShape() 43 auto prim_name = prim->name(); in InferType() local 44 …ndConvertUtils::CheckInteger("input numbers", SizeToLong(input_args.size()), kEqual, 1, prim_name); in InferType() 47 …(void)CheckAndConvertUtils::CheckTensorTypeValid("input_x", x_type, common_valid_types, prim_name); in InferType()
|
D | split_v.cc | 29 auto prim_name = primitive->name(); in InferShape() local 30 …dConvertUtils::CheckInteger("input numbers", SizeToLong(input_args.size()), kEqual, 1L, prim_name); in InferShape() 33 (void)CheckAndConvertUtils::CheckInteger("x_rank", x_rank, kGreaterEqual, 1, prim_name); in InferShape() 35 …kAndConvertUtils::CheckInRange("split_dim", split_dim, kIncludeLeft, {-x_rank, x_rank}, prim_name); in InferShape() 41 (void)CheckAndConvertUtils::CheckInteger("num_split", num_split, kGreaterEqual, 1, prim_name); in InferShape() 44 prim_name); in InferShape() 50 {0, shape_of_split_dim}, prim_name); in InferShape() 54 shape_of_split_dim, prim_name); in InferShape() 64 {0, shape_of_split_dim}, prim_name); in InferShape()
|
D | assign.cc | 32 auto prim_name = primitive->name(); in InferImplAssign() local 35 …eToLong(CheckAndConvertUtils::GetRemoveMonadAbsNum(args_spec_list)), kEqual, input_num, prim_name); in InferImplAssign() 41 prim_name); in InferImplAssign() 45 …void)CheckAndConvertUtils::CheckTensorTypeValid("variable", variable_type, check_types, prim_name); in InferImplAssign() 55 … MS_EXCEPTION(ValueError) << "For " << prim_name << ", the rank of value is " << value_shape.size() in InferImplAssign() 61 MS_EXCEPTION(ValueError) << "For " << prim_name << ", the shape of value is " in InferImplAssign()
|
D | unsorted_segment_sum.cc | 31 auto prim_name = primitive->name(); in UnsortedSegmentSumInfer() local 40 …ckAndConvertUtils::CheckInteger("x_shape", SizeToLong(x_shape.size()), kGreaterThan, 0, prim_name); in UnsortedSegmentSumInfer() 44 prim_name); in UnsortedSegmentSumInfer() 46 int64_t(segment_ids_shape.size()), prim_name); in UnsortedSegmentSumInfer() 52 …ertUtils::Check("segment_ids_shp", segment_ids_shape[i], kEqual, "x_shape", x_shape[i], prim_name); in UnsortedSegmentSumInfer() 58 valid_num_segments_types, prim_name); in UnsortedSegmentSumInfer()
|
D | index_add.cc | 27 auto prim_name = primitive->name(); in IndexAddInferShape() local 30 prim_name); in IndexAddInferShape() 38 CheckAndConvertUtils::Check("x rank", x_rank, kEqual, "y rank", y_rank, prim_name); in IndexAddInferShape() 40 …heckAndConvertUtils::CheckInRange("axis", axis, kIncludeNeither, {-x_rank - 1, x_rank}, prim_name); in IndexAddInferShape() 43 (void)CheckAndConvertUtils::CheckInteger("idx size", idx_rank, kEqual, 1, prim_name); in IndexAddInferShape() 49 y_shape[LongToSize(axis_rank)], prim_name); in IndexAddInferShape() 53 prim_name); in IndexAddInferShape()
|
D | expand_dims.cc | 33 auto prim_name = primitive->name(); in ExpandDimsInfer() local 35 …rtUtils::CheckInteger("input number", SizeToLong(input_args.size()), kEqual, input_num, prim_name); in ExpandDimsInfer() 43 …ls::CheckInRange<int64_t>("axis", dim_val, kIncludeBoth, {-SizeToLong(rank) - 1, rank}, prim_name); in ExpandDimsInfer() 52 auto x_type = CheckAndConvertUtils::GetInputTensorType(input_args, x_index, prim_name); in ExpandDimsInfer() 54 (void)CheckAndConvertUtils::CheckSubClass("x_type", x_type, valid_x_type, prim_name); in ExpandDimsInfer()
|
/third_party/mindspore/mindspore/core/utils/ |
D | check_convert_utils.h | 156 const std::string &prim_name); 158 … const std::set<std::string> &check_list, const std::string &prim_name); 162 int64_t match_value, const std::string &prim_name = ""); 166 const std::string &prim_name) { in CheckValue() argument 175 if (prim_name.empty()) { in CheckValue() 178 buffer << "The primitive[" << prim_name << "]'s " << arg_name << " must "; in CheckValue() 191 const std::pair<T, T> &range, const std::string &prim_name) { in CheckInRange() argument 204 if (prim_name.empty()) { in CheckInRange() 207 buffer << "The primitive[" << prim_name << "] " << arg_name << " must "; in CheckInRange() 221 static abstract::ShapePtr GetTensorInputShape(const std::string &prim_name, [all …]
|
D | check_convert_utils.cc | 311 const std::string &prim_name) { in CheckPositiveVector() argument 313 buffer << "The primitive[" << prim_name << "]'s attribute[" << arg_name in CheckPositiveVector() 327 … const std::set<std::string> &check_list, const std::string &prim_name) { in CheckString() argument 332 buffer << "The primitive[" << prim_name << "]'s attribute[" << arg_name << "]"; in CheckString() 348 int64_t match_value, const std::string &prim_name) { in CheckInteger() argument 357 if (prim_name.empty()) { in CheckInteger() 360 buffer << "The primitive[" << prim_name << "]'s " << arg_name << " must "; in CheckInteger() 372 const std::string &prim_name) { in CheckInputArgs() argument 373 …ckInteger("input number", SizeToLong(input_args.size()), compare_operator, match_value, prim_name); in CheckInputArgs() 376 MS_EXCEPTION(ValueError) << "The " << index << "'s input of " << prim_name << " is nullptr."; in CheckInputArgs() [all …]
|
/third_party/mindspore/mindspore/ops/_utils/ |
D | utils.py | 25 def get_broadcast_shape(x_shape, y_shape, prim_name, shape_type=""): argument 78 def get_concat_offset(x_shp, x_type, axis, prim_name): argument 80 validator.check_value_type("shape", x_shp, [tuple, list], prim_name) 81 validator.check_positive_int(len(x_shp), "input_x rank", prim_name) 82 validator.check_subclass("shape0", x_type[0], mstype.tensor, prim_name) 83 validator.check_positive_int(len(x_shp[0]), "len of x_shp[0]", prim_name) 85 validator.check_int_range(axis, -rank_base - 1, rank_base, Rel.INC_BOTH, 'axis', prim_name) 92 …alidator.check('len of x_shp[%d]' % i, len(v), 'len of x_shp[0]', len(x_shp[0]), Rel.EQ, prim_name) 93 validator.check('x_type[%d]' % i, x_type[i], 'x_type[0]', x_type[0], Rel.EQ, prim_name)
|
/third_party/mindspore/mindspore/nn/optim/ |
D | ftrl.py | 59 def _check_param(initial_accum, lr_power, l1, l2, use_locking, prim_name=None): argument 61 validator.check_value_type("initial_accum", initial_accum, [float], prim_name) 62 validator.check_number("initial_accum", initial_accum, 0.0, Rel.GE, prim_name) 64 validator.check_value_type("lr_power", lr_power, [float], prim_name) 65 validator.check_number("lr_power", lr_power, 0.0, Rel.LE, prim_name) 67 validator.check_value_type("l1", l1, [float], prim_name) 68 validator.check_number("l1", l1, 0.0, Rel.GE, prim_name) 70 validator.check_value_type("l2", l2, [float], prim_name) 71 validator.check_number("l2", l2, 0.0, Rel.GE, prim_name) 73 validator.check_value_type("use_locking", use_locking, [bool], prim_name)
|
D | proximal_ada_grad.py | 44 def _check_param_value(accum, l1, l2, use_locking, prim_name=None): argument 46 validator.check_value_type("accum", accum, [float], prim_name) 47 validator.check_value_type("l1", l1, [float], prim_name) 48 validator.check_value_type("l2", l2, [float], prim_name) 49 validator.check_value_type("use_locking", use_locking, [bool], prim_name) 50 validator.check_non_negative_float(accum, "accum", prim_name) 51 validator.check_non_negative_float(l1, "l1", prim_name) 52 validator.check_non_negative_float(l2, "l2", prim_name)
|
/third_party/mindspore/mindspore/nn/layer/ |
D | timedistributed.py | 27 def _check_reshape_pos(reshape_pos, inputs_shape, outputs_shape, prim_name=None): argument 28 msg_prefix = f"For '{prim_name}', the" if prim_name else "The" 38 def _check_expand_dims_axis(time_axis, ndim, prim_name=None): argument 39 msg_prefix = f"For '{prim_name}', the" if prim_name else "The" 53 def _check_data(flag, prim_name=None): argument 54 msg_prefix = f"For '{prim_name}', the" if prim_name else "The" 60 def _check_inputs_dim(shape, prim_name=None): argument 61 msg_prefix = f"For '{prim_name}', the" if prim_name else "The"
|