diff --git a/mace/python/tools/operator.jinja2 b/mace/python/tools/operator.jinja2 index 8ef5bbfc54355724e4f79a301564af5cb3cec416..c1cea9a6837f96e5f4a8702d8dd44cf1363860df 100644 --- a/mace/python/tools/operator.jinja2 +++ b/mace/python/tools/operator.jinja2 @@ -64,7 +64,8 @@ namespace {{tag}} { {% for i in range(start, end) %} void CreateOperator{{i}}(mace::OperatorDef *op) { - MACE_LATENCY_LOGGER(2, "Create operator {{ net.op[i].name }}"); + MACE_LATENCY_LOGGER(2, "Create operator", + {{ net.op[i].name|default("undefined")|tojson }}); mace::Argument *arg = nullptr; op->mutable_arg()->Reserve({{ net.op[i].arg|length }}); diff --git a/mace/python/tools/str2vec_maps.cc.jinja2 b/mace/python/tools/str2vec_maps.cc.jinja2 index d88347172d0dd4f50d382a7c7598723db151f2e1..ebb27b3850ea935ed9125f656d871e5a540e3399 100644 --- a/mace/python/tools/str2vec_maps.cc.jinja2 +++ b/mace/python/tools/str2vec_maps.cc.jinja2 @@ -25,10 +25,10 @@ namespace {{tag}} { const std::map {{variable_name}} = { {% for key, encrypted_code in maps.items() %} { - "{{key}}", { + {{key|tojson}}, { { {%- for header in encrypted_code['headers'] -%} - "{{header}}", + {{header|tojson}}, {%- endfor -%} }, { diff --git a/tools/python/template/model.jinja2 b/tools/python/template/model.jinja2 index 494b09860c72631aba45f0390c465c7687a69278..68247fd2380d881fa33138b372775c81b185a173 100644 --- a/tools/python/template/model.jinja2 +++ b/tools/python/template/model.jinja2 @@ -134,7 +134,7 @@ void CreateTensors(NetDef *net_def) { namespace {{tag}} { MACE_API const std::shared_ptr CreateNet() { - MACE_LATENCY_LOGGER(1, "Create net {{ net.name }}"); + MACE_LATENCY_LOGGER(1, "Create net ", {{ net.name|default("undefined")|tojson }}); std::shared_ptr net_def(new NetDef()); diff --git a/tools/python/template/operator.jinja2 b/tools/python/template/operator.jinja2 index 8ef5bbfc54355724e4f79a301564af5cb3cec416..c899f3f3c085611af557f812fe8094dcbf1c6fbe 100644 --- a/tools/python/template/operator.jinja2 +++ b/tools/python/template/operator.jinja2 @@ -64,7 +64,8 @@ namespace {{tag}} { {% for i in range(start, end) %} void CreateOperator{{i}}(mace::OperatorDef *op) { - MACE_LATENCY_LOGGER(2, "Create operator {{ net.op[i].name }}"); + MACE_LATENCY_LOGGER(2, "Create operator ", + {{ net.op[i].name|default("undefined")|tojson }}); mace::Argument *arg = nullptr; op->mutable_arg()->Reserve({{ net.op[i].arg|length }}); diff --git a/tools/python/template/tensor_source.jinja2 b/tools/python/template/tensor_source.jinja2 index f281e88a3ab652657101470a602d8794400e7b6c..ccbc55784fe6d0d2acd2d611ade866ae3891ed83 100644 --- a/tools/python/template/tensor_source.jinja2 +++ b/tools/python/template/tensor_source.jinja2 @@ -23,7 +23,8 @@ namespace mace { namespace {{tag}} { void CreateTensor{{tensor_id}}(mace::ConstTensor *const_tensor) { - MACE_LATENCY_LOGGER(2, "Create tensor {{ tensor.name }}"); + MACE_LATENCY_LOGGER(2, "Create tensor ", + {{ tensor.name|default("undefined")|tojson }}); const_tensor->set_name({{ tensor.name|tojson }}); const_tensor->set_offset({{ tensor.offset }}); const_tensor->set_data_size({{ tensor.data_size }});