Skip to content

Locale issue in profiler/trace logger #4992

Open
@mvieth

Description

@mvieth

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): yes, but bug is not in custom code
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 20.04.2
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: no
  • TensorFlow installed from (source or binary): pip3
  • TensorFlow version (use command below): v2.4.0-49-g85c8b2a817f 2.4.1
  • Python version: 3.8.5
  • Bazel version (if compiling from source): no
  • GCC/Compiler version (if compiling from source): no
  • CUDA/cuDNN version: -
  • GPU model and memory: -

Describe the current behavior
The trace.json written by the TensorBoard callback is locale dependent. Example that was written while a German locale was set:

"ts":45,805999999999997,"dur":318,03199999999998

Describe the expected behavior
The decimal commas should be decimal points to comply with the JSON syntax.
I believe that snprintf here should write a decimal point, no matter which locale is set.
Also for reference: MaxPrecision is called from here, and PicosToMicrosString is called from here.

As a side note, it is unnecessary to write so many digits/decimal places. Looking at PicosToMicros, there can be no more than six non-zero digits after the decimal point, in my example above seemingly only three.

Contributing

  • Do you want to contribute a PR? (yes/no): inclined to contribute, but don't know enough about tensorflow to know what solution would be best
  • Briefly describe your candidate solution (if contributing): not sure

Standalone code to reproduce the issue
This example should reproduce the issue if a locale without decimal point is set.

Thank you!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions