Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix printf format string for int_32t #80

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/tracing.h
Original file line number Diff line number Diff line change
Expand Up @@ -651,10 +651,10 @@ if (COND) { \
} \
if (__TRACE_COND(LEVEL)) { \
__VAR(LEVEL, "TENSOR", TENSOR->name, " \"%s\"\n"); \
__VAR(LEVEL, "TENSOR", TENSOR->data_type, " %d") \
__VAR(LEVEL, "TENSOR", TENSOR->data_type, " %d" PRId32) \
if ((TENSOR->data_type) >= _n_tensor_types) { \
__PRINT(TRACE_SYMBOL_STDOUT, " (%s)\n", _tensor_types[0]) \
__BOUND_ERROR(0, TENSOR->data_type, 0, _n_tensor_types, "%d") \
__BOUND_ERROR(0, TENSOR->data_type, 0, _n_tensor_types, "%d" PRId32) \
__ERROR(0, "unknown data type") \
} else { \
__PRINT(TRACE_SYMBOL_STDOUT, " (%s)\n", \
Expand Down
2 changes: 1 addition & 1 deletion src/connxr.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ int main(int argc, char **argv){
//debug_prettyprint_model(model);
convertRawDataOfTensorProto(inp0set0);

printf("values = %d\n", inp0set0->data_type);
printf("values = %" PRId32 "\n", inp0set0->data_type);

inp0set0->name = model->graph->input[0]->name;

Expand Down
6 changes: 3 additions & 3 deletions src/test/test_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ int compareAlmostEqualTensorProto(Onnx__TensorProto *a, Onnx__TensorProto *b)
TRACE_LEVEL1("Asserting tensors with name: %s, %s\n", a->name, b->name);

ASSERT_TRUE(a->data_type == b->data_type);
TRACE_LEVEL1("data_type: %d,%d ok\n", a->data_type, b->data_type);
TRACE_LEVEL1("data_type: %" PRId32 ",%" PRId32 " ok\n", a->data_type, b->data_type);

ASSERT_TRUE(a->n_dims == b->n_dims);
TRACE_LEVEL1("n_dims: %zu,%zu ok\n", a->n_dims, b->n_dims);
Expand Down Expand Up @@ -50,7 +50,7 @@ int compareAlmostEqualTensorProto(Onnx__TensorProto *a, Onnx__TensorProto *b)
ASSERT_TRUE(a->n_int32_data == b->n_int32_data);
for(int i = 0; i < a->n_int32_data; i++)
{
TRACE_LEVEL1("ASSERTING EQUAL: %d, %d\n", a->int32_data[i], b->int32_data[i]);
TRACE_LEVEL1("ASSERTING EQUAL: %" PRId32 ", %" PRId32 "\n", a->int32_data[i], b->int32_data[i]);
ASSERT_TRUE(a->int32_data[i] == b->int32_data[i]);
}
break;
Expand All @@ -68,7 +68,7 @@ int compareAlmostEqualTensorProto(Onnx__TensorProto *a, Onnx__TensorProto *b)
ASSERT_TRUE(a->n_int32_data == b->n_int32_data);
for(int i = 0; i < a->n_int32_data; i++)
{
TRACE_LEVEL1("ASSERTING EQUAL: %d, %d\n", a->int32_data[i], b->int32_data[i]);
TRACE_LEVEL1("ASSERTING EQUAL: %" PRId32 ", %" PRId32 "\n", a->int32_data[i], b->int32_data[i]);
ASSERT_TRUE(a->int32_data[i] == b->int32_data[i]);
}
break;
Expand Down
6 changes: 3 additions & 3 deletions src/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ void Debug_PrintModelInformation( Onnx__ModelProto *model)
for (int i = 0; i < model->graph->n_input; i++) {
TRACE_LEVEL0("model->graph->input[%d]->name %s\n", i, model->graph->input[i]->name);
TRACE_LEVEL0("model->graph->input[%d]->type->tensor_type->has_elem_type %d\n", i, model->graph->input[i]->type->tensor_type->has_elem_type);
TRACE_LEVEL0("model->graph->input[%d]->type->tensor_type->elem_type %d\n", i, model->graph->input[i]->type->tensor_type->elem_type);
TRACE_LEVEL0("model->graph->input[%d]->type->tensor_type->elem_type %" PRId32 "\n", i, model->graph->input[i]->type->tensor_type->elem_type);
TRACE_LEVEL0("model->graph->input[%d]->type->tensor_type->shape->n_dim %zu\n", i, model->graph->input[i]->type->tensor_type->shape->n_dim);

// TODO With some models this crashes
Expand Down Expand Up @@ -237,7 +237,7 @@ void Debug_PrintTensorProto(Onnx__TensorProto *tp)
TRACE_LEVEL0("dims[%d]=%" PRId64 "\n", i, tp->dims[i]);
}
TRACE_LEVEL0("has_data_type = %d\n", tp->has_data_type);
TRACE_LEVEL0("data_type = %d\n", tp->data_type);
TRACE_LEVEL0("data_type = %" PRId32 "\n", tp->data_type);

// TODO segment

Expand Down Expand Up @@ -419,4 +419,4 @@ void debug_prettyprint_model(Onnx__ModelProto *model)
//TRACE_LEVEL0(" attribute[%d]->type %d\n", j, model->graph->node[i]->attribute[j]->type);
}
}
}
}