oramasearch / onnx-go

onnx-go gives the ability to import a pre-trained neural network within Go without being linked to a framework or library.
https://blog.owulveryck.info/2019/04/03/from-a-project-to-a-product-the-state-of-onnx-go.html
MIT License
704 stars 72 forks source link

Fix the reshape operator when the new shape contains only 1 dimension. #126

Closed bezineb5 closed 5 years ago

bezineb5 commented 5 years ago

When the new shape only contains one dimension (scalar tensor), tensor.Value().Data() returns an int64 instead of a slice, which leads to the error: Cannot reshape, bad output shape -1

codecov[bot] commented 5 years ago

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #126      +/-   ##
==========================================
+ Coverage   85.16%   85.16%   +<.01%     
==========================================
  Files         394      394              
  Lines       10420    10423       +3     
==========================================
+ Hits         8874     8877       +3     
  Misses       1341     1341              
  Partials      205      205
Impacted Files Coverage Δ
backend/x/gorgonnx/reshape.go 84.21% <100%> (+1.35%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 142ad98...b1d6949. Read the comment docs.