chainer / chainer-chemistry

Chainer Chemistry: A Library for Deep Learning in Biology and Chemistry
MIT License
629 stars 130 forks source link

bug fix: consider the case when metrics returns non-Variable case. #291

Closed corochann closed 5 years ago

corochann commented 5 years ago

resolves https://github.com/pfnet-research/chainer-chemistry/issues/289

Metrics function can return normal array instead of Variable, so self._convert_to_scalar(value(self.y, t).data is not ok (when the returned value is array, .data refer memoryview instead of actual value).

codecov-io commented 5 years ago

Codecov Report

Merging #291 into master will increase coverage by <.01%. The diff coverage is 100%.

@@            Coverage Diff             @@
##           master     #291      +/-   ##
==========================================
+ Coverage   83.67%   83.68%   +<.01%     
==========================================
  Files         165      165              
  Lines        7632     7636       +4     
==========================================
+ Hits         6386     6390       +4     
  Misses       1246     1246
codecov-io commented 5 years ago

Codecov Report

Merging #291 into master will increase coverage by 0.04%. The diff coverage is 100%.

@@            Coverage Diff             @@
##           master     #291      +/-   ##
==========================================
+ Coverage   83.67%   83.71%   +0.04%     
==========================================
  Files         165      165              
  Lines        7632     7657      +25     
==========================================
+ Hits         6386     6410      +24     
- Misses       1246     1247       +1
corochann commented 5 years ago

I got that error before PR (current status), and I hope it should be fixed after merging this PR.

memoryview is numpy array's data attribute.