Simple Hierarchical Distribution

Thanks!

I made the changes

x = Bernoulli(probs=tf.ones(N) * theta)

and

alpha_pos = Beta(tf.nn.softplus(tf.Variable([2.0])), tf.nn.softplus(tf.Variable([2.0])))

However, I’m still getting a similar error.

tensorflow version: 1.3.0
edward version: 1.3.4
2017-10-12 11:06:48.550191: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-10-12 11:06:48.550213: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-10-12 11:06:48.550219: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2017-10-12 11:06:48.550225: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
 140/1000 [ 14%] ████                           ETA: 174s | Loss: 975.839Traceback (most recent call last):
  File "./alarm.py", line 42, in <module>
    inference.run(n_samples=50, n_iter=1000, logdir='log/n_samples_5')    
  File "/Users/qiyatung/anaconda/lib/python2.7/site-packages/edward/src/edward/edward/inferences/inference.py", line 144, in run
    info_dict = self.update()
  File "/Users/qiyatung/anaconda/lib/python2.7/site-packages/edward/src/edward/edward/inferences/variational_inference.py", line 161, in update
    summary = sess.run(self.summarize, feed_dict)
  File "/Users/qiyatung/anaconda/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 895, in run
    run_metadata_ptr)
  File "/Users/qiyatung/anaconda/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1124, in _run
    feed_dict_tensor, options, run_metadata)
  File "/Users/qiyatung/anaconda/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1321, in _do_run
    options, run_metadata)
  File "/Users/qiyatung/anaconda/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1340, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Nan in summary histogram for: gradient/posterior/Variable_1/0
	 [[Node: gradient/posterior/Variable_1/0 = HistogramSummary[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"](gradient/posterior/Variable_1/0/tag, gradients/inference/sample_49/posterior/Softplus_1_grad/SoftplusGrad)]]

Caused by op u'gradient/posterior/Variable_1/0', defined at:
  File "./alarm.py", line 42, in <module>
    inference.run(n_samples=50, n_iter=1000, logdir='log/n_samples_5')
  File "/Users/qiyatung/anaconda/lib/python2.7/site-packages/edward/src/edward/edward/inferences/inference.py", line 123, in run
    self.initialize(*args, **kwargs)
  File "/Users/qiyatung/anaconda/lib/python2.7/site-packages/edward/src/edward/edward/inferences/klqp.py", line 107, in initialize
    return super(KLqp, self).initialize(*args, **kwargs)
  File "/Users/qiyatung/anaconda/lib/python2.7/site-packages/edward/src/edward/edward/inferences/variational_inference.py", line 76, in initialize
    grad, collections=[self._summary_key])
  File "/Users/qiyatung/anaconda/lib/python2.7/site-packages/tensorflow/python/summary/summary.py", line 192, in histogram
    tag=tag, values=values, name=scope)
  File "/Users/qiyatung/anaconda/lib/python2.7/site-packages/tensorflow/python/ops/gen_logging_ops.py", line 129, in _histogram_summary
    name=name)
  File "/Users/qiyatung/anaconda/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 767, in apply_op
    op_def=op_def)
  File "/Users/qiyatung/anaconda/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2630, in create_op
    original_op=self._default_original_op, op_def=op_def)
  File "/Users/qiyatung/anaconda/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1204, in __init__
    self._traceback = self._graph._extract_stack()  # pylint: disable=protected-access

InvalidArgumentError (see above for traceback): Nan in summary histogram for: gradient/posterior/Variable_1/0
	 [[Node: gradient/posterior/Variable_1/0 = HistogramSummary[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"](gradient/posterior/Variable_1/0/tag, gradients/inference/sample_49/posterior/Softplus_1_grad/SoftplusGrad)]]