blei-lab / edward

A probabilistic programming language in TensorFlow. Deep generative models, variational inference.
http://edwardlib.org
Other
4.83k stars 759 forks source link

index out of range error with tensorflow r1.8 #895

Open ea42gh opened 6 years ago

ea42gh commented 6 years ago

Versions: 'edward': '1.3.5', 'tensorflow': '1.8.0'

Trying to run example http://nbviewer.jupyter.org/github/blei-lab/edward/blob/master/notebooks/tensorboard.ipynb

The statement

inference.run(n_samples=5, n_iter=250, logdir='log/n_samples_5')

results in

/usr/local/lib/python3.6/site-packages/edward-1.3.5-py3.6.egg/edward/util/random_variables.py:54: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-5-57315b7843b6> in <module>()
      1 inference = ed.KLqp({w: qw, b: qb}, data={X: X_train, y: y_train})
----> 2 inference.run(n_samples=5, n_iter=250, logdir='log/n_samples_5')

/usr/local/lib/python3.6/site-packages/edward-1.3.5-py3.6.egg/edward/inferences/inference.py in run(self, variables, use_coordinator, *args, **kwargs)
    123         Passed into `initialize`.
    124     """
--> 125     self.initialize(*args, **kwargs)
    126 
    127     if variables is None:

/usr/local/lib/python3.6/site-packages/edward-1.3.5-py3.6.egg/edward/inferences/klqp.py in initialize(self, n_samples, kl_scaling, *args, **kwargs)
    111     self.n_samples = n_samples
    112     self.kl_scaling = kl_scaling
--> 113     return super(KLqp, self).initialize(*args, **kwargs)
    114 
    115   def build_loss_and_gradients(self, var_list):

/usr/local/lib/python3.6/site-packages/edward-1.3.5-py3.6.egg/edward/inferences/variational_inference.py in initialize(self, optimizer, var_list, use_prettytensor, global_step, *args, **kwargs)
     66       var_list = list(var_list)
     67 
---> 68     self.loss, grads_and_vars = self.build_loss_and_gradients(var_list)
     69 
     70     if self.logging:

/usr/local/lib/python3.6/site-packages/edward-1.3.5-py3.6.egg/edward/inferences/klqp.py in build_loss_and_gradients(self, var_list)
    146     if is_reparameterizable:
    147       if is_analytic_kl:
--> 148         return build_reparam_kl_loss_and_gradients(self, var_list)
    149       # elif is_analytic_entropy:
    150       #    return build_reparam_entropy_loss_and_gradients(self, var_list)

/usr/local/lib/python3.6/site-packages/edward-1.3.5-py3.6.egg/edward/inferences/klqp.py in build_reparam_kl_loss_and_gradients(inference, var_list)
    738     for z, qz in six.iteritems(inference.latent_vars):
    739       # Copy q(z) to obtain new set of posterior samples.
--> 740       qz_copy = copy(qz, scope=scope)
    741       dict_swap[z] = qz_copy.value()
    742 

/usr/local/lib/python3.6/site-packages/edward-1.3.5-py3.6.egg/edward/util/random_variables.py in copy(org_instance, dict_swap, scope, replace_itself, copy_q, copy_parent_rvs)
    292       else:
    293         kwargs[key] = _copy_default(
--> 294             value, dict_swap, scope, True, copy_q, False)
    295 
    296     kwargs['name'] = new_name

/usr/local/lib/python3.6/site-packages/edward-1.3.5-py3.6.egg/edward/util/random_variables.py in _copy_default(x, *args, **kwargs)
    134 def _copy_default(x, *args, **kwargs):
    135   if isinstance(x, (RandomVariable, tf.Operation, tf.Tensor, tf.Variable)):
--> 136     x = copy(x, *args, **kwargs)
    137 
    138   return x

/usr/local/lib/python3.6/site-packages/edward-1.3.5-py3.6.egg/edward/util/random_variables.py in copy(org_instance, dict_swap, scope, replace_itself, copy_q, copy_parent_rvs)
    316     # op. Therefore copy the op itself.
    317     op = tensor.op
--> 318     new_op = copy(op, dict_swap, scope, True, copy_q, False)
    319 
    320     output_index = op.outputs.index(tensor)

/usr/local/lib/python3.6/site-packages/edward-1.3.5-py3.6.egg/edward/util/random_variables.py in copy(org_instance, dict_swap, scope, replace_itself, copy_q, copy_parent_rvs)
    369                           [],  # input types; will add them afterwards
    370                           original_op,
--> 371                           op_def)
    372 
    373     # advertise op early to break recursions

/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py in __init__(self, node_def, g, inputs, output_types, control_inputs, input_types, original_op, op_def)
   1730       # Refactor so we don't have to do this here.
   1731       grouped_inputs = self._reconstruct_sequence_inputs(
-> 1732           op_def, inputs, node_def.attr)
   1733       self._c_op = _create_c_op(self._graph, node_def, grouped_inputs,
   1734                                 control_input_ops)

/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py in _reconstruct_sequence_inputs(self, op_def, inputs, attrs)
   1801         grouped_inputs.append(inputs[i:i + input_len])
   1802       else:
-> 1803         grouped_inputs.append(inputs[i])
   1804       i += input_len
   1805 

IndexError: list index out of range
georgewpurnell commented 6 years ago

Same issue.

AdrianP- commented 6 years ago

Same

pswpswpsw commented 6 years ago

same

shinobu-x commented 6 years ago

Current version of edward does not have compatibility with TensorFlow 1.8 release.

davidia commented 6 years ago

Run this (or set in the environment) before importing edward

import os
os.environ['TF_C_API_GRAPH_CONSTRUCTION']='0'
Neeharika-Bandi commented 6 years ago

Evening after import os os.environ['TF_C_API_GRAPH_CONSTRUCTION']='0' running this before importing edward still I am facing IndexError: list index out of range.

Edward:1.3.5 TensorFlow:1.11.0

Can anyone help me in resolving the issue?

08zhangyi commented 6 years ago

Same issue. Tensorflow: 1.12.0

TristanBertin commented 5 years ago

Same

twiecki commented 5 years ago

I don't think this is maintained anymore.

akritikedia1 commented 5 years ago

Same issue.

Got any solution?

SoCohesive commented 5 years ago

Has anyone resolved this issue?

akritikedia1 commented 5 years ago

Not yet

On Wed, Feb 6, 2019, 5:37 AM Sonam notifications@github.com wrote:

Has anyone resolved this issue?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/blei-lab/edward/issues/895#issuecomment-460854595, or mute the thread https://github.com/notifications/unsubscribe-auth/Aosf0WWeczc1VcHUroNexQG6KkGrkqMLks5vKhzNgaJpZM4UNOEP .

huyongjun commented 5 years ago

Same issue

ZiyangS commented 5 years ago

same issue

adiguzelomer commented 5 years ago

same issue :(

diwu93 commented 5 years ago

TensorFlow==1.7.0 is OK!

huyongjun commented 5 years ago

Which version of keras is ok?

On 8/10/2019 13:01,diwu93notifications@github.com wrote:

TensorFlow==1.7.0 is OK!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.