!19328 fix bug of infer shape in dynamic shape training
Merge pull request !19328 from zyli2020/fix_issue_defect
This commit is contained in:
commit
0553fb0a6a
|
@ -60,7 +60,8 @@ void DynamicKernel::RebuildDependTensor() {
|
|||
MS_EXCEPTION_IF_NULL(cnode);
|
||||
for (auto depend : depend_list_) {
|
||||
auto pre_node_with_index = AnfAlgo::GetPrevNodeOutput(cnode, depend);
|
||||
auto output_addr = AnfAlgo::GetPrevNodeMutableOutputAddr(cnode, depend);
|
||||
bool visit_nop_node = MsContext::GetInstance()->get_param<bool>(MS_CTX_ENABLE_MINDRT) ? false : true;
|
||||
auto output_addr = AnfAlgo::GetPrevNodeMutableOutputAddr(cnode, depend, visit_nop_node);
|
||||
std::vector<int64_t> shapes = trans::GetRuntimePaddingShape(pre_node_with_index.first, pre_node_with_index.second);
|
||||
auto host_type = AnfAlgo::GetOutputInferDataType(pre_node_with_index.first, pre_node_with_index.second);
|
||||
auto out_tensor = std::make_shared<tensor::Tensor>(host_type, shapes);
|
||||
|
|
|
@ -616,9 +616,13 @@ void MindRTBackend::RunGraphBySingleOp(const std::vector<KernelGraphPtr> &graphs
|
|||
graph_compiler_->GetParamAndOutputIndex(graph, inputs[graph_index], outputs, ¶meter_index,
|
||||
&graph_output_info.output_indexes);
|
||||
|
||||
std::map<KernelWithIndex, size_t> &cnode_ref_count = cnode_ref_counts_[graph->graph_id()];
|
||||
if (cnode_ref_count.empty()) {
|
||||
std::map<KernelWithIndex, size_t> cnode_ref_count;
|
||||
auto iter = cnode_ref_counts_.find(graph->graph_id());
|
||||
if (iter == cnode_ref_counts_.end()) {
|
||||
graph_compiler_->CalculateRefCount(graph, &cnode_ref_count);
|
||||
cnode_ref_counts_.emplace(graph->graph_id(), cnode_ref_count);
|
||||
} else {
|
||||
cnode_ref_count = iter->second;
|
||||
}
|
||||
|
||||
// Clear bucket resources every step
|
||||
|
|
Loading…
Reference in New Issue