提交 087b477e 编写于 作者: 叶剑武

Merge branch 'benchmark-bug' into 'master'

Remove unsed definition in api of mace.h

See merge request !571
...@@ -15,7 +15,6 @@ cc_library( ...@@ -15,7 +15,6 @@ cc_library(
hdrs = ["statistics.h"], hdrs = ["statistics.h"],
copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"], copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"],
deps = [ deps = [
"//mace/kernels",
"//mace/utils", "//mace/utils",
], ],
) )
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include <set> #include <set>
#include "mace/kernels/conv_pool_2d_util.h"
#include "mace/utils/logging.h" #include "mace/utils/logging.h"
#include "mace/utils/string_util.h" #include "mace/utils/string_util.h"
...@@ -39,18 +38,18 @@ std::string MetricToString(const Metric metric) { ...@@ -39,18 +38,18 @@ std::string MetricToString(const Metric metric) {
std::string PaddingTypeToString(int padding_type) { std::string PaddingTypeToString(int padding_type) {
std::stringstream stream; std::stringstream stream;
Padding type = static_cast<Padding>(padding_type); switch (padding_type) {
switch (type) { case 0: stream << "VALID"; break;
case VALID: stream << "VALID"; break; case 1: stream << "SAME"; break;
case SAME: stream << "SAME"; break; case 2: stream << "FULL"; break;
case FULL: stream << "FULL"; break;
default: stream << padding_type; break; default: stream << padding_type; break;
} }
return stream.str(); return stream.str();
} }
std::string ShapeToString(const std::vector<OutputShape> &output_shape) { std::string ShapeToString(
const std::vector<std::vector<int64_t>> &output_shape) {
if (output_shape.empty()) { if (output_shape.empty()) {
return ""; return "";
} }
...@@ -58,9 +57,9 @@ std::string ShapeToString(const std::vector<OutputShape> &output_shape) { ...@@ -58,9 +57,9 @@ std::string ShapeToString(const std::vector<OutputShape> &output_shape) {
std::stringstream stream; std::stringstream stream;
stream << "["; stream << "[";
for (size_t i = 0; i < output_shape.size(); ++i) { for (size_t i = 0; i < output_shape.size(); ++i) {
size_t dims_size = output_shape[i].dims_size(); size_t dims_size = output_shape[i].size();
for (size_t j = 0; j < dims_size; ++j) { for (size_t j = 0; j < dims_size; ++j) {
stream << output_shape[i].dims(j); stream << output_shape[i][j];
if (j != dims_size - 1) { if (j != dims_size - 1) {
stream << ","; stream << ",";
} }
...@@ -176,7 +175,7 @@ std::string OpStat::StatByMetric(const Metric metric, ...@@ -176,7 +175,7 @@ std::string OpStat::StatByMetric(const Metric metric,
} else { } else {
tuple.push_back(VectorToString<int>(record.args.paddings)); tuple.push_back(VectorToString<int>(record.args.paddings));
} }
tuple.push_back(VectorToString<index_t>(record.args.kernels)); tuple.push_back(VectorToString<int64_t>(record.args.kernels));
tuple.push_back(ShapeToString(record.output_shape)); tuple.push_back(ShapeToString(record.output_shape));
tuple.push_back(VectorToString<int>(record.args.dilations)); tuple.push_back(VectorToString<int>(record.args.dilations));
tuple.push_back(record.name); tuple.push_back(record.name);
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "mace/kernels/conv_pool_2d_util.h" #include "mace/public/mace.h"
#include "mace/utils/string_util.h" #include "mace/utils/string_util.h"
namespace mace { namespace mace {
...@@ -142,7 +142,7 @@ class OpStat{ ...@@ -142,7 +142,7 @@ class OpStat{
struct Record{ struct Record{
std::string name; std::string name;
std::string type; std::string type;
std::vector<OutputShape> output_shape; std::vector<std::vector<int64_t>> output_shape;
ConvPoolArgs args; ConvPoolArgs args;
int64_t order; int64_t order;
TimeInfo<int64_t> start; TimeInfo<int64_t> start;
......
...@@ -108,9 +108,13 @@ MaceStatus SerialNet::Run(RunMetadata *run_metadata) { ...@@ -108,9 +108,13 @@ MaceStatus SerialNet::Run(RunMetadata *run_metadata) {
} }
} }
std::vector<std::vector<int64_t>> output_shapes;
for (auto output_shape : op->debug_def().output_shape()) {
output_shapes.push_back({output_shape.dims().begin(),
output_shape.dims().end()});
}
OperatorStats op_stats = {op->debug_def().name(), op->debug_def().type(), OperatorStats op_stats = {op->debug_def().name(), op->debug_def().type(),
{op->debug_def().output_shape().begin(), output_shapes,
op->debug_def().output_shape().end()},
{strides, padding_type, paddings, dilations, {strides, padding_type, paddings, dilations,
kernels}, call_stats}; kernels}, call_stats};
run_metadata->op_stats.emplace_back(op_stats); run_metadata->op_stats.emplace_back(op_stats);
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
namespace mace { namespace mace {
class OutputShape;
class NetDef; class NetDef;
enum DeviceType { CPU = 0, GPU = 2, HEXAGON = 3 }; enum DeviceType { CPU = 0, GPU = 2, HEXAGON = 3 };
...@@ -47,7 +46,7 @@ struct ConvPoolArgs { ...@@ -47,7 +46,7 @@ struct ConvPoolArgs {
struct OperatorStats { struct OperatorStats {
std::string operator_name; std::string operator_name;
std::string type; std::string type;
std::vector<OutputShape> output_shape; std::vector<std::vector<int64_t>> output_shape;
ConvPoolArgs args; ConvPoolArgs args;
CallStats stats; CallStats stats;
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册