diff --git a/tutorials/source_en/advanced_use/visualization_tutorials.md b/tutorials/source_en/advanced_use/visualization_tutorials.md index a50b74c14ef4c9e0fefdae2e9dc2678a24d784c4..5f2cb6823a7d6c55a98018ea9d4a04bc82e8325d 100644 --- a/tutorials/source_en/advanced_use/visualization_tutorials.md +++ b/tutorials/source_en/advanced_use/visualization_tutorials.md @@ -80,7 +80,6 @@ class MyOptimizer(Optimizer): # Initialize ScalarSummary self.sm_scalar = P.ScalarSummary() self.histogram_summary = P.HistogramSummary() - self.param_count = len(self.parameters) self.weight_names = [param.name for param in self.parameters] def construct(self, grads): @@ -89,8 +88,9 @@ class MyOptimizer(Optimizer): self.sm_scalar("learning_rate", learning_rate) # Record weight - for i in range(self.param_count): - self.histogram_summary(self.weight_names[i], self.paramters[i]) + self.histogram_summary(self.weight_names[0], self.paramters[0]) + # Record gradient + self.histogram_summary(self.weight_names[0] + ".gradient", grads[0]) ...... @@ -169,6 +169,8 @@ Use the `save_graphs` option of `context` to record the computational graph afte > Currently MindSpore supports recording computational graph after operator fusion for Ascend 910 AI processor only. +> It's recommended that you reduce calls to `HistogramSummary` under 10 times per batch. The more you call `HistogramSummary`, the more performance overhead. + ## MindInsight Commands ### View the command help information. @@ -388,4 +390,4 @@ Figure 16 shows the function area of the parameter distribution histogram, inclu - Tag selection: Select the required tags to view the corresponding histogram. - Vertical axis: Select any of `Step`, `Relative time`, and `Absolute time` as the data displayed on the vertical axis of the histogram. -- Angle of view: Select either `Front` or `Top`. `Front` view refers to viewing the histogram from the front view. In this case, data between different steps is overlapped. `Top` view refers to viewing the histogram at an angle of 45 degrees. In this case, data between different steps can be presented. \ No newline at end of file +- Angle of view: Select either `Front` or `Top`. `Front` view refers to viewing the histogram from the front view. In this case, data between different steps is overlapped. `Top` view refers to viewing the histogram at an angle of 45 degrees. In this case, data between different steps can be presented. diff --git a/tutorials/source_zh_cn/advanced_use/visualization_tutorials.md b/tutorials/source_zh_cn/advanced_use/visualization_tutorials.md index b2f7648b53d7d8af8855bd2d61eec826d0c6495e..37cbed6a2dbf1d6a4d86ad50706f761a70111e57 100644 --- a/tutorials/source_zh_cn/advanced_use/visualization_tutorials.md +++ b/tutorials/source_zh_cn/advanced_use/visualization_tutorials.md @@ -85,7 +85,6 @@ class MyOptimizer(Optimizer): # Initialize ScalarSummary self.sm_scalar = P.ScalarSummary() self.histogram_summary = P.HistogramSummary() - self.param_count = len(self.parameters) self.weight_names = [param.name for param in self.parameters] def construct(self, grads): @@ -94,8 +93,9 @@ class MyOptimizer(Optimizer): self.sm_scalar("learning_rate", learning_rate) # Record weight - for i in range(self.param_count): - self.histogram_summary(self.weight_names[i], self.paramters[i]) + self.histogram_summary(self.weight_names[0], self.paramters[0]) + # Record gradient + self.histogram_summary(self.weight_names[0] + ".gradient", grads[0]) ...... @@ -175,6 +175,8 @@ def test_summary(): > 目前MindSpore仅支持在Ascend 910 AI处理器上导出算子融合后的计算图。 +> 一个batch中,`HistogramSummary`算子的调用次数请尽量控制在10次以下,调用次数越多,性能开销越大。 + ## MindInsight相关命令 ### 查看命令帮助信息