Is there a way to check which protobuf implementation is used by TensorFlow (i.e. if it is using the C++ version or the Python one)?
@keveman's answer tells us the default implementation but not the active implementation.
Importantly, the PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION
environment variable affects which implementation is active so
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp python -c "from google.protobuf.internal import api_implementation; print(api_implementation._default_implementation_type)"
and
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python python -c "from google.protobuf.internal import api_implementation; print(api_implementation._default_implementation_type)"
will always show the same result.
To see which implementation is active, use this instead:
python -c "from google.protobuf.internal import api_implementation; print(api_implementation.Type())"
Changing the PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION
environment variable will cause the result of Type()
to change where it didn't for _default_implementation_type
.
Try the following :
$ python -c "from google.protobuf.internal import api_implementation; print(api_implementation._default_implementation_type)"
It should print either python
or cpp
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With