Hello, I'm interested in running your algorithm on some of my own time series pneumonia data, and am first going through the tutorial notebook. My environment has the following package versions:
numpy==1.21.6
pandas==1.3.5
tensorflow==1.15.0
I just made sure tensorflow was version 1.x because many of the methods used have since been deprecated. I'm runnng the notebook as published on github, but run into the following error during model creation model = AC_TPC(sess, "AC_TPC", input_dims, network_settings). Do you have an ideas on how to fix it or how I should otherwise be initializing the network?
NotImplementedError Traceback (most recent call last)
/tmp/ipykernel_56584/1262582439.py in
----> 1 model = AC_TPC(sess, "AC_TPC", input_dims, network_settings)
2
3
4 saver = tf.train.Saver()
5 sess.run(tf.global_variables_initializer(), feed_dict={model.E:np.zeros([K, z_dim]).astype(float)})
/projects/b1038/Pulmonary/sfenske/projects/carpe_diem_modeling/code/AC_TPC/class_AC_TPC.py in init(self, sess, name, input_dims, network_settings)
57 self.z_dim = self.h_dim_f * self.num_layers_f
58
---> 59 self._build_net()
60
61
/projects/b1038/Pulmonary/sfenske/projects/carpe_diem_modeling/code/AC_TPC/class_AC_TPC.py in _build_net(self)
198 )
199
--> 200 _, _, loop_state_ta = tf.nn.raw_rnn(cell, loop_fn) #, parallel_iterations=1)
201
202
~/miniconda3/envs/old_tf/lib/python3.7/site-packages/tensorflow_core/python/ops/rnn.py in raw_rnn(cell, loop_fn, parallel_iterations, swap_memory, scope)
1121 (elements_finished, next_input,
1122 initial_state, emit_structure, init_loop_state) = loop_fn(
-> 1123 time, None, None, None) # time, cell_output, cell_state, loop_state
1124 flat_input = nest.flatten(next_input)
1125
/projects/b1038/Pulmonary/sfenske/projects/carpe_diem_modeling/code/AC_TPC/class_AC_TPC.py in loop_fn(time, cell_output, cell_state, loop_state)
167 next_input = tf.cond(finished,
168 lambda: tf.zeros([self.mb_size, self.x_dim], dtype=tf.float32),
--> 169 lambda: inputs_ta.read(time))
170 return (elements_finished, next_input, next_cell_state, emit_output, next_loop_state)
171
~/miniconda3/envs/old_tf/lib/python3.7/site-packages/tensorflow_core/python/util/deprecation.py in new_func(*args, **kwargs)
505 'in a future version' if date is None else ('after %s' % date),
506 instructions)
--> 507 return func(*args, **kwargs)
508
509 doc = _add_deprecated_arg_notice_to_docstring(
~/miniconda3/envs/old_tf/lib/python3.7/site-packages/tensorflow_core/python/ops/control_flow_ops.py in cond(pred, true_fn, false_fn, strict, name, fn1, fn2)
1222 try:
1223 context_t.Enter()
-> 1224 orig_res_t, res_t = context_t.BuildCondBranch(true_fn)
1225 if orig_res_t is None:
1226 raise ValueError("true_fn must have a return value.")
~/miniconda3/envs/old_tf/lib/python3.7/site-packages/tensorflow_core/python/ops/control_flow_ops.py in BuildCondBranch(self, fn)
1059 """Add the subgraph defined by fn() to the graph."""
1060 pre_summaries = ops.get_collection(ops.GraphKeys._SUMMARY_COLLECTION) # pylint: disable=protected-access
-> 1061 original_result = fn()
1062 post_summaries = ops.get_collection(ops.GraphKeys._SUMMARY_COLLECTION) # pylint: disable=protected-access
1063 if len(post_summaries) > len(pre_summaries):
/projects/b1038/Pulmonary/sfenske/projects/carpe_diem_modeling/code/AC_TPC/class_AC_TPC.py in ()
166 finished = tf.reduce_all(elements_finished)
167 next_input = tf.cond(finished,
--> 168 lambda: tf.zeros([self.mb_size, self.x_dim], dtype=tf.float32),
169 lambda: inputs_ta.read(time))
170 return (elements_finished, next_input, next_cell_state, emit_output, next_loop_state)
~/miniconda3/envs/old_tf/lib/python3.7/site-packages/tensorflow_core/python/ops/array_ops.py in zeros(shape, dtype, name)
2336 # Create a constant if it won't be very big. Otherwise create a fill op
2337 # to prevent serialized GraphDefs from becoming too large.
-> 2338 output = _constant_if_small(zero, shape, dtype, name)
2339 if output is not None:
2340 return output
~/miniconda3/envs/old_tf/lib/python3.7/site-packages/tensorflow_core/python/ops/array_ops.py in _constant_if_small(value, shape, dtype, name)
2293 def _constant_if_small(value, shape, dtype, name):
2294 try:
-> 2295 if np.prod(shape) < 1000:
2296 return constant(value, shape=shape, dtype=dtype, name=name)
2297 except TypeError:
<array_function internals> in prod(*args, **kwargs)
~/miniconda3/envs/old_tf/lib/python3.7/site-packages/numpy/core/fromnumeric.py in prod(a, axis, dtype, out, keepdims, initial, where)
3050 """
3051 return _wrapreduction(a, np.multiply, 'prod', axis, dtype, out,
-> 3052 keepdims=keepdims, initial=initial, where=where)
3053
3054
~/miniconda3/envs/old_tf/lib/python3.7/site-packages/numpy/core/fromnumeric.py in _wrapreduction(obj, ufunc, method, axis, dtype, out, **kwargs)
84 return reduction(axis=axis, out=out, **passkwargs)
85
---> 86 return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
87
88
~/miniconda3/envs/old_tf/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py in array(self)
734 def array(self):
735 raise NotImplementedError("Cannot convert a symbolic Tensor ({}) to a numpy"
--> 736 " array.".format(self.name))
737
738 def len(self):
NotImplementedError: Cannot convert a symbolic Tensor (AC_TPC/batch_size:0) to a numpy array.
Hello, I'm interested in running your algorithm on some of my own time series pneumonia data, and am first going through the tutorial notebook. My environment has the following package versions:
numpy==1.21.6
pandas==1.3.5
tensorflow==1.15.0
I just made sure tensorflow was version 1.x because many of the methods used have since been deprecated. I'm runnng the notebook as published on github, but run into the following error during model creation
model = AC_TPC(sess, "AC_TPC", input_dims, network_settings). Do you have an ideas on how to fix it or how I should otherwise be initializing the network?NotImplementedError Traceback (most recent call last)
/tmp/ipykernel_56584/1262582439.py in
----> 1 model = AC_TPC(sess, "AC_TPC", input_dims, network_settings)
2
3
4 saver = tf.train.Saver()
5 sess.run(tf.global_variables_initializer(), feed_dict={model.E:np.zeros([K, z_dim]).astype(float)})
/projects/b1038/Pulmonary/sfenske/projects/carpe_diem_modeling/code/AC_TPC/class_AC_TPC.py in init(self, sess, name, input_dims, network_settings)
57 self.z_dim = self.h_dim_f * self.num_layers_f
58
---> 59 self._build_net()
60
61
/projects/b1038/Pulmonary/sfenske/projects/carpe_diem_modeling/code/AC_TPC/class_AC_TPC.py in _build_net(self)
198 )
199
--> 200 _, _, loop_state_ta = tf.nn.raw_rnn(cell, loop_fn) #, parallel_iterations=1)
201
202
~/miniconda3/envs/old_tf/lib/python3.7/site-packages/tensorflow_core/python/ops/rnn.py in raw_rnn(cell, loop_fn, parallel_iterations, swap_memory, scope)
1121 (elements_finished, next_input,
1122 initial_state, emit_structure, init_loop_state) = loop_fn(
-> 1123 time, None, None, None) # time, cell_output, cell_state, loop_state
1124 flat_input = nest.flatten(next_input)
1125
/projects/b1038/Pulmonary/sfenske/projects/carpe_diem_modeling/code/AC_TPC/class_AC_TPC.py in loop_fn(time, cell_output, cell_state, loop_state)
167 next_input = tf.cond(finished,
168 lambda: tf.zeros([self.mb_size, self.x_dim], dtype=tf.float32),
--> 169 lambda: inputs_ta.read(time))
170 return (elements_finished, next_input, next_cell_state, emit_output, next_loop_state)
171
~/miniconda3/envs/old_tf/lib/python3.7/site-packages/tensorflow_core/python/util/deprecation.py in new_func(*args, **kwargs)
505 'in a future version' if date is None else ('after %s' % date),
506 instructions)
--> 507 return func(*args, **kwargs)
508
509 doc = _add_deprecated_arg_notice_to_docstring(
~/miniconda3/envs/old_tf/lib/python3.7/site-packages/tensorflow_core/python/ops/control_flow_ops.py in cond(pred, true_fn, false_fn, strict, name, fn1, fn2)
1222 try:
1223 context_t.Enter()
-> 1224 orig_res_t, res_t = context_t.BuildCondBranch(true_fn)
1225 if orig_res_t is None:
1226 raise ValueError("true_fn must have a return value.")
~/miniconda3/envs/old_tf/lib/python3.7/site-packages/tensorflow_core/python/ops/control_flow_ops.py in BuildCondBranch(self, fn)
1059 """Add the subgraph defined by fn() to the graph."""
1060 pre_summaries = ops.get_collection(ops.GraphKeys._SUMMARY_COLLECTION) # pylint: disable=protected-access
-> 1061 original_result = fn()
1062 post_summaries = ops.get_collection(ops.GraphKeys._SUMMARY_COLLECTION) # pylint: disable=protected-access
1063 if len(post_summaries) > len(pre_summaries):
/projects/b1038/Pulmonary/sfenske/projects/carpe_diem_modeling/code/AC_TPC/class_AC_TPC.py in ()
166 finished = tf.reduce_all(elements_finished)
167 next_input = tf.cond(finished,
--> 168 lambda: tf.zeros([self.mb_size, self.x_dim], dtype=tf.float32),
169 lambda: inputs_ta.read(time))
170 return (elements_finished, next_input, next_cell_state, emit_output, next_loop_state)
~/miniconda3/envs/old_tf/lib/python3.7/site-packages/tensorflow_core/python/ops/array_ops.py in zeros(shape, dtype, name)
2336 # Create a constant if it won't be very big. Otherwise create a fill op
2337 # to prevent serialized GraphDefs from becoming too large.
-> 2338 output = _constant_if_small(zero, shape, dtype, name)
2339 if output is not None:
2340 return output
~/miniconda3/envs/old_tf/lib/python3.7/site-packages/tensorflow_core/python/ops/array_ops.py in _constant_if_small(value, shape, dtype, name)
2293 def _constant_if_small(value, shape, dtype, name):
2294 try:
-> 2295 if np.prod(shape) < 1000:
2296 return constant(value, shape=shape, dtype=dtype, name=name)
2297 except TypeError:
<array_function internals> in prod(*args, **kwargs)
~/miniconda3/envs/old_tf/lib/python3.7/site-packages/numpy/core/fromnumeric.py in prod(a, axis, dtype, out, keepdims, initial, where)
3050 """
3051 return _wrapreduction(a, np.multiply, 'prod', axis, dtype, out,
-> 3052 keepdims=keepdims, initial=initial, where=where)
3053
3054
~/miniconda3/envs/old_tf/lib/python3.7/site-packages/numpy/core/fromnumeric.py in _wrapreduction(obj, ufunc, method, axis, dtype, out, **kwargs)
84 return reduction(axis=axis, out=out, **passkwargs)
85
---> 86 return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
87
88
~/miniconda3/envs/old_tf/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py in array(self)
734 def array(self):
735 raise NotImplementedError("Cannot convert a symbolic Tensor ({}) to a numpy"
--> 736 " array.".format(self.name))
737
738 def len(self):
NotImplementedError: Cannot convert a symbolic Tensor (AC_TPC/batch_size:0) to a numpy array.