Reputation: 2205
I noticed that quite a few examples for tensorflow (and answers, here is a random one) include the statement
import tensorflow.python.something
while others use
import tensorflow.something
Looking through the Tensorflow API Reference, I could not find the module python
. What could be the reason to use the tensorflow.python
syntax, and why is it working even though it appears to be undocumented?
Upvotes: 0
Views: 64
Reputation: 998
According to the source code of tensorflow
These symbols appear because we import the python package which in turn imports from tensorflow.core and tensorflow.python. They must come from this module. So python adds these symbols for the resolution to succeed.
From the technical perspective it's valid but an unsafe way to import since it's not documented and it tends to change.
Upvotes: 2