aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/kernels/random_op.cc
diff options
context:
space:
mode:
authorGravatar Joshua V. Dillon <jvdillon@google.com>2017-10-03 11:35:23 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-10-03 11:38:44 -0700
commit0e286d372b9c04e7db62fa88695282cc0a0d61d9 (patch)
tree233c14dbfb9780c56d40f916450a2398ed00d063 /tensorflow/core/kernels/random_op.cc
parent7020f17de9eba436425c7fb61a2a026bdf80ed4f (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.cc3
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;