diff --git a/mace/core/mace.cc b/mace/core/mace.cc index 83729b79121c90232cc336b9437ed95ed7d3b6e0..3e0d642f8affcdf541d016519d063991636156cc 100644 --- a/mace/core/mace.cc +++ b/mace/core/mace.cc @@ -10,7 +10,7 @@ namespace mace { ConstTensor::ConstTensor(const std::string &name, - unsigned char *data, + const unsigned char *data, const std::vector &dims, const DataType data_type, uint32_t node_id) : @@ -23,7 +23,7 @@ ConstTensor::ConstTensor(const std::string &name, node_id_(node_id) {} ConstTensor::ConstTensor(const std::string &name, - unsigned char *data, + const unsigned char *data, const std::vector &dims, const int data_type, uint32_t node_id) : diff --git a/mace/core/net.cc b/mace/core/net.cc index 1dcef048cf8b0ec53863da471b23bcf7df74720f..46febc68122d4579cc3d44fada8df2a12f968a58 100644 --- a/mace/core/net.cc +++ b/mace/core/net.cc @@ -22,7 +22,7 @@ SimpleNet::SimpleNet(const std::shared_ptr op_registry, const NetMode mode) : NetBase(op_registry, net_def, ws, 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) { const auto &operator_def = net_def->op(idx); VLOG(3) << "Creating operator " << operator_def.name() << "(" @@ -41,10 +41,8 @@ bool SimpleNet::Run(RunMetadata *run_metadata) { MACE_LATENCY_LOGGER(1, "Running net"); for (auto iter = operators_.begin(); iter != operators_.end(); ++iter) { auto &op = *iter; - VLOG(3) << "Running operator " << op->debug_def().name() << "(" - << op->debug_def().type() << ")."; - MACE_LATENCY_LOGGER(2, "Running operator ", op->debug_def().name()); - + MACE_LATENCY_LOGGER(2, "Running operator ", op->debug_def().name(), + "(", op->debug_def().type(), ")"); bool future_wait = (device_type_ == DeviceType::OPENCL && (run_metadata != nullptr || std::distance(iter, operators_.end()) == 1)); diff --git a/mace/core/workspace.cc b/mace/core/workspace.cc index 2cf55a3b0548bb350a320f1a04f8196946ccd50f..29491e0fd63aa002892e151b588935083d6f163b 100644 --- a/mace/core/workspace.cc +++ b/mace/core/workspace.cc @@ -74,11 +74,11 @@ void Workspace::LoadModelTensor(const NetDef &net_def, DeviceType type) { Serializer serializer; for (auto &tensor_proto : net_def.tensors()) { MACE_LATENCY_LOGGER(2, "Load tensor ", tensor_proto.name()); - VLOG(3) << "Load tensor: " << tensor_proto.name() - << ", with data type: " << tensor_proto.data_type() - << ", has shape: " + VLOG(3) << "Tensor name: " << tensor_proto.name() + << ", data type: " << tensor_proto.data_type() + << ", shape: " << MakeString(std::vector(tensor_proto.dims().begin(), - tensor_proto.dims().end())); + tensor_proto.dims().end())); tensor_map_[tensor_proto.name()] = serializer.Deserialize(tensor_proto, type); } diff --git a/mace/public/mace.h b/mace/public/mace.h index ab91e4c7592e862f2abbc540b5dca0884417a3e1..591987cb9eb0740b790dffb8f2b519adb17e887f 100644 --- a/mace/public/mace.h +++ b/mace/public/mace.h @@ -73,12 +73,12 @@ enum DataType { class ConstTensor { public: ConstTensor(const std::string &name, - unsigned char *data, + const unsigned char *data, const std::vector &dims, const DataType data_type = DT_FLOAT, uint32_t node_id = 0); ConstTensor(const std::string &name, - unsigned char *data, + const unsigned char *data, const std::vector &dims, const int data_type, uint32_t node_id = 0); diff --git a/mace/utils/logging.h b/mace/utils/logging.h index 6dc5658c40da3f85d210cf56dde530dbfcc2239c..592831580f850a22adac6d50e2ddfb3cf0bdbf0b 100644 --- a/mace/utils/logging.h +++ b/mace/utils/logging.h @@ -113,6 +113,7 @@ class LatencyLogger { : vlog_level_(vlog_level), message_(message) { if (VLOG_IS_ON(vlog_level_)) { start_micros_ = NowMicros(); + VLOG(vlog_level_) << message_ << " started"; } } ~LatencyLogger() { diff --git a/tools/export_lib.sh b/tools/export_lib.sh index 119dfa1513025b337503d99f85ce82f4b7e023e6..a178c118f85a4843b534559445f5cf1bbde80c80 100755 --- a/tools/export_lib.sh +++ b/tools/export_lib.sh @@ -161,8 +161,10 @@ rm -rf ${EXPORT_LIB_DIR} mkdir -p ${EXPORT_LIB_DIR} cp ${MACE_SOURCE_DIR}/mace/public/*.h ${EXPORT_INCLUDE_DIR}/mace/public/ || exit 1 -# utils is noti part of public API -cp ${MACE_SOURCE_DIR}/mace/utils/*.h ${EXPORT_INCLUDE_DIR}/mace/utils/ || exit 1 +# utils is not part of public API +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 echo "Step 6: Remove temporary file"