!45151 Fix the summary operator example
Merge pull request !45151 from maning202007/master
This commit is contained in:
commit
d6fa81ba69
|
@ -3,7 +3,9 @@ mindspore.ops.HistogramSummary
|
||||||
|
|
||||||
.. py:class:: mindspore.ops.HistogramSummary
|
.. py:class:: mindspore.ops.HistogramSummary
|
||||||
|
|
||||||
通过HistogramSummary将Tensor数据输出到协议缓冲区。
|
计算Tensor的直方图并保存到Summary文件。必须和SummaryRecord或SummaryCollector一起使用,
|
||||||
|
Summary文件的保存路径由SummaryRecord或SummaryCollector指定。Summary文件可以通过MindInsight加载并展示,
|
||||||
|
关于MindInsight的详细信息请参考 `MindInsight文档 <https://www.mindspore.cn/mindinsight/docs/zh-CN/master/index.html>`_ 。
|
||||||
|
|
||||||
输入:
|
输入:
|
||||||
- **name** (str) - 输入变量的名称。
|
- **name** (str) - 输入变量的名称。
|
||||||
|
|
|
@ -3,7 +3,9 @@ mindspore.ops.ImageSummary
|
||||||
|
|
||||||
.. py:class:: mindspore.ops.ImageSummary
|
.. py:class:: mindspore.ops.ImageSummary
|
||||||
|
|
||||||
将图片数据放到缓冲区。
|
将图像保存到Summary文件。必须和SummaryRecord或SummaryCollector一起使用,
|
||||||
|
Summary文件的保存路径由SummaryRecord或SummaryCollector指定。Summary文件可以通过MindInsight加载并展示,
|
||||||
|
关于MindInsight的详细信息请参考 `MindInsight文档 <https://www.mindspore.cn/mindinsight/docs/zh-CN/master/index.html>`_ 。
|
||||||
|
|
||||||
输入:
|
输入:
|
||||||
- **name** (str) - 输入变量的名称,不能是空字符串。
|
- **name** (str) - 输入变量的名称,不能是空字符串。
|
||||||
|
|
|
@ -3,10 +3,12 @@ mindspore.ops.ScalarSummary
|
||||||
|
|
||||||
.. py:class:: mindspore.ops.ScalarSummary
|
.. py:class:: mindspore.ops.ScalarSummary
|
||||||
|
|
||||||
通过ScalarSummary将一个标量输出到协议缓冲区。
|
将标量数据保存到Summary文件。必须和SummaryRecord或SummaryCollector一起使用,
|
||||||
|
Summary文件的保存路径由SummaryRecord或SummaryCollector指定。Summary文件可以通过MindInsight加载并展示,
|
||||||
|
关于MindInsight的详细信息请参考 `MindInsight文档 <https://www.mindspore.cn/mindinsight/docs/zh-CN/master/index.html>`_ 。
|
||||||
|
|
||||||
输入:
|
输入:
|
||||||
- **name** (str) - 输入变量的名称,不能是空字符串。
|
- **name** (str) - 输入标量的名称,不能是空字符串。
|
||||||
- **value** (Tensor) - 标量数据的值,维度必须为0或者1。
|
- **value** (Tensor) - 标量数据的值,维度必须为0或者1。
|
||||||
|
|
||||||
异常:
|
异常:
|
||||||
|
|
|
@ -3,7 +3,9 @@ mindspore.ops.TensorSummary
|
||||||
|
|
||||||
.. py:class:: mindspore.ops.TensorSummary
|
.. py:class:: mindspore.ops.TensorSummary
|
||||||
|
|
||||||
通过TensorSummary将一个Tensor输出到协议缓冲区。
|
将Tensor保存到Summary文件。必须和SummaryRecord或SummaryCollector一起使用,
|
||||||
|
Summary文件的保存路径由SummaryRecord或SummaryCollector指定。Summary文件可以通过MindInsight加载并展示,
|
||||||
|
关于MindInsight的详细信息请参考 `MindInsight文档 <https://www.mindspore.cn/mindinsight/docs/zh-CN/master/index.html>`_ 。
|
||||||
|
|
||||||
输入:
|
输入:
|
||||||
- **name** (str) - 输入变量的名称。
|
- **name** (str) - 输入变量的名称。
|
||||||
|
|
|
@ -245,9 +245,10 @@ class TensorLoader {
|
||||||
#ifdef ONLINE_DBG_MODE
|
#ifdef ONLINE_DBG_MODE
|
||||||
/*
|
/*
|
||||||
* Feature group: Dump.
|
* Feature group: Dump.
|
||||||
* Target device group: GPU.
|
* Target device group: GPU, Ascend.
|
||||||
* Runtime category: Old runtime, MindRT.
|
* Runtime category: Old runtime, MindRT.
|
||||||
* Description: Load tensor data from debugger backend cache (tensor_list_map_) and dump to file in npy format.
|
* Description: Load tensor data from debugger backend cache (tensor_list_map_) and dump to file in npy format,
|
||||||
|
* used for GPU and Ascend KernelByKernel mode.
|
||||||
*/
|
*/
|
||||||
bool DumpTensorToFile(const std::string &filepath, const std::string &tensor_name, size_t slot) {
|
bool DumpTensorToFile(const std::string &filepath, const std::string &tensor_name, size_t slot) {
|
||||||
if (filepath.empty()) {
|
if (filepath.empty()) {
|
||||||
|
|
|
@ -770,6 +770,10 @@ bool AscendDeviceAddress::LoadMemToHost(const std::string &tensor_name, int exec
|
||||||
mindspore::tensor::TensorPtr out_tensor = std::make_shared<tensor::Tensor>(host_type, host_shape);
|
mindspore::tensor::TensorPtr out_tensor = std::make_shared<tensor::Tensor>(host_type, host_shape);
|
||||||
MS_EXCEPTION_IF_NULL(out_tensor);
|
MS_EXCEPTION_IF_NULL(out_tensor);
|
||||||
size_t host_size = LongToSize(out_tensor->data().nbytes());
|
size_t host_size = LongToSize(out_tensor->data().nbytes());
|
||||||
|
if (host_size == 0) {
|
||||||
|
MS_LOG(INFO) << "Tensor size is 0 for tensor: " << tensor_name;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
bool ret_sync = false;
|
bool ret_sync = false;
|
||||||
if (trans_flag) {
|
if (trans_flag) {
|
||||||
ret_sync = SyncDeviceToHost(host_shape, host_size, host_type, out_tensor->data_c());
|
ret_sync = SyncDeviceToHost(host_shape, host_size, host_type, out_tensor->data_c());
|
||||||
|
|
|
@ -55,7 +55,10 @@ SUMMARY_RETURN_VALUE = {'dtype': mstype.int32, 'shape': [1], 'value': None}
|
||||||
|
|
||||||
class ScalarSummary(Primitive):
|
class ScalarSummary(Primitive):
|
||||||
"""
|
"""
|
||||||
Outputs a scalar to a protocol buffer through a scalar summary operator.
|
This operator will put a scalar 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 <https://www.mindspore.cn/
|
||||||
|
mindinsight/docs/en/master/index.html>`_ for details.
|
||||||
|
|
||||||
Inputs:
|
Inputs:
|
||||||
- **name** (str) - The name of the input variable, it must not be an empty string.
|
- **name** (str) - The name of the input variable, it must not be an empty string.
|
||||||
|
@ -107,7 +110,10 @@ class ScalarSummary(Primitive):
|
||||||
|
|
||||||
class ImageSummary(PrimitiveWithInfer):
|
class ImageSummary(PrimitiveWithInfer):
|
||||||
"""
|
"""
|
||||||
Outputs the image tensor to protocol buffer through image summary operator.
|
This operator will put an image tensor 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 <https://www.mindspore.cn/
|
||||||
|
mindinsight/docs/en/master/index.html>`_ for details.
|
||||||
|
|
||||||
Inputs:
|
Inputs:
|
||||||
- **name** (str) - The name of the input variable, it must not be an empty string.
|
- **name** (str) - The name of the input variable, it must not be an empty string.
|
||||||
|
@ -133,8 +139,8 @@ class ImageSummary(PrimitiveWithInfer):
|
||||||
...
|
...
|
||||||
... def construct(self, x):
|
... def construct(self, x):
|
||||||
... name = "image"
|
... name = "image"
|
||||||
... out = self.summary(name, x)
|
... self.summary(name, x)
|
||||||
... return out
|
... return x
|
||||||
...
|
...
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -165,7 +171,10 @@ class ImageSummary(PrimitiveWithInfer):
|
||||||
|
|
||||||
class TensorSummary(Primitive):
|
class TensorSummary(Primitive):
|
||||||
"""
|
"""
|
||||||
Outputs a tensor to a protocol buffer through a tensor summary operator.
|
This operator will put a tensor 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 <https://www.mindspore.cn/
|
||||||
|
mindinsight/docs/en/master/index.html>`_ for details.
|
||||||
|
|
||||||
Inputs:
|
Inputs:
|
||||||
- **name** (str) - The name of the input variable.
|
- **name** (str) - The name of the input variable.
|
||||||
|
@ -217,7 +226,10 @@ class TensorSummary(Primitive):
|
||||||
|
|
||||||
class HistogramSummary(PrimitiveWithInfer):
|
class HistogramSummary(PrimitiveWithInfer):
|
||||||
"""
|
"""
|
||||||
Outputs the tensor to protocol buffer through histogram summary operator.
|
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 <https://www.mindspore.cn/
|
||||||
|
mindinsight/docs/en/master/index.html>`_ for details.
|
||||||
|
|
||||||
Inputs:
|
Inputs:
|
||||||
- **name** (str) - The name of the input variable.
|
- **name** (str) - The name of the input variable.
|
||||||
|
@ -437,7 +449,7 @@ class HookBackward(PrimitiveWithInfer):
|
||||||
|
|
||||||
class Print(Primitive):
|
class Print(Primitive):
|
||||||
"""
|
"""
|
||||||
Outputs the inputs to stdout.
|
Print the inputs to stdout.
|
||||||
|
|
||||||
Refer to :func:`mindspore.ops.print` for more detail.
|
Refer to :func:`mindspore.ops.print` for more detail.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue