def test_histogram_doane(self): self.assertTrue( compare_proto( summary.histogram('dummy', np.random.rand(1024), bins='doane', max_bins=5), self))
def test_histogram_doane(self): self.assertTrue( compare_proto( summary.histogram('dummy', tensor_N(shape=(1024, )), bins='doane', max_bins=5), self))
def add_histogram(self, tag, values, global_step=None, bins='tensorflow', walltime=None): """Add histogram to summary. Args: tag (string): Data identifier values (torch.Tensor, numpy.array, or string/blobname): Values to build histogram global_step (int): Global step value to record bins (string): One of {'tensorflow','auto', 'fd', ...}. This determines how the bins are made. You can find other options in: https://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram.html walltime (float): Optional override default walltime (time.time()) seconds after epoch of event Examples:: from torch.utils.tensorboard import SummaryWriter import numpy as np writer = SummaryWriter() for i in range(10): x = np.random.random(1000) writer.add_histogram('distribution centers', x + i, i) writer.close() Expected result: .. image:: _static/img/tensorboard/add_histogram.png :scale: 50 % """ if isinstance(bins, six.string_types) and bins == 'tensorflow': bins = self.default_bins self._get_file_writer().add_summary( histogram(tag, values, bins, max_bins=100), global_step, walltime)
def add_histogram(self, tag, values, global_step=None, bins='tensorflow', walltime=None, max_bins=None): torch._C._log_api_usage_once("tensorboard.logging.add_histogram") if self._check_caffe2_blob(values): values = workspace.FetchBlob(values) if isinstance(bins, six.string_types) and bins == 'tensorflow': bins = self.default_bins self._get_file_writer().add_summary( histogram(tag, values, bins, max_bins=max_bins), global_step, walltime)
def test_empty_input(self): with self.assertRaises(Exception) as e_info: summary.histogram('dummy', np.ndarray(0), 'tensorflow')
def test_list_input(self): with self.assertRaises(Exception) as e_info: summary.histogram('dummy', [1, 3, 4, 5, 6], 'tensorflow')
def test_empty_input(self): print('expect error here:') with self.assertRaises(Exception) as e_info: summary.histogram('dummy', np.ndarray(0), 'tensorflow')