diff options
author | 2017-10-03 11:35:23 -0700 | |
---|---|---|
committer | 2017-10-03 11:38:44 -0700 | |
commit | 0e286d372b9c04e7db62fa88695282cc0a0d61d9 (patch) | |
tree | 233c14dbfb9780c56d40f916450a2398ed00d063 /tensorflow/core/kernels/random_op.cc | |
parent | 7020f17de9eba436425c7fb61a2a026bdf80ed4f (diff) |
Bugfix: tf.random_gamma incorrectly handles non-batch, scalar draws.
PiperOrigin-RevId: 170887206
Diffstat (limited to 'tensorflow/core/kernels/random_op.cc')
-rw-r--r-- | tensorflow/core/kernels/random_op.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tensorflow/core/kernels/random_op.cc b/tensorflow/core/kernels/random_op.cc index e78f8e2621..a37c757865 100644 --- a/tensorflow/core/kernels/random_op.cc +++ b/tensorflow/core/kernels/random_op.cc @@ -288,13 +288,14 @@ class RandomGammaOp : public OpKernel { &samples_shape)); } const int64 num_samples = samples_shape.num_elements(); - if (num_samples == 0) return; samples_shape.AppendShape(alpha_t.shape()); // Allocate output samples. Tensor* samples_t = nullptr; OP_REQUIRES_OK(ctx, ctx->allocate_output(0, samples_shape, &samples_t)); + if (num_samples == 0) return; + using random::PhiloxRandom; typedef random::NormalDistribution<PhiloxRandom, double> Normal; |