提交 198344e7 编写于 作者: L Liangliang He

Minor fixes about logging and const tensor interface

上级 751fd049
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
namespace mace { namespace mace {
ConstTensor::ConstTensor(const std::string &name, ConstTensor::ConstTensor(const std::string &name,
unsigned char *data, const unsigned char *data,
const std::vector<int64_t> &dims, const std::vector<int64_t> &dims,
const DataType data_type, const DataType data_type,
uint32_t node_id) : uint32_t node_id) :
...@@ -23,7 +23,7 @@ ConstTensor::ConstTensor(const std::string &name, ...@@ -23,7 +23,7 @@ ConstTensor::ConstTensor(const std::string &name,
node_id_(node_id) {} node_id_(node_id) {}
ConstTensor::ConstTensor(const std::string &name, ConstTensor::ConstTensor(const std::string &name,
unsigned char *data, const unsigned char *data,
const std::vector<int64_t> &dims, const std::vector<int64_t> &dims,
const int data_type, const int data_type,
uint32_t node_id) : uint32_t node_id) :
......
...@@ -22,7 +22,7 @@ SimpleNet::SimpleNet(const std::shared_ptr<const OperatorRegistry> op_registry, ...@@ -22,7 +22,7 @@ SimpleNet::SimpleNet(const std::shared_ptr<const OperatorRegistry> op_registry,
const NetMode mode) const NetMode mode)
: NetBase(op_registry, net_def, ws, type), : NetBase(op_registry, net_def, ws, type),
device_type_(type) { device_type_(type) {
VLOG(1) << "Constructing SimpleNet " << net_def->name(); MACE_LATENCY_LOGGER(1, "Constructing SimpleNet ", net_def->name());
for (int idx = 0; idx < net_def->op_size(); ++idx) { for (int idx = 0; idx < net_def->op_size(); ++idx) {
const auto &operator_def = net_def->op(idx); const auto &operator_def = net_def->op(idx);
VLOG(3) << "Creating operator " << operator_def.name() << "(" VLOG(3) << "Creating operator " << operator_def.name() << "("
...@@ -41,10 +41,8 @@ bool SimpleNet::Run(RunMetadata *run_metadata) { ...@@ -41,10 +41,8 @@ bool SimpleNet::Run(RunMetadata *run_metadata) {
MACE_LATENCY_LOGGER(1, "Running net"); MACE_LATENCY_LOGGER(1, "Running net");
for (auto iter = operators_.begin(); iter != operators_.end(); ++iter) { for (auto iter = operators_.begin(); iter != operators_.end(); ++iter) {
auto &op = *iter; auto &op = *iter;
VLOG(3) << "Running operator " << op->debug_def().name() << "(" MACE_LATENCY_LOGGER(2, "Running operator ", op->debug_def().name(),
<< op->debug_def().type() << ")."; "(", op->debug_def().type(), ")");
MACE_LATENCY_LOGGER(2, "Running operator ", op->debug_def().name());
bool future_wait = (device_type_ == DeviceType::OPENCL && bool future_wait = (device_type_ == DeviceType::OPENCL &&
(run_metadata != nullptr || (run_metadata != nullptr ||
std::distance(iter, operators_.end()) == 1)); std::distance(iter, operators_.end()) == 1));
......
...@@ -74,11 +74,11 @@ void Workspace::LoadModelTensor(const NetDef &net_def, DeviceType type) { ...@@ -74,11 +74,11 @@ void Workspace::LoadModelTensor(const NetDef &net_def, DeviceType type) {
Serializer serializer; Serializer serializer;
for (auto &tensor_proto : net_def.tensors()) { for (auto &tensor_proto : net_def.tensors()) {
MACE_LATENCY_LOGGER(2, "Load tensor ", tensor_proto.name()); MACE_LATENCY_LOGGER(2, "Load tensor ", tensor_proto.name());
VLOG(3) << "Load tensor: " << tensor_proto.name() VLOG(3) << "Tensor name: " << tensor_proto.name()
<< ", with data type: " << tensor_proto.data_type() << ", data type: " << tensor_proto.data_type()
<< ", has shape: " << ", shape: "
<< MakeString(std::vector<index_t>(tensor_proto.dims().begin(), << MakeString(std::vector<index_t>(tensor_proto.dims().begin(),
tensor_proto.dims().end())); tensor_proto.dims().end()));
tensor_map_[tensor_proto.name()] = tensor_map_[tensor_proto.name()] =
serializer.Deserialize(tensor_proto, type); serializer.Deserialize(tensor_proto, type);
} }
......
...@@ -73,12 +73,12 @@ enum DataType { ...@@ -73,12 +73,12 @@ enum DataType {
class ConstTensor { class ConstTensor {
public: public:
ConstTensor(const std::string &name, ConstTensor(const std::string &name,
unsigned char *data, const unsigned char *data,
const std::vector<int64_t> &dims, const std::vector<int64_t> &dims,
const DataType data_type = DT_FLOAT, const DataType data_type = DT_FLOAT,
uint32_t node_id = 0); uint32_t node_id = 0);
ConstTensor(const std::string &name, ConstTensor(const std::string &name,
unsigned char *data, const unsigned char *data,
const std::vector<int64_t> &dims, const std::vector<int64_t> &dims,
const int data_type, const int data_type,
uint32_t node_id = 0); uint32_t node_id = 0);
......
...@@ -113,6 +113,7 @@ class LatencyLogger { ...@@ -113,6 +113,7 @@ class LatencyLogger {
: vlog_level_(vlog_level), message_(message) { : vlog_level_(vlog_level), message_(message) {
if (VLOG_IS_ON(vlog_level_)) { if (VLOG_IS_ON(vlog_level_)) {
start_micros_ = NowMicros(); start_micros_ = NowMicros();
VLOG(vlog_level_) << message_ << " started";
} }
} }
~LatencyLogger() { ~LatencyLogger() {
......
...@@ -161,8 +161,10 @@ rm -rf ${EXPORT_LIB_DIR} ...@@ -161,8 +161,10 @@ rm -rf ${EXPORT_LIB_DIR}
mkdir -p ${EXPORT_LIB_DIR} mkdir -p ${EXPORT_LIB_DIR}
cp ${MACE_SOURCE_DIR}/mace/public/*.h ${EXPORT_INCLUDE_DIR}/mace/public/ || exit 1 cp ${MACE_SOURCE_DIR}/mace/public/*.h ${EXPORT_INCLUDE_DIR}/mace/public/ || exit 1
# utils is noti part of public API # utils is not part of public API
cp ${MACE_SOURCE_DIR}/mace/utils/*.h ${EXPORT_INCLUDE_DIR}/mace/utils/ || exit 1 cp ${MACE_SOURCE_DIR}/mace/utils/env_time.h ${EXPORT_INCLUDE_DIR}/mace/utils/ || exit 1
cp ${MACE_SOURCE_DIR}/mace/utils/logging.h ${EXPORT_INCLUDE_DIR}/mace/utils/ || exit 1
cp ${MACE_SOURCE_DIR}/mace/utils/string_util.h ${EXPORT_INCLUDE_DIR}/mace/utils/ || exit 1
cp ${LIBMACE_TEMP_DIR}/libmace.a ${LIBMACE_TEMP_DIR}/libmace_dev.a ${LIBMACE_TEMP_DIR}/libmace_prod.a ${EXPORT_LIB_DIR}/ || exit 1 cp ${LIBMACE_TEMP_DIR}/libmace.a ${LIBMACE_TEMP_DIR}/libmace_dev.a ${LIBMACE_TEMP_DIR}/libmace_prod.a ${EXPORT_LIB_DIR}/ || exit 1
echo "Step 6: Remove temporary file" echo "Step 6: Remove temporary file"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册