clean code

This commit is contained in:
r1chardf1d0 2024-03-06 19:21:02 +08:00
parent 4a26bb3ec0
commit 2ca263840a
5 changed files with 8 additions and 10 deletions

View File

@ -56,6 +56,7 @@
"mindspore/mindspore/python/mindspore/nn/cell.py" "assignment-from-no-return"
"mindspore/mindspore/python/mindspore/_extends/parse/resources.py" "bad-whitespace"
"mindspore/mindspore/python/mindspore/_extends/parse/parser.py" "broad-except"
"mindspore/mindspore/python/mindspore/_extends/parse/parser.py" "unidiomatic-typecheck"
"mindspore/mindspore/python/mindspore/_extends/parse/parser.py" "protected-access"
"mindspore/mindspore/python/mindspore/_extends/parse/parser.py" "eval-used"
"mindspore/mindspore/python/mindspore/_extends/parse/parser.py" "bare-except"

View File

@ -17,6 +17,7 @@
#include "pipeline/jit/pi/graph_build/func_graph_builder.h"
#include <algorithm>
#include <utility>
#include <set>
#include <unordered_set>
#include "pipeline/jit/ps/static_analysis/static_analysis.h"
#include "pipeline/jit/ps/action.h"

View File

@ -3425,10 +3425,7 @@ py::object MindGraphBuilder::ResolveCallable(CallNode *call_node, StopTraceReaso
// find code object
auto vobj = AObject::Convert(callable_info.ptr());
if (vobj->GetType() == AObject::kTypeCFunction) {
callable_info = py::object();
}
callable_info = FindPyFunc(vobj);
callable_info = (vobj->GetType() == AObject::kTypeCFunction) ? py::object() : FindPyFunc(vobj);
if (callable_info.ptr() == nullptr) {
*stop_reason = StopTraceReason::kStopTraceFunc_Type_Unsupported;
call_node->SetInlineReason(InlineReason::kInlineCFunction_Unsupported);

View File

@ -201,8 +201,7 @@ CallableGraph MindCompiler::Compile(const FuncGraphPtr &func_graph, const py::tu
MS_EXCEPTION_IF_CHECK_FAIL(!phase.empty(),
"Phase name should not be empty for function " + compile_info.co_name_ + ".");
CallableGraph callable = [compile_info, phase](
PyObject *args, PyObject *kwargs) -> PyObject * {
CallableGraph callable = [compile_info, phase](PyObject *args, PyObject *kwargs) -> PyObject * {
MS_EXCEPTION_IF_CHECK_FAIL(PyTuple_Check(args), "Excepted a Tuple Object for run args.");
MS_EXCEPTION_IF_CHECK_FAIL(((kwargs == nullptr) || PyDict_Check(kwargs)),
"Excepted nullptr or a Dict Object for run kwargs.");
@ -212,7 +211,7 @@ CallableGraph MindCompiler::Compile(const FuncGraphPtr &func_graph, const py::tu
tuple = EliminateSelf(tuple, compile_info.co_name_);
tuple = EliminateStubTensor(tuple);
MarkArgmentMutable(tuple);
tuple = EliminateInvalidArgs(tuple, compile_info.co_flags_, false); // need adapt for optimizer
tuple = EliminateInvalidArgs(tuple, compile_info.co_flags_, false); // need adapt for optimizer
auto graph_executor = pipeline::GraphExecutorPy::GetInstance();
MS_EXCEPTION_IF_NULL(graph_executor);
py::object ret = graph_executor->Run(tuple, py::str(phase));

View File

@ -102,7 +102,7 @@ def test_break_in_subgraph():
m = x + y
return type(m)
inner_net = InnerNet();
inner_net = InnerNet()
net = Net(inner_net)
a = Tensor([1])
jit(net.construct, mode="PIJit", jit_config=cfg)
@ -123,7 +123,7 @@ def test_break_in_subgraph_2():
def out(x, y):
m = x + y
n = inner(x, y)
ret= m/n
ret = m/n
return ret
def inner(a, b):
@ -147,7 +147,7 @@ def test_break_in_subgraph_3():
def out(x, y):
m = x + y
n = inner(x, y)
ret= m/n
ret = m/n
return ret
def inner(a, b):