Browse Source

pclint clear

tags/v1.5.0-rc1
wilfChen 4 years ago
parent
commit
7845f7f1c6
4 changed files with 6 additions and 5 deletions
  1. +3
    -2
      mindspore/ccsrc/backend/kernel_compiler/cpu/pyfunc/py_func_cpu_kernel.cc
  2. +1
    -1
      mindspore/ccsrc/backend/kernel_compiler/cpu/pyfunc/py_func_cpu_kernel.h
  3. +1
    -1
      mindspore/ccsrc/backend/session/anf_runtime_algorithm.cc
  4. +1
    -1
      mindspore/ccsrc/backend/session/anf_runtime_algorithm.h

+ 3
- 2
mindspore/ccsrc/backend/kernel_compiler/cpu/pyfunc/py_func_cpu_kernel.cc View File

@@ -144,13 +144,14 @@ void ArrayToRawMemory(const py::array &array, const AddressPtr &address) {
MS_LOG(EXCEPTION) << "Failed to get buffer from the input!";
}

auto buffer = std::make_unique<char[]>(pybuf.len);
auto buffer = std::make_unique<char[]>(LongToSize(pybuf.len));
if (PyBuffer_ToContiguous(buffer.get(), &pybuf, pybuf.len, 'C')) {
PyBuffer_Release(&pybuf);
MS_LOG(EXCEPTION) << "Can't copy numpy.ndarray to a contiguous buffer.";
}
PyBuffer_Release(&pybuf);
CHECK_RET_WITH_EXCEPT(memcpy_s(address->addr, address->size, buffer.get(), pybuf.len), EOK, "memcpy failed.");
CHECK_RET_WITH_EXCEPT(memcpy_s(address->addr, address->size, buffer.get(), LongToSize(pybuf.len)), EOK,
"memcpy failed.");
}
}



+ 1
- 1
mindspore/ccsrc/backend/kernel_compiler/cpu/pyfunc/py_func_cpu_kernel.h View File

@@ -62,7 +62,7 @@ class PyFuncCpuKernel : public CPUKernel {
// The Python object is not acceptable for `Primitive` attribute. So we pass an unique key instead of Python function.
// ME store the Python function to a dict, and pass the key to backend kernel.
// The kernel get the Python functhon by the key from the dict when the kernel is first invoked.
size_t func_id_;
int64_t func_id_;
py::function py_func_;
// Input and output specifications.
PyFuncArgumentInfo input_infos_;


+ 1
- 1
mindspore/ccsrc/backend/session/anf_runtime_algorithm.cc View File

@@ -2245,7 +2245,7 @@ void AnfRuntimeAlgorithm::InferShape(const CNodePtr &node, std::map<uint32_t, te
node->set_abstract(eval_result);
}

void AnfRuntimeAlgorithm::InsertMakeTupleForOutput(NotNull<KernelGraphPtr> root_graph) {
void AnfRuntimeAlgorithm::InsertMakeTupleForOutput(const NotNull<KernelGraphPtr> &root_graph) {
auto return_node = root_graph->get_return();
MS_EXCEPTION_IF_NULL(return_node);
if (return_node->size() <= kReturnDataIndex) {


+ 1
- 1
mindspore/ccsrc/backend/session/anf_runtime_algorithm.h View File

@@ -301,7 +301,7 @@ class AnfRuntimeAlgorithm {
std::set<AnfNodePtr> *visited);
static void GetAllVisitedCNode(const CNodePtr &cnode, std::vector<AnfNodePtr> *used_kernels,
std::set<AnfNodePtr> *visited);
static void InsertMakeTupleForOutput(NotNull<KernelGraphPtr> root_graph);
static void InsertMakeTupleForOutput(const NotNull<KernelGraphPtr> &root_graph);
static AnfNodeIndexSet GetUpdateStateUsers(const FuncGraphManagerPtr &manager, const AnfNodePtr &node);
// Get node real inputs, skip `MakeTuple`, `TupleGetItem`, `Depend`, `Load`, `UpdateState` etc.
static void GetRealInputs(const AnfNodePtr &anf_node, std::vector<session::KernelWithIndex> *inputs);


Loading…
Cancel
Save