Hi,
When trying to run the tutorial code, I get an error in the line:
results = pde.core.integrate.integrate_times(
model=pde.core.models.FiniteDifferenceModel(equation,grid),
state=initial_state,
times=times, axis=0)
The error that I get is (I will also send it to the AutoGraph team as they requested) :
W0717 14:24:34.494019 140735880733568 ag_logging.py:145] Entity <function integrate_steps..advance_until_saved_step at 0xb4026f378> could not be transformed and will be executed as-is. Please report this to the AutgoGraph team. When filing the bug, set the verbosity to 10 (on Linux, export AUTOGRAPH_VERBOSITY=10
) and attach the full output. Cause: converting <function integrate_steps..advance_until_saved_step at 0xb4026f378>: ValueError: inconsistent nodes: None (NoneType) and None (NoneType)
WARNING: Entity <function integrate_steps..advance_until_saved_step at 0xb4026f378> could not be transformed and will be executed as-is. Please report this to the AutgoGraph team. When filing the bug, set the verbosity to 10 (on Linux, export AUTOGRAPH_VERBOSITY=10
) and attach the full output. Cause: converting <function integrate_steps..advance_until_saved_step at 0xb4026f378>: ValueError: inconsistent nodes: None (NoneType) and None (NoneType)
TypeError Traceback (most recent call last)
in
1 time_step = equation.get_time_step(grid)
2 times = time_step*np.arange(400)
----> 3 results = pde.core.integrate.integrate_times(model=pde.core.models.FiniteDifferenceModel(equation,grid), state=initial_state,times=times, axis=0)
~/Dropbox/MIT/projects/burgers_theta_updated/pde_superresolution_2d/datadrivenpdes/core/integrate.py in integrate_times(model, state, times, initial_time, axis, xla_compile)
133 'time step {}: {}'.format(times, dt, approx_steps))
134
--> 135 return integrate_steps(model, state, steps, initial_time, axis, xla_compile)
~/Dropbox/MIT/projects/burgers_theta_updated/pde_superresolution_2d/datadrivenpdes/core/integrate.py in integrate_steps(failed resolving arguments)
88 starts = tf.concat([[0], steps[:-1]], axis=0)
89 integrated = tf.scan(advance_until_saved_step, [starts, steps],
---> 90 initializer=evolving_state)
91
92 integrated_constants = nest.map_structure(
~/anaconda3/envs/pde_TF/lib/python3.7/site-packages/tensorflow/python/ops/functional_ops.py in scan(fn, elems, initializer, parallel_iterations, back_prop, swap_memory, infer_shape, reverse, name)
503 back_prop=back_prop,
504 swap_memory=swap_memory,
--> 505 maximum_iterations=n)
506
507 results_flat = [r.stack() for r in r_a]
~/anaconda3/envs/pde_TF/lib/python3.7/site-packages/tensorflow/python/ops/control_flow_ops.py in while_loop(cond, body, loop_vars, shape_invariants, parallel_iterations, back_prop, swap_memory, name, maximum_iterations, return_same_structure)
3461
3462 while cond(*loop_vars):
-> 3463 loop_vars = body(*loop_vars)
3464 if try_to_pack and not isinstance(loop_vars, (list, _basetuple)):
3465 packed = True
~/anaconda3/envs/pde_TF/lib/python3.7/site-packages/tensorflow/python/ops/control_flow_ops.py in (i, lv)
3454 cond = lambda i, lv: ( # pylint: disable=g-long-lambda
3455 math_ops.logical_and(i < maximum_iterations, orig_cond(*lv)))
-> 3456 body = lambda i, lv: (i + 1, orig_body(*lv))
3457
3458 if executing_eagerly:
~/anaconda3/envs/pde_TF/lib/python3.7/site-packages/tensorflow/python/ops/functional_ops.py in compute(i, a_flat, tas)
480 packed_elems = input_pack([elem_ta.read(i) for elem_ta in elems_ta])
481 packed_a = output_pack(a_flat)
--> 482 a_out = fn(packed_a, packed_elems)
483 nest.assert_same_structure(elems if initializer is None else initializer,
484 a_out)
~/anaconda3/envs/pde_TF/lib/python3.7/site-packages/tensorflow/python/eager/def_function.py in call(self, *args, **kwds)
412 # This is the first call of call, so we have to initialize.
413 initializer_map = {}
--> 414 self._initialize(args, kwds, add_initializers_to=initializer_map)
415 if self._created_variables:
416 try:
~/anaconda3/envs/pde_TF/lib/python3.7/site-packages/tensorflow/python/eager/def_function.py in _initialize(self, args, kwds, add_initializers_to)
355 self._concrete_stateful_fn = (
356 self._stateful_fn._get_concrete_function_internal_garbage_collected( # pylint: disable=protected-access
--> 357 *args, **kwds))
358
359 def invalid_creator_scope(*unused_args, **unused_kwds):
~/anaconda3/envs/pde_TF/lib/python3.7/site-packages/tensorflow/python/eager/function.py in _get_concrete_function_internal_garbage_collected(self, *args, **kwargs)
1347 if self.input_signature:
1348 args, kwargs = None, None
-> 1349 graph_function, _, _ = self._maybe_define_function(args, kwargs)
1350 return graph_function
1351
~/anaconda3/envs/pde_TF/lib/python3.7/site-packages/tensorflow/python/eager/function.py in _maybe_define_function(self, args, kwargs)
1650 graph_function = self._function_cache.primary.get(cache_key, None)
1651 if graph_function is None:
-> 1652 graph_function = self._create_graph_function(args, kwargs)
1653 self._function_cache.primary[cache_key] = graph_function
1654 return graph_function, args, kwargs
~/anaconda3/envs/pde_TF/lib/python3.7/site-packages/tensorflow/python/eager/function.py in _create_graph_function(self, args, kwargs, override_flat_arg_shapes)
1543 arg_names=arg_names,
1544 override_flat_arg_shapes=override_flat_arg_shapes,
-> 1545 capture_by_value=self._capture_by_value),
1546 self._function_attributes)
1547
~/anaconda3/envs/pde_TF/lib/python3.7/site-packages/tensorflow/python/framework/func_graph.py in func_graph_from_py_func(name, python_func, args, kwargs, signature, func_graph, autograph, autograph_options, add_control_dependencies, arg_names, op_return_value, collections, capture_by_value, override_flat_arg_shapes)
713 converted_func)
714
--> 715 func_outputs = python_func(*func_args, **func_kwargs)
716
717 # invariant: func_outputs
contains only Tensors, CompositeTensors,
~/anaconda3/envs/pde_TF/lib/python3.7/site-packages/tensorflow/python/eager/def_function.py in wrapped_fn(*args, **kwds)
305 # wrapped allows AutoGraph to swap in a converted function. We give
306 # the function a weak reference to itself to avoid a reference cycle.
--> 307 return weak_wrapped_fn().wrapped(*args, **kwds)
308 weak_wrapped_fn = weakref.ref(wrapped_fn)
309
~/anaconda3/envs/pde_TF/lib/python3.7/site-packages/tensorflow/python/framework/func_graph.py in wrapper(*args, **kwargs)
703 except Exception as e: # pylint:disable=broad-except
704 if hasattr(e, "ag_error_metadata"):
--> 705 raise e.ag_error_metadata.to_exception(type(e))
706 else:
707 raise
TypeError: in converted code:
relative to /Users/yani:
Dropbox/MIT/projects/burgers_theta_updated/pde_superresolution_2d/datadrivenpdes/core/integrate.py:80 advance_until_saved_step
while i < stop:
anaconda3/envs/pde_TF/lib/python3.7/site-packages/tensorflow/python/framework/ops.py:690 __bool__
raise TypeError("Using a `tf.Tensor` as a Python `bool` is not allowed. "
TypeError: Using a `tf.Tensor` as a Python `bool` is not allowed. Use `if t is not None:` instead of `if t:` to test if a tensor is defined, and use TensorFlow ops such as tf.cond to execute subgraphs conditioned on the value of a tensor.
I use Python 3.7.3, and the packages versions that I use are:
absl-py==0.7.1
apache-beam==2.13.0
appnope==0.1.0
astor==0.8.0
attrs==19.1.0
avro-python3==1.9.0
backcall==0.1.0
bleach==3.1.0
certifi==2019.6.16
chardet==3.0.4
crcmod==1.7
cycler==0.10.0
decorator==4.4.0
defusedxml==0.6.0
dill==0.2.9
docopt==0.6.2
entrypoints==0.3
fastavro==0.21.24
future==0.17.1
gast==0.2.2
google-pasta==0.1.7
grpcio==1.22.0
h5py==2.9.0
hdfs==2.5.8
httplib2==0.12.0
idna==2.8
ipykernel==5.1.1
ipython==7.6.1
ipython-genutils==0.2.0
ipywidgets==7.5.0
jedi==0.13.3
Jinja2==2.10.1
jsonschema==3.0.1
jupyter==1.0.0
jupyter-client==5.3.1
jupyter-console==6.0.0
jupyter-core==4.5.0
Keras-Applications==1.0.8
Keras-Preprocessing==1.1.0
kiwisolver==1.1.0
Markdown==3.1.1
MarkupSafe==1.1.1
matplotlib==3.1.0
mistune==0.8.4
mkl-fft==1.0.12
mkl-random==1.0.2
mock==2.0.0
nbconvert==5.5.0
nbformat==4.4.0
notebook==5.7.8
numpy==1.16.4
oauth2client==3.0.0
pandas==0.24.2
pandocfilters==1.4.2
parso==0.5.0
pbr==5.4.0
pexpect==4.7.0
pickleshare==0.7.5
prometheus-client==0.7.1
prompt-toolkit==2.0.9
protobuf==3.9.0
ptyprocess==0.6.0
pyarrow==0.13.0
pyasn1==0.4.5
pyasn1-modules==0.2.5
pydot==1.2.4
Pygments==2.4.2
pyparsing==2.4.0
pyrsistent==0.14.11
python-dateutil==2.8.0
pytz==2019.1
PyYAML==3.13
pyzmq==18.0.0
qtconsole==4.5.1
requests==2.22.0
rsa==4.0
scipy==1.2.1
Send2Trash==1.5.0
six==1.12.0
tensorboard==1.14.0
tensorflow==1.14.0
tensorflow-estimator==1.14.0
termcolor==1.1.0
terminado==0.8.2
testpath==0.4.2
tornado==6.0.3
traitlets==4.3.2
urllib3==1.25.3
wcwidth==0.1.7
webencodings==0.5.1
Werkzeug==0.15.4
widgetsnbextension==3.5.0
wrapt==1.11.2
xarray==0.12.3
xgboost==0.90