forked from huawei/mindspore2022
clean code check
This commit is contained in:
parent
2c53082134
commit
a7859ecc45
|
|
@ -92,10 +92,12 @@ def not_contains(x): # pragma: no cover
|
|||
"""Not in function."""
|
||||
raise RuntimeError('This operation is not meant to be called directly.')
|
||||
|
||||
|
||||
def while_cond(x): # pragma: no cover
|
||||
"""Not in function."""
|
||||
raise RuntimeError('This operation is not meant to be called directly.')
|
||||
|
||||
|
||||
def bool_(x): # pragma: no cover
|
||||
"""judge true function."""
|
||||
raise RuntimeError('This operation is not meant to be called directly.')
|
||||
|
|
|
|||
|
|
@ -525,7 +525,7 @@ void DumpSubgraph(const OrderedMap<FuncGraphPtr, std::shared_ptr<SubGraphIRInfo>
|
|||
if (attr.second->isa<BoolImm>()) {
|
||||
fout << GetValue<bool>(attr.second);
|
||||
} else if (attr.second->isa<StringImm>()) {
|
||||
fout << GetValue<std::string>(attr.second);
|
||||
fout << (GetValue<std::string>(attr.second));
|
||||
}
|
||||
fout << std::endl;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -328,7 +328,8 @@ bool DumpJsonParser::ParseEnable(const nlohmann::json &content) {
|
|||
void DumpJsonParser::ParseOpDebugMode(const nlohmann::json &content) {
|
||||
CheckJsonUnsignedType(content, kOpDebugMode);
|
||||
op_debug_mode_ = content;
|
||||
if (op_debug_mode_ < 0 || op_debug_mode_ > 3) {
|
||||
const size_t max_mode = 3;
|
||||
if (op_debug_mode_ < 0 || op_debug_mode_ > max_mode) {
|
||||
MS_LOG(EXCEPTION) << "Dump Json Parse Failed. op_debug_mode should be 0, 1, 2, 3";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,8 @@ void StreamExecOrderRecorder::Export() {
|
|||
MS_LOG(WARNING) << "Open file for saving stream execute order failed. File path: '" << real_file_path << "'.";
|
||||
return;
|
||||
}
|
||||
fout << exec_order_json.dump(2);
|
||||
const size_t space_num = 2;
|
||||
fout << exec_order_json.dump(space_num);
|
||||
fout.close();
|
||||
ChangeFileMode(real_file_path, S_IRUSR);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ std::vector<std::vector<size_t>> SplitGroup(const std::vector<AnfNodePtr> &topos
|
|||
// ...
|
||||
// b = Load(para1, u2)
|
||||
// u3 = UpdateState(u2, b)
|
||||
//==>
|
||||
// ==>
|
||||
// delete the UpdateState
|
||||
void DeleteLoadUserUpdateState(const FuncGraphManagerPtr &manager, const AnfNodePtr &load_user) {
|
||||
const auto &update_state_cnode = load_user->cast<CNodePtr>();
|
||||
|
|
|
|||
|
|
@ -1072,7 +1072,8 @@ class GetAttrEvaluator : public TransitionPrimEvaluator {
|
|||
return ret_abstract;
|
||||
}
|
||||
// Inputs: data, item
|
||||
if (args_spec_list.size() != 2) {
|
||||
constexpr size_t input_size = 2;
|
||||
if (args_spec_list.size() != input_size) {
|
||||
MS_LOG(EXCEPTION) << "Expected args_spec_list size = 2, but has size:" << args_spec_list.size();
|
||||
}
|
||||
EvalResultPtr ret = nullptr;
|
||||
|
|
|
|||
|
|
@ -49,7 +49,8 @@ AbstractBasePtr InferImplBroadCastShape(const AnalysisEnginePtr &, const Primiti
|
|||
const AbstractBasePtrList &args_spec_list) {
|
||||
// Inputs: two tuples.
|
||||
const std::string op_name = primitive->name();
|
||||
CheckArgsSize(op_name, args_spec_list, 2);
|
||||
constexpr size_t args_size = 2;
|
||||
CheckArgsSize(op_name, args_spec_list, args_size);
|
||||
auto xs = CheckArg<AbstractTuple>(op_name, args_spec_list, 0);
|
||||
auto ys = CheckArg<AbstractTuple>(op_name, args_spec_list, 1);
|
||||
|
||||
|
|
@ -239,7 +240,8 @@ AbstractBasePtr InferImplUniqueGrad(const AnalysisEnginePtr &, const PrimitivePt
|
|||
AbstractBasePtr InferImplUnsortedSegmentSum(const AnalysisEnginePtr &, const PrimitivePtr &primitive,
|
||||
const AbstractBasePtrList &args_spec_list) {
|
||||
const std::string op_name = primitive->name();
|
||||
CheckArgsSize(op_name, args_spec_list, 3);
|
||||
constexpr size_t args_size = 3;
|
||||
CheckArgsSize(op_name, args_spec_list, args_size);
|
||||
auto x = CheckArg<AbstractTensor>(op_name, args_spec_list, 0);
|
||||
MS_EXCEPTION_IF_NULL(x);
|
||||
MS_EXCEPTION_IF_NULL(x->shape());
|
||||
|
|
@ -581,7 +583,8 @@ AbstractBasePtr InferImplRealDiv(const AnalysisEnginePtr &, const PrimitivePtr &
|
|||
AbstractBasePtr InferImplGatherV2(const AnalysisEnginePtr &, const PrimitivePtr &primitive,
|
||||
const AbstractBasePtrList &args_spec_list) {
|
||||
const std::string &op_name = primitive->name();
|
||||
CheckArgsSize(op_name, args_spec_list, 3);
|
||||
constexpr size_t args_size = 3;
|
||||
CheckArgsSize(op_name, args_spec_list, args_size);
|
||||
AbstractTensorPtr params = CheckArg<AbstractTensor>(op_name, args_spec_list, 0);
|
||||
AbstractTensorPtr indices = CheckArg<AbstractTensor>(op_name, args_spec_list, 1);
|
||||
bool ind_dyn = (!indices->shape()->min_shape().empty() && !indices->shape()->max_shape().empty());
|
||||
|
|
@ -1028,10 +1031,14 @@ AbstractBasePtr InferImplRange(const AnalysisEnginePtr &, const PrimitivePtr &pr
|
|||
if (args_spec_list.size() == 1) {
|
||||
return args_spec_list[0]->Broaden();
|
||||
}
|
||||
CheckArgsSize(op_name, args_spec_list, 3);
|
||||
AbstractTensorPtr range_start = CheckArg<AbstractTensor>(op_name, args_spec_list, 0);
|
||||
AbstractTensorPtr range_end = CheckArg<AbstractTensor>(op_name, args_spec_list, 1);
|
||||
AbstractTensorPtr range_delta = CheckArg<AbstractTensor>(op_name, args_spec_list, 2);
|
||||
constexpr size_t args_size = 3;
|
||||
constexpr size_t range_start_index = 0;
|
||||
constexpr size_t range_end_index = 1;
|
||||
constexpr size_t range_delta_index = 2;
|
||||
CheckArgsSize(op_name, args_spec_list, args_size);
|
||||
AbstractTensorPtr range_start = CheckArg<AbstractTensor>(op_name, args_spec_list, range_start_index);
|
||||
AbstractTensorPtr range_end = CheckArg<AbstractTensor>(op_name, args_spec_list, range_end_index);
|
||||
AbstractTensorPtr range_delta = CheckArg<AbstractTensor>(op_name, args_spec_list, range_delta_index);
|
||||
|
||||
TypePtrList supported_types = {kInt64, kInt32, kFloat32, kFloat64};
|
||||
TypePtr range_start_type = CheckTensorDType(range_start, supported_types, "range_start input of Range should be %s");
|
||||
|
|
@ -1040,8 +1047,9 @@ AbstractBasePtr InferImplRange(const AnalysisEnginePtr &, const PrimitivePtr &pr
|
|||
// check all 3 inputs are same type
|
||||
if (!IsIdentidityOrSubclass(range_start_type, range_end_type) ||
|
||||
!IsIdentidityOrSubclass(range_end_type, range_delta_type)) {
|
||||
MS_LOG(EXCEPTION) << "All inputs must have same type, but got: " << args_spec_list[0]->type_name() << ", "
|
||||
<< args_spec_list[1]->type_name() << ", and " << args_spec_list[2]->type_name();
|
||||
MS_LOG(EXCEPTION) << "All inputs must have same type, but got: " << args_spec_list[range_start_index]->type_name()
|
||||
<< ", " << args_spec_list[range_end_index]->type_name() << ", and "
|
||||
<< args_spec_list[range_delta_index]->type_name();
|
||||
}
|
||||
|
||||
int64_t max_output_length = -1;
|
||||
|
|
|
|||
|
|
@ -25,10 +25,12 @@ AbstractBasePtr InferImplMinOrMaxGrad(const AnalysisEnginePtr &, const Primitive
|
|||
const AbstractBasePtrList &args_spec_list) {
|
||||
// Inputs: three tensors.
|
||||
const std::string op_name = primitive->name();
|
||||
CheckArgsSize(op_name, args_spec_list, 3);
|
||||
const size_t args_size = 3;
|
||||
const size_t dout_index = 2;
|
||||
CheckArgsSize(op_name, args_spec_list, args_size);
|
||||
auto input_x = CheckArg<AbstractTensor>(op_name, args_spec_list, 0);
|
||||
auto input_y = CheckArg<AbstractTensor>(op_name, args_spec_list, 1);
|
||||
auto dout = CheckArg<AbstractTensor>(op_name, args_spec_list, 2);
|
||||
auto dout = CheckArg<AbstractTensor>(op_name, args_spec_list, dout_index);
|
||||
(void)CheckTensorsDTypeSame({input_x, input_y, dout}, {kInt, kUInt, kFloat},
|
||||
op_name + "evaluator three inputs should be %s");
|
||||
|
||||
|
|
@ -197,7 +199,8 @@ AbstractBasePtr InferImplReduceFunc(const AnalysisEnginePtr &, const PrimitivePt
|
|||
AbstractBasePtr InferImplBinaryBase(const AnalysisEnginePtr &engine_ptr, const PrimitivePtr &primitive,
|
||||
const AbstractBasePtrList &args_spec_list) {
|
||||
const std::string op_name = primitive->name();
|
||||
CheckArgsSize(op_name, args_spec_list, 2);
|
||||
constexpr size_t args_size = 2;
|
||||
CheckArgsSize(op_name, args_spec_list, args_size);
|
||||
auto input_x = CheckArg<AbstractTensor>(op_name, args_spec_list, 0);
|
||||
MS_EXCEPTION_IF_NULL(input_x);
|
||||
MS_EXCEPTION_IF_NULL(input_x->shape());
|
||||
|
|
@ -269,7 +272,8 @@ AbstractBasePtr InferImplDivNoNan(const AnalysisEnginePtr &engine_ptr, const Pri
|
|||
AbstractBasePtr InferImplLinSpace(const AnalysisEnginePtr &, const PrimitivePtr &primitive,
|
||||
const AbstractBasePtrList &args_spec_list) {
|
||||
const std::string op_name = primitive->name();
|
||||
CheckArgsSize(op_name, args_spec_list, 3);
|
||||
constexpr size_t args_size = 3;
|
||||
CheckArgsSize(op_name, args_spec_list, args_size);
|
||||
auto start = CheckArg<AbstractTensor>(op_name, args_spec_list, 0);
|
||||
MS_EXCEPTION_IF_NULL(start);
|
||||
MS_EXCEPTION_IF_NULL(start->shape());
|
||||
|
|
|
|||
|
|
@ -23,6 +23,12 @@
|
|||
|
||||
namespace mindspore {
|
||||
namespace abstract {
|
||||
const size_t stride_num_element = 2;
|
||||
const size_t stride_start_idx = 2;
|
||||
const size_t dilation_num_element = 2;
|
||||
const size_t dilation_start_idx = 2;
|
||||
const size_t padding_num_element = 4;
|
||||
const size_t padding_start_idx = 0;
|
||||
int64_t GetAndCheckFormat(const ValuePtr &value) {
|
||||
int64_t data_format;
|
||||
bool result = CheckAndConvertUtils::GetDataFormatEnumValue(value, &data_format);
|
||||
|
|
@ -201,13 +207,16 @@ AbstractBasePtr InferImplBatchNorm(const AnalysisEnginePtr &, const PrimitivePtr
|
|||
AbstractBasePtr InferImplFusedSparseAdam(const AnalysisEnginePtr &, const PrimitivePtr &primitive,
|
||||
const AbstractBasePtrList &args_spec_list) {
|
||||
// the output is useless, so we dont have to focus on the output shape
|
||||
MS_EXCEPTION_IF_NULL(args_spec_list[1]);
|
||||
MS_EXCEPTION_IF_NULL(args_spec_list[2]);
|
||||
MS_EXCEPTION_IF_NULL(args_spec_list[3]);
|
||||
constexpr size_t dx_index = 1;
|
||||
constexpr size_t dscale_index = 2;
|
||||
constexpr size_t dbias_index = 3;
|
||||
MS_EXCEPTION_IF_NULL(args_spec_list[dx_index]);
|
||||
MS_EXCEPTION_IF_NULL(args_spec_list[dscale_index]);
|
||||
MS_EXCEPTION_IF_NULL(args_spec_list[dbias_index]);
|
||||
|
||||
auto dx = args_spec_list[1]->Broaden();
|
||||
auto dscale = args_spec_list[2]->Broaden();
|
||||
auto dbias = args_spec_list[3]->Broaden();
|
||||
auto dx = args_spec_list[dx_index]->Broaden();
|
||||
auto dscale = args_spec_list[dscale_index]->Broaden();
|
||||
auto dbias = args_spec_list[dbias_index]->Broaden();
|
||||
|
||||
AbstractBasePtrList rets = {dx, dscale, dbias};
|
||||
return std::make_shared<AbstractTuple>(rets);
|
||||
|
|
@ -220,7 +229,8 @@ void Conv2DPadFunction(std::vector<int64_t> *output_hw, std::vector<int64_t> *pa
|
|||
if (pad_mode == PadMode::VALID) {
|
||||
output_hw->push_back(static_cast<int64_t>(std::ceil(((x_h * 1.0) - dilation[0] * (kernel[0] - 1)) / stride[0])));
|
||||
output_hw->push_back(static_cast<int64_t>(std::ceil(((x_w * 1.0) - dilation[1] * (kernel[1] - 1)) / stride[1])));
|
||||
(void)pad_list->insert(pad_list->begin(), 4, 0);
|
||||
const size_t nhwc = 4;
|
||||
(void)pad_list->insert(pad_list->begin(), nhwc, 0);
|
||||
} else if (pad_mode == PadMode::SAME) {
|
||||
output_hw->push_back(static_cast<int64_t>(std::ceil((x_h * 1.0) / stride[0])));
|
||||
output_hw->push_back(static_cast<int64_t>(std::ceil((x_w * 1.0) / stride[1])));
|
||||
|
|
@ -243,6 +253,15 @@ void Conv2DPadFunction(std::vector<int64_t> *output_hw, std::vector<int64_t> *pa
|
|||
}
|
||||
}
|
||||
|
||||
void CheckShape(const std::string &op_name, const ShapeVector &w_shape, const AbstractTensorPtr &input_w) {
|
||||
ShapeVector w_min_shape = input_w->shape()->min_shape();
|
||||
ShapeVector w_max_shape = input_w->shape()->max_shape();
|
||||
CheckMinMaxShape(w_shape, &w_min_shape, &w_max_shape);
|
||||
CheckShapeAnyAndPositive(op_name + " w_shape", w_shape);
|
||||
CheckShapeAllPositive(op_name + " w_min_shape", w_min_shape);
|
||||
CheckShapeAllPositive(op_name + " w_max_shape", w_max_shape);
|
||||
}
|
||||
|
||||
AbstractBasePtr InferImplConv2D(const AnalysisEnginePtr &, const PrimitivePtr &primitive,
|
||||
const AbstractBasePtrList &args_spec_list) {
|
||||
const std::string op_name = primitive->name();
|
||||
|
|
@ -261,12 +280,7 @@ AbstractBasePtr InferImplConv2D(const AnalysisEnginePtr &, const PrimitivePtr &p
|
|||
MS_EXCEPTION_IF_NULL(input_w);
|
||||
MS_EXCEPTION_IF_NULL(input_w->shape());
|
||||
ShapeVector w_shape = input_w->shape()->shape();
|
||||
ShapeVector w_min_shape = input_w->shape()->min_shape();
|
||||
ShapeVector w_max_shape = input_w->shape()->max_shape();
|
||||
CheckMinMaxShape(w_shape, &w_min_shape, &w_max_shape);
|
||||
CheckShapeAnyAndPositive(op_name + " w_shape", w_shape);
|
||||
CheckShapeAllPositive(op_name + " w_min_shape", w_min_shape);
|
||||
CheckShapeAllPositive(op_name + " w_max_shape", w_max_shape);
|
||||
CheckShape(op_name, w_shape, input_w);
|
||||
const uint64_t n_axis = 0;
|
||||
uint64_t c_axis = 1;
|
||||
uint64_t h_axis = 2;
|
||||
|
|
@ -287,16 +301,21 @@ AbstractBasePtr InferImplConv2D(const AnalysisEnginePtr &, const PrimitivePtr &p
|
|||
if ((w_shape[n_axis] != Shape::SHP_ANY) && (w_shape[n_axis] != out_channel)) {
|
||||
MS_LOG(EXCEPTION) << "w_shape[" << n_axis << "] = " << w_shape[n_axis] << " must equal to = " << out_channel;
|
||||
}
|
||||
std::vector<int64_t> kernel_size = CheckAttrIntOrTuple(op_name, primitive->GetAttr("kernel_size"), 0, 2);
|
||||
const size_t kernel_size_num_element = 2;
|
||||
std::vector<int64_t> kernel_size =
|
||||
CheckAttrIntOrTuple(op_name, primitive->GetAttr("kernel_size"), 0, kernel_size_num_element);
|
||||
if ((w_shape[h_axis] != Shape::SHP_ANY) && (w_shape[h_axis] != kernel_size[0])) {
|
||||
MS_LOG(EXCEPTION) << "weight height = " << w_shape[h_axis] << ", must equal to = " << kernel_size[0];
|
||||
}
|
||||
if ((w_shape[w_axis] != Shape::SHP_ANY) && (w_shape[w_axis] != kernel_size[1])) {
|
||||
MS_LOG(EXCEPTION) << "weight width = " << w_shape[w_axis] << ", must equal to = " << kernel_size[1];
|
||||
}
|
||||
std::vector<int64_t> stride = CheckAttrIntOrTuple(op_name, primitive->GetAttr("stride"), 2, 2);
|
||||
std::vector<int64_t> dilation = CheckAttrIntOrTuple(op_name, primitive->GetAttr("dilation"), 2, 2);
|
||||
std::vector<int64_t> padding = CheckAttrIntOrTuple(op_name, primitive->GetAttr("pad"), 0, 4);
|
||||
std::vector<int64_t> stride =
|
||||
CheckAttrIntOrTuple(op_name, primitive->GetAttr("stride"), stride_start_idx, stride_num_element);
|
||||
std::vector<int64_t> dilation =
|
||||
CheckAttrIntOrTuple(op_name, primitive->GetAttr("dilation"), dilation_start_idx, dilation_num_element);
|
||||
std::vector<int64_t> padding =
|
||||
CheckAttrIntOrTuple(op_name, primitive->GetAttr("pad"), padding_start_idx, padding_num_element);
|
||||
int64_t pad_mode;
|
||||
CheckAndConvertUtils::GetPadModEnumValue(primitive->GetAttr("pad_mode"), &pad_mode);
|
||||
std::vector<int64_t> output_hw;
|
||||
|
|
@ -346,7 +365,8 @@ AbstractBasePtr InferImplConv2D(const AnalysisEnginePtr &, const PrimitivePtr &p
|
|||
AbstractBasePtr InferImplBiasAdd(const AnalysisEnginePtr &, const PrimitivePtr &primitive,
|
||||
const AbstractBasePtrList &args_spec_list) {
|
||||
const std::string op_name = primitive->name();
|
||||
CheckArgsSize(op_name, args_spec_list, 2);
|
||||
constexpr size_t args_size = 2;
|
||||
CheckArgsSize(op_name, args_spec_list, args_size);
|
||||
auto x = CheckArg<AbstractTensor>(op_name, args_spec_list, 0);
|
||||
auto bias = CheckArg<AbstractTensor>(op_name, args_spec_list, 1);
|
||||
MS_EXCEPTION_IF_NULL(x);
|
||||
|
|
@ -424,7 +444,8 @@ AbstractBasePtr InferImplBpropCut(const AnalysisEnginePtr &, const PrimitivePtr
|
|||
const AbstractBasePtrList &args_spec_list) {
|
||||
// Inputs: a tensor.
|
||||
AbstractBasePtrList args_list;
|
||||
for (size_t i = 0; i < args_spec_list.size() - 2; i++) {
|
||||
constexpr size_t out_and_dout_size = 2;
|
||||
for (size_t i = 0; i < args_spec_list.size() - out_and_dout_size; i++) {
|
||||
args_list.push_back(args_spec_list[i]->Broaden());
|
||||
}
|
||||
return std::make_shared<AbstractTuple>(args_list);
|
||||
|
|
|
|||
|
|
@ -282,7 +282,8 @@ AbstractBasePtr InferImplRowTensorAdd(const AnalysisEnginePtr &, const Primitive
|
|||
const AbstractBasePtrList &args_spec_list) {
|
||||
// Inputs: row tensor and tensor.
|
||||
const std::string op_name = primitive->name();
|
||||
CheckArgsSize(op_name, args_spec_list, 2);
|
||||
constexpr size_t args_size = 2;
|
||||
CheckArgsSize(op_name, args_spec_list, args_size);
|
||||
auto row_tensor = CheckArg<AbstractRowTensor>(op_name, args_spec_list, 0);
|
||||
auto tensor = CheckArg<AbstractTensor>(op_name, args_spec_list, 1);
|
||||
MS_EXCEPTION_IF_NULL(row_tensor->dense_shape());
|
||||
|
|
|
|||
|
|
@ -323,8 +323,9 @@ void CheckMinMaxShape(const ShapeVector &shape, ShapeVector *min_shape, ShapeVec
|
|||
|
||||
int64_t GetUnsortedSegmentOpScalarArg(const AbstractBasePtrList &args_spec_list, const std::string &op_name) {
|
||||
int64_t num_segments_value = 0;
|
||||
if (args_spec_list[2]->isa<AbstractTensor>()) { // num_segments is Tensor
|
||||
auto num_segments = args_spec_list[2]->cast<AbstractTensorPtr>();
|
||||
constexpr size_t scalar_index = 2;
|
||||
if (args_spec_list[scalar_index]->isa<AbstractTensor>()) { // num_segments is Tensor
|
||||
auto num_segments = args_spec_list[scalar_index]->cast<AbstractTensorPtr>();
|
||||
MS_EXCEPTION_IF_NULL(num_segments);
|
||||
auto num_segments_value_ptr = num_segments->BuildValue();
|
||||
MS_EXCEPTION_IF_NULL(num_segments_value_ptr);
|
||||
|
|
@ -335,8 +336,8 @@ int64_t GetUnsortedSegmentOpScalarArg(const AbstractBasePtrList &args_spec_list,
|
|||
} else {
|
||||
num_segments_value = *static_cast<int32_t *>(num_segments_tensor->data_c());
|
||||
}
|
||||
} else if (args_spec_list[2]->isa<AbstractScalar>()) { // num_segments is Scalar
|
||||
auto num_segments = CheckArg<AbstractScalar>(op_name, args_spec_list, 2);
|
||||
} else if (args_spec_list[scalar_index]->isa<AbstractScalar>()) { // num_segments is Scalar
|
||||
auto num_segments = CheckArg<AbstractScalar>(op_name, args_spec_list, scalar_index);
|
||||
if (num_segments->GetTypeTrack()->type_id() == TypeId::kNumberTypeInt64) {
|
||||
num_segments_value = GetValue<int64_t>(num_segments->BuildValue());
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -25,19 +25,7 @@
|
|||
namespace mindspore {
|
||||
using mindspore::abstract::AbstractFunction;
|
||||
|
||||
abstract::AbstractBasePtr Cell::ToAbstract() {
|
||||
/*
|
||||
std::vector<abstract::AbstractAttribute> abs_attrs;
|
||||
std::transform(attrs_.begin(), attrs_.end(), std::back_inserter(abs_attrs),
|
||||
[](std::pair<std::string, ValuePtr> attr) -> abstract::AbstractAttribute {
|
||||
return std::make_pair(attr.first, attr.second->ToAbstract());
|
||||
});
|
||||
auto abs = std::make_shared<abstract::AbstractCell>(shared_from_base<Named>(), abs_attrs);
|
||||
abs->set_value(shared_from_base<Value>());
|
||||
return abs;
|
||||
*/
|
||||
return nullptr;
|
||||
}
|
||||
abstract::AbstractBasePtr Cell::ToAbstract() { return nullptr; }
|
||||
|
||||
bool Cell::operator==(const Value &other) const {
|
||||
if (other.isa<Cell>()) {
|
||||
|
|
|
|||
|
|
@ -360,7 +360,8 @@ class TensorDataImpl : public TensorData {
|
|||
ss << kEllipsis;
|
||||
// Ignored at this layer.
|
||||
ssize_t ignored = shape[depth + 1];
|
||||
for (ssize_t i = depth + 2; i < static_cast<ssize_t>(ndim_); i++) {
|
||||
const size_t offset = 2;
|
||||
for (ssize_t i = depth + offset; i < static_cast<ssize_t>(ndim_); i++) {
|
||||
ignored *= shape[i];
|
||||
}
|
||||
// Multiple with ignored layers number.
|
||||
|
|
|
|||
Loading…
Reference in New Issue