0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PyTorch などで Tensor の結果を numpy.testing で比較するメモ

Posted at

背景

  • 自前 C++ 機械学習が, PyTorch などとの結果と一致するかどうか調べたい
    • Tensor データや, 各 function(op)の計算結果(Tensor or array)など
    • データコンバーターで, 正しく weight などがコンバートできているか調べたい.

PyTorch などのレベルではお手軽に使えるものはなさそうです.

numpy にテスト関数がいくつかあります.

numpy.testing.assert_allclose

onnx-chainer での利用例が参考にし,

numpy.testing.assert_allclose を使えばよさそうです!

TODO

  • 誤差があるときはテキストではわかりずらいので, matplotlib あたりで可視化できるようにする.
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?