mindspore.ops.HistogramSummary
- class mindspore.ops.HistogramSummary[source]
This operator will calculate the histogram of a tensor and put it to a summary file with protocol buffer format. It must be used with SummaryRecord or SummaryCollector, which specify the directory of the summary file. The summary file can be loaded and shown by MindInsight, see MindInsight documents for details. In Ascend platform with graph mode, can set environment variables MS_DUMP_SLICE_SIZE and MS_DUMP_WAIT_TIME to solve operator execution failure when calling this operator intensively.
- Inputs:
name (str) - The name of the input variable.
value (Tensor) - The value of tensor, and the rank of tensor must be greater than 0.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore >>> import mindspore.nn as nn >>> from mindspore import ops >>> from mindspore import Tensor, set_context >>> >>> >>> class SummaryDemo(nn.Cell): ... def __init__(self,): ... super(SummaryDemo, self).__init__() ... self.summary = ops.HistogramSummary() ... self.add = ops.Add() ... ... def construct(self, x, y): ... x = self.add(x, y) ... name = "x" ... self.summary(name, x) ... return x >>> set_context(mode=mindspore.GRAPH_MODE) >>> summary = SummaryDemo()(Tensor([1, 2]), Tensor([3, 4])) >>> print(summary) [4 6]