@@ -30,6 +30,7 @@ limitations under the License. */
3030#include " paddle/fluid/framework/var_type.h"
3131#include " paddle/fluid/platform/enforce.h"
3232#include " paddle/fluid/platform/profiler.h"
33+ #include " paddle/pten/common/scalar.h"
3334
3435namespace paddle {
3536namespace framework {
@@ -1080,20 +1081,6 @@ void OperatorWithKernel::RuntimeInferShape(const Scope& scope,
10801081 this ->InferShape (&infer_shape_ctx);
10811082}
10821083
1083- static std::string RuntimeContextDebugString (const RuntimeContext& ctx) {
1084- std::stringstream ss;
1085- ss << " RuntimeContext(Inputs: " ;
1086- for (auto & var_pair : ctx.inputs ) {
1087- ss << var_pair.first << " , " ;
1088- }
1089- ss << " Outputs: " ;
1090- for (auto & var_pair : ctx.outputs ) {
1091- ss << var_pair.first << " , " ;
1092- }
1093- ss << " )" ;
1094- return ss.str ();
1095- }
1096-
10971084void OperatorWithKernel::RunImpl (const Scope& scope,
10981085 const platform::Place& place) const {
10991086 // To reduce the elapsed time of HasAttr, we use bool variable to record the
@@ -1144,7 +1131,7 @@ void OperatorWithKernel::RunImpl(const Scope& scope,
11441131 // and RCOM backend, the XPU, NPU and MKLDNN will be supported in the second
11451132 // phase
11461133 if (FLAGS_run_pt_kernel &&
1147- pten::KernelFactory::Instance ().ContainsKernel (type_. c_str () )) {
1134+ pten::KernelFactory::Instance ().HasCompatiblePtenKernel (type_)) {
11481135 if (pt_kernel_signature_.get () == nullptr || pt_kernel_.get () == nullptr ) {
11491136 ChoosePtenKernel (exe_ctx);
11501137 }
@@ -1651,10 +1638,9 @@ void OperatorWithKernel::ParseInputDataType(
16511638 if (t != nullptr ) {
16521639 PADDLE_ENFORCE_EQ (
16531640 t->IsInitialized (), true ,
1654- platform::errors::InvalidArgument (
1655- " The Tensor in the %s Op's Input Variable %s(%s) is "
1656- " not initialized." ,
1657- Type (), name, Inputs ().at (name).at (i)));
1641+ platform::errors::InvalidArgument (" The %s Op's Input Variable `%s` "
1642+ " contains uninitialized Tensor." ,
1643+ Type (), name));
16581644 proto::VarType::Type tmp = t->type ();
16591645 PADDLE_ENFORCE (tmp == *data_type || *data_type == default_data_type,
16601646 platform::errors::InvalidArgument (
@@ -1789,8 +1775,6 @@ KernelSignature OperatorWithKernel::GetExpectedPtenKernelArgs(
17891775
17901776pten::KernelContext OperatorWithKernel::BuildPtenKernelContext (
17911777 const RuntimeContext& ctx, const platform::DeviceContext& dev_ctx) const {
1792- VLOG (1 ) << RuntimeContextDebugString (ctx);
1793-
17941778 // TODO(chenweihang): now only work for very simple case,
17951779 // many cases need to be deal with later:
17961780 // 1. the input and output are not tensor
0 commit comments