From c7ae49c070fc0ae6cd62711e2c238feaef2903ca Mon Sep 17 00:00:00 2001 From: Yong Tang Date: Thu, 30 Apr 2020 19:47:08 +0000 Subject: [PATCH] Replace print(hist) with hist.numpy() to avoid print call, also avoid pylint too long (80) error Remove extra "```" as doctest use ">>>" and "..." instead, and fix pylint issue by shorten the output Signed-off-by: Yong Tang --- tensorflow/python/ops/histogram_ops.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/tensorflow/python/ops/histogram_ops.py b/tensorflow/python/ops/histogram_ops.py index ffdd900ec71..da1411f8a1f 100644 --- a/tensorflow/python/ops/histogram_ops.py +++ b/tensorflow/python/ops/histogram_ops.py @@ -62,15 +62,14 @@ def histogram_fixed_width_bins(values, Examples: - ```python >>> # Bins will be: (-inf, 1), [1, 2), [2, 3), [3, 4), [4, inf) - ... + ... >>> nbins = 5 >>> value_range = [0.0, 5.0] >>> new_values = [-1.0, 0.0, 1.5, 2.0, 5.0, 15] - >>> tf.histogram_fixed_width_bins(new_values, value_range, nbins=5) - - ``` + >>> indices = tf.histogram_fixed_width_bins(new_values, value_range, nbins=5) + >>> indices.numpy() + array([0, 0, 1, 2, 4, 4], dtype=int32) """ with ops.name_scope(name, 'histogram_fixed_width_bins', [values, value_range, nbins]): @@ -129,15 +128,14 @@ def histogram_fixed_width(values, Examples: - ```python >>> # Bins will be: (-inf, 1), [1, 2), [2, 3), [3, 4), [4, inf) - ... + ... >>> nbins = 5 >>> value_range = [0.0, 5.0] >>> new_values = [-1.0, 0.0, 1.5, 2.0, 5.0, 15] - >>> tf.histogram_fixed_width(new_values, value_range, nbins=5) - - ``` + >>> hist = tf.histogram_fixed_width(new_values, value_range, nbins=5) + >>> hist.numpy() + array([2, 1, 1, 0, 2], dtype=int32) """ with ops.name_scope(name, 'histogram_fixed_width', [values, value_range, nbins]) as name: