2

when I use "import as" like

import tensorflow.python.ops.control_flow_ops as ass

I get "AttributeError: module 'tensorflow' has no attribute 'python'"

but code below like

import tensorflow.python.ops.control_flow_ops

works fine

env: python 3.6.3 + tensorflow 1.3.0

devforma
  • 23
  • 2

1 Answers1

1

This is an unfortunate combination of TensorFlow's interface sealing (e.g. removing tf.python symbol visibility from import tensorflow as tf) and Python import semantics. The import tensorflow... as syntax will only access public TensorFlow symbols, while from tensorflow... import ... as can also access private symbols with no API stability guarantees.

Allen Lavoie
  • 5,778
  • 1
  • 17
  • 26