MCPcopy Create free account
hub / github.com/google-research/language / plot_histogram

Function plot_histogram

language/fruit/beam_pipelines.py:812–826  ·  view source on GitHub ↗

Plots a length histogram.

(element, path)

Source from the content-addressed store, hash-verified

810
811
812def plot_histogram(element, path):
813 """Plots a length histogram."""
814 _, ax = plt.subplots(nrows=2, ncols=1)
815 bins = np.r_[np.linspace(0, 8192, num=512), np.inf]
816 ax[0].hist(element["inputs"], bins=bins, density=True, cumulative=True)
817 ax[0].set_xlim([0, 8192])
818 ax[0].set_title("Inputs")
819 ax[1].hist(element["targets"], bins=bins, density=True, cumulative=True)
820 ax[1].set_xlim([0, 8192])
821 ax[1].set_title("Targets")
822
823 plt.tight_layout()
824
825 with tf.io.gfile.GFile(path, "wb") as f:
826 plt.savefig(f, format="png", dpi=300)
827
828
829def to_tfrecords_pipeline(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…