forked from mindspore-Ecosystem/mindspore
!49401 [MS][LITE]Codex
Merge pull request !49401 from gongdaguo1/codex_master
This commit is contained in:
commit
dda93b6ca7
|
@ -91,10 +91,10 @@ int ParallelLiteActor::KernelActorInit() {
|
|||
return RET_ERROR;
|
||||
}
|
||||
size_t max_tensor_index = kernel_->out_tensors().size();
|
||||
MS_ASSERT(
|
||||
std::find_if(results_tensor_index_.begin(), results_tensor_index_.end(), [max_tensor_index](const int index) {
|
||||
return static_cast<size_t>(index) >= max_tensor_index;
|
||||
}) == results_tensor_index_.end());
|
||||
MS_CHECK_TRUE_MSG(std::find_if(results_tensor_index_.begin(), results_tensor_index_.end(),
|
||||
[max_tensor_index](const size_t index) { return index >= max_tensor_index; }) ==
|
||||
results_tensor_index_.end(),
|
||||
RET_ERROR, "results_tensor_index_ invalid.");
|
||||
|
||||
auto subgraph_kernel = reinterpret_cast<kernel::SubGraphKernel *>(kernel_);
|
||||
kernel::KernelsArray split_kernels;
|
||||
|
|
|
@ -397,13 +397,16 @@ int SubGraphKernel::SubGraphSplitByOperator(KernelsArray *kernels_array) {
|
|||
MS_LOG(ERROR) << "graph input node invalid!";
|
||||
return RET_ERROR;
|
||||
}
|
||||
MS_ASSERT(std::find_if(kernel->in_kernels().begin(), kernel->in_kernels().end(), [kernel](KernelExec *in_kernel) {
|
||||
return !lite::IsContain(in_kernel->out_kernels(), kernel);
|
||||
}) == kernel->in_kernels().end());
|
||||
MS_ASSERT(
|
||||
std::find_if(kernel->out_kernels().begin(), kernel->out_kernels().end(), [kernel](KernelExec *out_kernel) {
|
||||
return !lite::IsContain(out_kernel->in_kernels(), kernel);
|
||||
}) == kernel->out_kernels().end());
|
||||
MS_CHECK_TRUE_MSG(std::find_if(kernel->in_kernels().begin(), kernel->in_kernels().end(),
|
||||
[kernel](KernelExec *in_kernel) {
|
||||
return !lite::IsContain(in_kernel->out_kernels(), kernel);
|
||||
}) == kernel->in_kernels().end(),
|
||||
RET_ERROR, "Invalid input and output structure of nodes in the graph.");
|
||||
MS_CHECK_TRUE_MSG(std::find_if(kernel->out_kernels().begin(), kernel->out_kernels().end(),
|
||||
[kernel](KernelExec *out_kernel) {
|
||||
return !lite::IsContain(out_kernel->in_kernels(), kernel);
|
||||
}) == kernel->out_kernels().end(),
|
||||
RET_ERROR, "Invalid input and output structure of nodes in the graph.");
|
||||
while ((kernel->out_kernels().size() == 1) && (kernel->out_kernels().front()->in_kernels().size() == 1)) {
|
||||
kernel = kernel->out_kernels().front();
|
||||
size_t i;
|
||||
|
|
|
@ -190,7 +190,7 @@ STATUS GetCastDstDataType(const CNodePtr &cnode, int *perm) {
|
|||
MS_LOG(ERROR) << "cast data type is invalid.";
|
||||
return lite::RET_ERROR;
|
||||
}
|
||||
if (data_info.data_.size() < sizeof(int32_t)) {
|
||||
if (data_info.data_.size() != sizeof(int32_t)) {
|
||||
MS_LOG(ERROR) << "Data and datatype of data-info not match.";
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -991,14 +991,23 @@ CNodePtr GenCastNode(const FuncGraphPtr &graph, const AnfNodePtr &input_node, co
|
|||
// auto new_cast = std::make_shared<mindspore::ops::Cast>();
|
||||
ops::Cast cast_node;
|
||||
auto new_cast_c = cast_node.GetPrim();
|
||||
MS_CHECK_TRUE_MSG(new_cast_c != nullptr, nullptr, "new_cast_c is nullptr");
|
||||
if (new_cast_c == nullptr) {
|
||||
MS_LOG(ERROR) << "new_cast_c is nullptr";
|
||||
return nullptr;
|
||||
}
|
||||
ValueNodePtr value_node = NewValueNode(new_cast_c);
|
||||
MS_CHECK_TRUE_MSG(value_node != nullptr, nullptr, "NewValueNode Failed");
|
||||
if (value_node == nullptr) {
|
||||
MS_LOG(ERROR) << "NewValueNode Failed";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto param_node = opt::BuildIntValueParameterNode(graph, static_cast<int32_t>(dst_type), cnode_name + "_type");
|
||||
|
||||
auto cast_cnode = graph->NewCNode({value_node});
|
||||
MS_CHECK_TRUE_MSG(cast_cnode != nullptr, nullptr, "new_cnode is nullptr");
|
||||
if (cast_cnode == nullptr) {
|
||||
MS_LOG(ERROR) << "new_cnode is nullptr";
|
||||
return nullptr;
|
||||
}
|
||||
cast_cnode->set_fullname_with_scope(cnode_name);
|
||||
cast_cnode->set_abstract(abstract);
|
||||
auto manager = Manage(graph);
|
||||
|
|
|
@ -29,6 +29,8 @@ namespace mindspore::opt {
|
|||
namespace {
|
||||
bool IsGoodCastSplitFusion(const FuncGraphPtr &func_graph, const CNodePtr &split_cnode_2) {
|
||||
auto manager = func_graph->manager();
|
||||
MS_ASSERT(manager != nullptr);
|
||||
MS_ASSERT(split_cnode_2 != nullptr);
|
||||
auto node_users = manager->node_users();
|
||||
auto split_node_users = node_users[split_cnode_2];
|
||||
for (auto &node_user : split_node_users) {
|
||||
|
|
Loading…
Reference in New Issue