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