diff --git a/mindspore/ccsrc/backend/session/gpu_session.cc b/mindspore/ccsrc/backend/session/gpu_session.cc index e3f6f489972..4498f7e7d78 100644 --- a/mindspore/ccsrc/backend/session/gpu_session.cc +++ b/mindspore/ccsrc/backend/session/gpu_session.cc @@ -66,6 +66,7 @@ #include "utils/ms_utils.h" #include "utils/config_manager.h" #include "utils/ms_context.h" +#include "utils/utils.h" #if ENABLE_CPU && ENABLE_GPU #include "ps/util.h" #include "ps/ps_cache/ps_cache_manager.h" @@ -448,7 +449,8 @@ void GPUSession::BuildOpImpl(const OpRunInfo &op_run_info, const GraphInfo &grap const std::vector &input_tensors, const std::vector &tensors_mask) { // Check if the graph cache exists. - if (run_op_graphs_.find(graph_info) != run_op_graphs_.end()) { + if (run_op_graphs_.find(graph_info) != run_op_graphs_.end() && + kOpCacheAllowList.find(op_run_info.op_name) == kOpCacheAllowList.end()) { return; } // Prepare the graph diff --git a/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc b/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc index 50a611a2ba3..a4cf0974985 100644 --- a/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc +++ b/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc @@ -387,10 +387,8 @@ void ConvertPyObjectToTensor(const py::object &input_object, const PrimitivePtr } else if (py::isinstance(input_object)) { double input_value = py::cast(input_object); tensor_ptr = std::make_shared(input_value, kFloat32); - *tensor_mask = kValueNodeTensorMask; } else if (py::isinstance(input_object)) { tensor_ptr = std::make_shared(py::cast(input_object), kInt64); - *tensor_mask = kValueNodeTensorMask; } else if (py::isinstance(input_object)) { tensor_ptr = TensorPy::MakeTensor(py::cast(input_object), nullptr); } else if (py::isinstance(input_object)) { diff --git a/mindspore/ccsrc/utils/utils.h b/mindspore/ccsrc/utils/utils.h index e24655fa07d..4033ab2a356 100644 --- a/mindspore/ccsrc/utils/utils.h +++ b/mindspore/ccsrc/utils/utils.h @@ -271,6 +271,7 @@ constexpr auto kPadAndShiftOpName = "PadAndShift"; constexpr auto kSparseSoftmaxCrossEntropyWithLogitsOpName = "SparseSoftmaxCrossEntropyWithLogits"; constexpr auto kOneHotOpName = "OneHot"; constexpr auto kSoftmaxCrossEntropyWithLogitsOpName = "SoftmaxCrossEntropyWithLogits"; +constexpr auto kUniformCandidateSamplerOpName = "UniformCandidateSampler"; // Hcom Op Type constexpr auto kHcomOpTypeAllReduce = "HcomAllReduce"; @@ -492,6 +493,8 @@ const std::set kOptOperatorSet = {kMomentumOpName, const std::set kPosteriorOperatorSet = {kPullOpName}; +const std::set kOpCacheAllowList = {kUniformCandidateSamplerOpName}; + const std::set kHWSpecialFormatSet = { kOpFormat_FRACTAL_Z_3D, kOpFormat_NC1KHKWHWC0, kOpFormat_NC1HWC0, kOpFormat_FRAC_NZ, kOpFormat_C1HWNCoC0, kOpFormat_NC1HWC0_C04, kOpFormat_FRACTAL_Z_C04, kOpFormat_FRACTAL_ZN_LSTM, kOpFormat_NDC1HWC0, kOpFormat_FRAC_Z};