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

AttributeError: module 'tensorflow.python.keras.utils.tf_utils' has no attribute 'smart_cond' #189

Closed
thomastiotto opened this issue Nov 24, 2020 · 1 comment

Comments

@thomastiotto
Copy link

thomastiotto commented Nov 24, 2020

I've been experimenting with the pre-release tensorflow_macos package and, while I've managed to install and import nengo-dl, I'm getting the following error on execution. I seem to remember the same exact error popping up when nengo-dl<3.3.0 and tensorflow==2.3.0 were used in conjunction.
My current setup is the following:

conda list | grep "nengo"
nengo                     3.0.0                    pypi_0    pypi
nengo-dl                  3.3.0                    pypi_0    pypi
pip list | grep "tensorflow"
tensorflow             2.4.0rc2
tensorflow-addons      0.11.2
tensorflow-estimator   2.4.0rc2
tensorflow-macos       0.1a0
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_umd.py", line 197, in runfile
    pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/Users/thomastiotto/PycharmProjects/Learning-to-approximate-functions-using-niobium-doped-strontium-titanate-memristors/experiments/learn_multidimensional_functions.py", line 199, in <module>
    with nengo_dl.Simulator( learned_model_mpes, device=device ) as sim_mpes:
  File "/Users/thomastiotto/opt/anaconda3/envs/tf_mac/lib/python3.8/site-packages/nengo_dl/simulator.py", line 530, in __init__
    self._build_keras(progress)
  File "/Users/thomastiotto/opt/anaconda3/envs/tf_mac/lib/python3.8/site-packages/nengo/utils/magic.py", line 181, in __call__
    return self.wrapper(self.__wrapped__, self.instance, args, kwargs)
  File "/Users/thomastiotto/opt/anaconda3/envs/tf_mac/lib/python3.8/site-packages/nengo_dl/simulator.py", line 57, in with_self
    output = wrapped(*args, **kwargs)
  File "/Users/thomastiotto/opt/anaconda3/envs/tf_mac/lib/python3.8/site-packages/nengo_dl/simulator.py", line 553, in _build_keras
    outputs = self.tensor_graph(inputs, stateful=self.stateful, progress=progress)
  File "/Users/thomastiotto/opt/anaconda3/envs/tf_mac/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py", line 946, in __call__
    return self._functional_construction_call(inputs, args, kwargs,
  File "/Users/thomastiotto/opt/anaconda3/envs/tf_mac/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py", line 1085, in _functional_construction_call
    outputs = self._keras_tensor_symbolic_call(
  File "/Users/thomastiotto/opt/anaconda3/envs/tf_mac/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py", line 817, in _keras_tensor_symbolic_call
    return self._infer_output_signature(inputs, args, kwargs, input_masks)
  File "/Users/thomastiotto/opt/anaconda3/envs/tf_mac/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py", line 858, in _infer_output_signature
    outputs = call_fn(inputs, *args, **kwargs)
  File "/Users/thomastiotto/opt/anaconda3/envs/tf_mac/lib/python3.8/site-packages/tensorflow/python/autograph/impl/api.py", line 620, in wrapper
    return func(*args, **kwargs)
  File "/Users/thomastiotto/opt/anaconda3/envs/tf_mac/lib/python3.8/site-packages/nengo_dl/tensor_graph.py", line 476, in call
    self._build_loop(sub) if self.use_loop else self._build_no_loop(sub)
  File "/Users/thomastiotto/opt/anaconda3/envs/tf_mac/lib/python3.8/site-packages/nengo_dl/tensor_graph.py", line 626, in _build_loop
    loop_vars = tf.while_loop(
  File "/Users/thomastiotto/opt/anaconda3/envs/tf_mac/lib/python3.8/site-packages/tensorflow/python/util/deprecation.py", line 605, in new_func
    return func(*args, **kwargs)
  File "/Users/thomastiotto/opt/anaconda3/envs/tf_mac/lib/python3.8/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2489, in while_loop_v2
    return while_loop(
  File "/Users/thomastiotto/opt/anaconda3/envs/tf_mac/lib/python3.8/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2687, in while_loop
    return while_v2.while_loop(
  File "/Users/thomastiotto/opt/anaconda3/envs/tf_mac/lib/python3.8/site-packages/tensorflow/python/ops/while_v2.py", line 192, in while_loop
    body_graph = func_graph_module.func_graph_from_py_func(
  File "/Users/thomastiotto/opt/anaconda3/envs/tf_mac/lib/python3.8/site-packages/tensorflow/python/framework/func_graph.py", line 990, in func_graph_from_py_func
    func_outputs = python_func(*func_args, **func_kwargs)
  File "/Users/thomastiotto/opt/anaconda3/envs/tf_mac/lib/python3.8/site-packages/tensorflow/python/ops/while_v2.py", line 178, in wrapped_body
    outputs = body(*_pack_sequence_as(orig_loop_vars, args))
  File "/Users/thomastiotto/opt/anaconda3/envs/tf_mac/lib/python3.8/site-packages/nengo_dl/tensor_graph.py", line 603, in loop_body
    loop_i = self._build_inner_loop(loop_i, update_probes, progress)
  File "/Users/thomastiotto/opt/anaconda3/envs/tf_mac/lib/python3.8/site-packages/nengo_dl/tensor_graph.py", line 773, in _build_inner_loop
    side_effects = self.op_builder.build_step(self.signals, progress)
  File "/Users/thomastiotto/opt/anaconda3/envs/tf_mac/lib/python3.8/site-packages/nengo_dl/builder.py", line 101, in build_step
    output = self.op_builds[ops].build_step(signals)
  File "/Users/thomastiotto/opt/anaconda3/envs/tf_mac/lib/python3.8/site-packages/nengo_dl/neuron_builders.py", line 531, in build_step
    self.built_neurons.build_step(signals)
  File "/Users/thomastiotto/opt/anaconda3/envs/tf_mac/lib/python3.8/site-packages/nengo_dl/neuron_builders.py", line 191, in build_step
    tf_utils.smart_cond(
AttributeError: module 'tensorflow.python.keras.utils.tf_utils' has no attribute 'smart_cond'
@drasmuss
Copy link
Member

TensorFlow 2.4.0rc0 moves the location of smart_cond. If you use the current master version of NengoDL it should be compatible with the 2.4 pre-release (pip install git+https://github.com/nengo/nengo-dl). We should also be doing a new NengoDL release in the next day or two that will contain that update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants