強火で進め

このブログではプログラム関連の記事を中心に書いてます。

エラー「Tensor data cannot be read from, use .MakeReadable() to allow reading from tensor.」の修正方法

GitHubで配布されいてるUnity Sentisを使ったプロジェクトを実行してみた所、以下の様なエラーが発生しました。

InvalidOperationException: Tensor data cannot be read from, use .MakeReadable() to allow reading from tensor.

調べてみると原因はバージョンアップ時の仕様変更みたいです。

参考情報 docs.unity3d.com

出力されたテンソルを使う前にoutputTensor.MakeReadable()の様にMakeReadable()を呼ぶ事で無事、動作しました。