提交 d70c9780 编写于 作者: L liuqi

Move RunMetadata to public api for benchmarking model.

上级 3f803f84
......@@ -11,20 +11,7 @@
namespace mace {
struct CallStats {
int64_t start_micros;
int64_t end_micros;
};
struct OperatorStats {
std::string operator_name;
std::string type;
CallStats stats;
};
struct RunMetadata {
std::vector<OperatorStats> op_stats;
};
class CallStats;
// Wait the call to finish and get the stats if param is not nullptr
struct StatsFuture {
......
......@@ -558,7 +558,8 @@ MaceEngine::~MaceEngine() {
};
bool MaceEngine::Run(const float *input,
const std::vector<index_t> &input_shape,
float *output) {
float *output,
RunMetadata *run_metadata) {
MACE_CHECK(output != nullptr, "output ptr cannot be NULL");
Tensor *input_tensor = ws_->GetTensor("mace_input_node:0");
Tensor *output_tensor = ws_->GetTensor("mace_output_node:0");
......@@ -571,7 +572,7 @@ bool MaceEngine::Run(const float *input,
if (device_type_ == HEXAGON) {
hexagon_controller_->ExecuteGraph(*input_tensor, output_tensor);
} else {
if (!net_->Run()) {
if (!net_->Run(run_metadata)) {
LOG(FATAL) << "Net run failed";
}
}
......
......@@ -3,7 +3,6 @@
//
#include "mace/core/net.h"
#include "mace/core/workspace.h"
#include "mace/utils/utils.h"
#include "mace/utils/memory_logging.h"
......
......@@ -334,6 +334,22 @@ class NetDef {
uint32_t has_bits_;
};
struct CallStats {
int64_t start_micros;
int64_t end_micros;
};
struct OperatorStats {
std::string operator_name;
std::string type;
CallStats stats;
};
struct RunMetadata {
std::vector<OperatorStats> op_stats;
};
class Workspace;
class NetBase;
class OperatorRegistry;
......@@ -346,7 +362,8 @@ class MaceEngine {
~MaceEngine();
bool Run(const float *input,
const std::vector<int64_t> &input_shape,
float *output);
float *output,
RunMetadata *run_metadata = nullptr);
MaceEngine(const MaceEngine &) = delete;
MaceEngine &operator=(const MaceEngine &) = delete;
......
......@@ -8,11 +8,9 @@
#include <mutex>
#include "mace/core/runtime/opencl/opencl_runtime.h"
#include "mace/utils/logging.h"
#include "mace/core/public/mace.h"
#include "mace/utils/tuner.h"
#include <CL/opencl.h>
namespace mace {
namespace {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册