Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MindInsight throws DivisionByZero error when width is 0 in histogram info #12

Open
wenkai128 opened this issue Jun 13, 2020 · 1 comment

Comments

@wenkai128
Copy link
Contributor

Environment

Hardware Environment(Ascend/GPU/CPU):

Uncomment only one /device <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/device ascend
/device gpu

/device cpu

device irrelevant

Software Environment:

  • MindSpore version (source or binary): 0.3.0
  • Python version (e.g., Python 3.7.5): 3.7
  • OS platform and distribution (e.g., Linux Ubuntu 16.04):
  • GCC/Compiler version (if compiled from source):

Describe the current behavior

MindInsight throws DivisionByZero error when width is 0 in histogram info.

histogram and width is defined in https://github.com/mindspore-ai/mindspore/blob/master/mindspore/ccsrc/utils/summary.proto

Describe the expected behavior

MindInsight handles this ill formatted data correctly.

Steps to reproduce the issue

Related log / screenshot

==> restful_api/restful_api.log <==
[ERROR] MI(746:139931119613696,MainProcess):2020-06-13-10:57:54.226.516 [mindinsight/datavisual/common/error_handler.py:56][RESTFUL_API] 'GET' '/v1/mindinsight/datavisual/histograms' detail: 'float divisi
on by zero'
[ERROR] MI(746:139931119613696,MainProcess):2020-06-13-10:57:54.226.834 [mindinsight/datavisual/common/error_handler.py:57][RESTFUL_API] float division by zero
Traceback (most recent call last):
  File "/home/wenkai/anaconda3/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/wenkai/anaconda3/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/wenkai/anaconda3/lib/python3.7/site-packages/mindinsight/backend/datavisual/train_visual_api.py", line 161, in histogram
    response = processor.get_histograms(train_id, tag)
  File "/home/wenkai/anaconda3/lib/python3.7/site-packages/mindinsight/datavisual/processors/histogram_processor.py", line 57, in get_histograms
    buckets = histogram.buckets()
  File "/home/wenkai/anaconda3/lib/python3.7/site-packages/mindinsight/datavisual/data_transform/histogram_container.py", line 253, in buckets
    self._re_sample_buckets()
  File "/home/wenkai/anaconda3/lib/python3.7/site-packages/mindinsight/datavisual/data_transform/histogram_container.py", line 228, in _re_sample_buckets
    estimated_count = (intersection / original_bucket.width) * original_bucket.count
ZeroDivisionError: float division by zero

Special notes for this issue

@wenkai128
Copy link
Contributor Author

test.zero.summary.1592016979.zip

file to reproduce this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants