未验证 提交 9619443b 编写于 作者: Y Yuanle Liu 提交者: GitHub

[BugFix] Replace include dense_tensor.h with forward declare in phi lib (#55396)

* copy dense_tensor.h to inference lib

* update

* update
上级 78a4e3fd
...@@ -157,7 +157,7 @@ void ConstantFoldingPass::ApplyImpl(ir::Graph *graph) const { ...@@ -157,7 +157,7 @@ void ConstantFoldingPass::ApplyImpl(ir::Graph *graph) const {
} }
delete local_scope; delete local_scope;
} }
LOG(INFO) << folded_op_num << " Ops are folded"; AddStatis(folded_op_num);
} }
} // namespace ir } // namespace ir
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "paddle/extension.h" // For pr test!
#include "paddle_inference_api.h" // NOLINT #include "paddle_inference_api.h" // NOLINT
namespace paddle { namespace paddle {
...@@ -83,6 +84,8 @@ void CheckOutput(const std::string& referfile, ...@@ -83,6 +84,8 @@ void CheckOutput(const std::string& referfile,
auto refer = ProcessALine(line); auto refer = ProcessALine(line);
file.close(); file.close();
paddle::Tensor dummy;
size_t numel = output.data.length() / PaddleDtypeSize(output.dtype); size_t numel = output.data.length() / PaddleDtypeSize(output.dtype);
VLOG(3) << "predictor output numel " << numel; VLOG(3) << "predictor output numel " << numel;
VLOG(3) << "reference output numel " << refer.data.size(); VLOG(3) << "reference output numel " << refer.data.size();
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#pragma once #pragma once
#include <cassert>
#include <cstdint> #include <cstdint>
#include <limits> #include <limits>
#include <sstream> #include <sstream>
...@@ -21,11 +22,11 @@ ...@@ -21,11 +22,11 @@
#include "paddle/phi/api/ext/exception.h" #include "paddle/phi/api/ext/exception.h"
#include "paddle/phi/common/data_type.h" #include "paddle/phi/common/data_type.h"
#include "paddle/phi/core/dense_tensor.h"
#include "paddle/phi/core/enforce.h"
namespace phi { namespace phi {
class DenseTensor;
// In static model pre analysis, we can't get the data from tensor // In static model pre analysis, we can't get the data from tensor
class TensorRef { class TensorRef {
public: public:
...@@ -34,8 +35,7 @@ class TensorRef { ...@@ -34,8 +35,7 @@ class TensorRef {
explicit TensorRef(const DenseTensor* base) : tensor_base_(base) {} explicit TensorRef(const DenseTensor* base) : tensor_base_(base) {}
const DenseTensor* Get() const { const DenseTensor* Get() const {
PADDLE_ENFORCE_NOT_NULL(tensor_base_, assert(tensor_base_ != nullptr);
"Can not get null ptr from Tensor ref scalar");
return tensor_base_; return tensor_base_;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册