import tensorflow as tf

    self.assertEqual(x_duplicate.name, "x_1/")
    self.assertTrue(x_duplicate_sample.name.startswith(
        "x_1/custom_sample"))
    self.assertTrue(x_sample_duplicate.name.startswith("x/custom_sample_1"))

  def testStrWorksCorrectlyScalar(self):
    # Usually we'd write np.float(X) here, but a recent Eager bug would
    # erroneously coerce the value to float32 anyway. We therefore use constants
    # here, until the bug is resolved in TensorFlow 1.12.
    normal = tfd.Normal(loc=tf.constant(0, tf.float16),
                        scale=tf.constant(1, tf.float16))
    self.assertEqual(
        str(normal),
        "tfp.distributions.Normal("
        "\"Normal/\", "
        "batch_shape=(), "
        "event_shape=(), "
        "dtype=float16)")

    chi2 = tfd.Chi2(df=np.float32([1., 2.]), name="silly")
