wangkuiyi / gotorch

A Go idiomatic binding to the C++ core of PyTorch
MIT License
305 stars 35 forks source link

fix mnist doc and code #371

Closed qiukun closed 3 years ago

qiukun commented 3 years ago

fix some doc and use gocv to load image instead of image per #323

before:

mnist ➤ go run . predict mnist_png/testing/1/385.png                                                                                                      git:develop*
2020/10/25 20:53:33 No CUDA found; CPU only
panic: ToTensorTransformer can not transform the input type: *image.Gray

goroutine 1 [running, locked to thread]:
github.com/wangkuiyi/gotorch/vision/transforms.ToTensorTransformer.Run(0x41b4d20, 0xc00002b980, 0x41ffa20)
        /Users/qiu/go/src/github.com/wangkuiyi/gotorch/vision/transforms/to_tensor.go:68 +0x557
main.predictFile(0x7ffeefbff482, 0x1b, 0xc00002b940)
        /Users/qiu/go/src/github.com/wangkuiyi/gotorch/example/mnist/mnist.go:183 +0x1a6
main.predict(0x41c988f, 0x14, 0xc0000121d0, 0x1, 0x1)
        /Users/qiu/go/src/github.com/wangkuiyi/gotorch/example/mnist/mnist.go:148 +0x1c5
main.main()
        /Users/qiu/go/src/github.com/wangkuiyi/gotorch/example/mnist/mnist.go:55 +0x50c
exit status 2

after:

mnist ➤ go run . predict mnist_png/testing/1/385.png                                                                                                      git:develop*
2020/10/25 20:56:11 No CUDA found; CPU only
1
codecov[bot] commented 3 years ago

Codecov Report

Merging #371 into develop will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #371   +/-   ##
========================================
  Coverage    87.75%   87.75%           
========================================
  Files           33       33           
  Lines         1503     1503           
========================================
  Hits          1319     1319           
  Misses         121      121           
  Partials        63       63