forked from mindspore-Ecosystem/mindspore
!16377 Fix static-check problems
From: @liu-yihong536 Reviewed-by: @gaoxiong1,@anyrenwei Signed-off-by: @anyrenwei
This commit is contained in:
commit
6f46b44c2a
|
@ -273,13 +273,13 @@ class CNodeDecoder {
|
|||
AnfAlgo::SetSelectKernelBuildInfo(builder->Build(), cnode_.get());
|
||||
}
|
||||
|
||||
void CreateAbstract() {
|
||||
void CreateAbstract() const {
|
||||
auto shape = AbstractShapeCreator::GetFakeAbstractShape(output_shapes_[0], output_formats_[0]);
|
||||
auto abstract = std::make_shared<abstract::AbstractTensor>(TypeIdToType(output_types_[0]), shape);
|
||||
cnode_->set_abstract(abstract);
|
||||
}
|
||||
|
||||
PrimitivePtr CreatePrimitiveWithAttrs(const std::string &op_name) {
|
||||
PrimitivePtr CreatePrimitiveWithAttrs(const std::string &op_name) const {
|
||||
auto primitive = std::make_shared<Primitive>(op_name);
|
||||
for (const auto &attr : cnode_attrs_) {
|
||||
primitive->AddAttr(attr.first, attr.second);
|
||||
|
|
|
@ -61,7 +61,7 @@ class OpInfoExtractor {
|
|||
}
|
||||
|
||||
private:
|
||||
void ExtractInputs(const OpInfoPtr &op_info) {
|
||||
void ExtractInputs(const OpInfoPtr &op_info) const {
|
||||
auto dyn_input_sizes = GetDynInputSize(cnode_);
|
||||
if (dyn_input_sizes.empty()) {
|
||||
for (size_t i = 1; i < cnode_->size(); i++) {
|
||||
|
@ -79,7 +79,7 @@ class OpInfoExtractor {
|
|||
}
|
||||
}
|
||||
|
||||
void ExtractOutputs(const OpInfoPtr &op_info) {
|
||||
void ExtractOutputs(const OpInfoPtr &op_info) const {
|
||||
size_t output_tensor_num = AnfAlgo::GetOutputTensorNum(cnode_);
|
||||
for (size_t i = 0; i < output_tensor_num; i++) {
|
||||
auto io_info = std::make_shared<OpIOInfo>();
|
||||
|
|
|
@ -76,7 +76,7 @@ void StitchAtomicCleanInsertter::CorrectKernelBuildInfo(const AnfNodePtr &compos
|
|||
}
|
||||
|
||||
CNodePtr StitchAtomicCleanInsertter::CreateInplaceAssignNode(const FuncGraphPtr &sub_graph,
|
||||
const AnfNodePtr &new_parameter) {
|
||||
const AnfNodePtr &new_parameter) const {
|
||||
// add inplaceassign
|
||||
AnfNodePtr out_node = atomic_add_node_; // Use result data itself, and set attr "fake_out" true.
|
||||
auto inplace_assign_node =
|
||||
|
|
|
@ -35,7 +35,7 @@ class StitchAtomicCleanInsertter : public AtomicCleanInsertter {
|
|||
|
||||
private:
|
||||
void CorrectKernelBuildInfo(const AnfNodePtr &composite_node, const AnfNodePtr &new_input) override;
|
||||
CNodePtr CreateInplaceAssignNode(const FuncGraphPtr &sub_graph, const AnfNodePtr &new_parameter);
|
||||
CNodePtr CreateInplaceAssignNode(const FuncGraphPtr &sub_graph, const AnfNodePtr &new_parameter) const;
|
||||
std::vector<std::pair<AnfNodePtr, int>> FindInnerCNodeUsers(const AnfNodePtr &inner_node,
|
||||
const CNodePtr &target) const;
|
||||
void ProcessOriginCNode(const AnfNodePtr &composite_node, const AnfNodePtr &new_input) override;
|
||||
|
|
|
@ -223,7 +223,7 @@ void EliminateHangingOutput::UpdateGetitemIndex(const AnfNodePtr &getitem, size_
|
|||
SetIndex(getitem, index);
|
||||
}
|
||||
|
||||
AnfNodePtr EliminateHangingOutput::ReplaceMakeTuple(const AnfNodePtr &node, const AnfNodePtrList &getitems) {
|
||||
AnfNodePtr EliminateHangingOutput::ReplaceMakeTuple(const AnfNodePtr &node, const AnfNodePtrList &getitems) const {
|
||||
auto func_graph = AnfAlgo::GetCNodeFuncGraphPtr(node);
|
||||
MS_EXCEPTION_IF_NULL(func_graph);
|
||||
auto old_maketuple = func_graph->output()->cast<CNodePtr>();
|
||||
|
|
|
@ -42,7 +42,7 @@ class EliminateHangingOutput : public Pass {
|
|||
private:
|
||||
// update the GetItem(node, i) to GetItem(node, i - offset)
|
||||
void UpdateGetitemIndex(const AnfNodePtr &getitem, size_t offset) const;
|
||||
AnfNodePtr ReplaceMakeTuple(const AnfNodePtr &node, const AnfNodePtrList &getitems);
|
||||
AnfNodePtr ReplaceMakeTuple(const AnfNodePtr &node, const AnfNodePtrList &getitems) const;
|
||||
};
|
||||
|
||||
// Remove the output without user or with virtual user (like UpdateState)
|
||||
|
|
Loading…
Reference in New Issue