読者です 読者をやめる 読者になる 読者になる

OrangePiOneでモノクロ画像のカラー化環境構築に失敗した話

 昨年夏に登場し話題になった、早大の研究チームによるモノクロ画像に着色するツールを試してみたいと思いました。

 ソースはCreative Commons Attribution-NonCommercial-ShareAlike 4.0ライセンスでGitHubで公開されています。
github.com

 READMEによればTorch7が必要ということで、OSXなりUbuntu環境が必要ということになります。
 普段使いのWindowsPCでは(VMなどを用いなければ)試せないため、放置気味のArmbianを導入済みのOrange Pi Oneで試してみることにしました。

(※結果的に動作させることには成功していません。メモリが潤沢な端末でないと厳しそうです。)
 

Torch 7の導入

 Torch公式の手順通り、以下のコマンドを実行します。

git clone https://github.com/torch/distro.git ~/torch --recursive
cd ~/torch; bash install-deps;
./install.sh
source ~/.bashrc

Torch | Getting started with Torch

 Orange Pi Oneの低速なストレージ(microSD)と一昔前のスマートフォン並みのプロセッサというシステムリソースの貧弱さも相まってか、Torchを導入するだけで1時間半程度は掛かったと思います。と言っても、基本的にはほったらかしでいいのですが、途中でsuするためのパスワード入力を求められるのと、.bashrcにPATHとLD_LIBRARY_PATHを追加してよいかの確認を求められます。

 ビルド中に大量のwarningが出ていたのですが、ログは吐かれていない模様*1で、確認しようが無いのでとりあえず静観することに。
 

siggraph2016_colorizationの導入

 こちらはスクリプトファイルなので、ビルドは無く単純に配置して、必要なモデルをダウンロードすればよい模様。ということで、以下のコマンドを叩きました。

git clone https://github.com/satoshiiizuka/siggraph2016_colorization/ ~/colorize --recursive
cd ~/colorize/
./download_model.sh

f:id:kachine:20170210235407p:plain
↑Time to colorize!表記がキュートなのでスクリーンショット*2
 

実行

 siggraph2016_colorizationのサンプルとして記載されている通り以下のコマンドを実行します。

th colorize.lua ansel_colorado_1941.png out.png

 

実行結果
opuser@orangepione:~/colorize$ th colorize.lua ansel_colorado_1941.png out.png
/home/opuser/torch/install/bin/luajit: /home/opuser/torch/install/share/lua/5.1/torch/File.lua:370: table index is nil
stack traceback:
        /home/opuser/torch/install/share/lua/5.1/torch/File.lua:370: in function 'readObject'
        /home/opuser/torch/install/share/lua/5.1/nn/Module.lua:192: in function 'read'
        /home/opuser/torch/install/share/lua/5.1/torch/File.lua:351: in function 'readObject'
        /home/opuser/torch/install/share/lua/5.1/torch/File.lua:369: in function 'readObject'
        /home/opuser/torch/install/share/lua/5.1/torch/File.lua:369: in function 'readObject'
        /home/opuser/torch/install/share/lua/5.1/torch/File.lua:369: in function 'readObject'
        /home/opuser/torch/install/share/lua/5.1/torch/File.lua:369: in function 'readObject'
        /home/opuser/torch/install/share/lua/5.1/torch/File.lua:353: in function 'readObject'
        /home/opuser/torch/install/share/lua/5.1/torch/File.lua:369: in function 'readObject'
        /home/opuser/torch/install/share/lua/5.1/torch/File.lua:369: in function 'readObject'
        /home/opuser/torch/install/share/lua/5.1/torch/File.lua:353: in function 'readObject'
        /home/opuser/torch/install/share/lua/5.1/torch/File.lua:369: in function 'readObject'
        .../opuser/torch/install/share/lua/5.1/nngraph/gmodule.lua:495: in function 'read'
        /home/opuser/torch/install/share/lua/5.1/torch/File.lua:351: in function 'readObject'
        /home/opuser/torch/install/share/lua/5.1/torch/File.lua:369: in function 'readObject'
        /home/opuser/torch/install/share/lua/5.1/torch/File.lua:409: in function 'load'
        colorize.lua:23: in main chunk
        [C]: in function 'dofile'
        ...radm/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
        [C]: at 0x00014895

 上記の通り、"table index is nil"エラーが発生する。

 エラー発生個所のcolorize.luaの23行目を確認すると、

local d        = torch.load( 'colornet.t7' )

 モデルをファイルからロードする箇所で怒られている模様。

 LUAは全然詳しくないのですが単にファイルをロードするだけでエラーになるなら、colorize.luaの問題というより、Torchが正しく機能していないというか環境構築に失敗している感じ?
 TorchのGettingStartedを読み返すと、標準のJIT版ではないLUAを使うインストール方法も載っているので、試してみることにする*3
 

プリコンパイルLUAでTorchを導入

 git cloneはJIT版で導入時に行っているので、Torch公式の手順の内、以下のコマンドを実行。

cd ~/torch
./clean.sh
TORCH_LUA_VERSION=LUA52 ./install.sh

 

再実行

 siggraph2016_colorizationのサンプルを再実行。

opuser@orangepione:~/colorize$ th colorize.lua ansel_colorado_1941.png out.png
not found: THNN_FloatAbs_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_FloatAbsCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatAbsCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatBCECriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatBCECriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatClassNLLCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatClassNLLCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatSpatialClassNLLCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatSpatialClassNLLCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatELU_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatELU_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatDistKLDivCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatDistKLDivCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatHardTanh_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatHardTanh_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatLeakyReLU_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatLeakyReLU_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatLookupTable_accGradParameters/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatMarginCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatMarginCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatSoftMarginCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatSoftMarginCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatMSECriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatMSECriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatMultiLabelMarginCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatMultiLabelMarginCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatMultiMarginCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatMultiMarginCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatPReLU_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_FloatRReLU_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatRReLU_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatSmoothL1Criterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatSmoothL1Criterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatSparseLinear_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_FloatTanh_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_FloatThreshold_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatThreshold_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatBatchNormalization_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatBatchNormalization_backward/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatSpatialConvolutionMap_accGradParameters/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_FloatSpatialAveragePooling_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatSpatialAveragePooling_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatSpatialFractionalMaxPooling_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_FloatSpatialDilatedConvolution_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_FloatSpatialMaxPooling_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatSpatialMaxPooling_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatSpatialDilatedMaxPooling_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatSpatialDilatedMaxPooling_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_Floatunfolded_copy/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_FloatVolumetricFullConvolution_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_FloatVolumetricMaxPooling_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatVolumetricMaxPooling_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatVolumetricDilatedMaxPooling_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatVolumetricDilatedMaxPooling_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatSpatialReflectionPadding_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_DoubleAbsCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleAbsCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleBCECriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleBCECriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleClassNLLCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleClassNLLCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleSpatialClassNLLCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleSpatialClassNLLCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleELU_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleELU_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleDistKLDivCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleDistKLDivCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleHardTanh_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleHardTanh_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleLeakyReLU_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleLeakyReLU_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleLogSigmoid_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_DoubleLookupTable_accGradParameters/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleMarginCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleMarginCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleSoftMarginCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleSoftMarginCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleMSECriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleMSECriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleMultiLabelMarginCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleMultiLabelMarginCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleMultiMarginCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleMultiMarginCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleRReLU_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleRReLU_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleSigmoid_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_DoubleSmoothL1Criterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleSmoothL1Criterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleSparseLinear_legacyZeroGradParameters/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_DoubleThreshold_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleThreshold_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleTemporalSubSampling_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_DoubleBatchNormalization_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleBatchNormalization_backward/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleSpatialConvolutionLocal_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_DoubleSpatialAveragePooling_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleSpatialAveragePooling_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleSpatialFullConvolution_accGradParameters/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_DoubleSpatialMaxPooling_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleSpatialMaxPooling_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleSpatialDilatedMaxPooling_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleSpatialDilatedMaxPooling_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleSpatialSubSampling_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_DoubleVolumetricConvolution_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_DoubleVolumetricDilatedConvolution_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_DoubleVolumetricMaxPooling_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleVolumetricMaxPooling_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleVolumetricDilatedMaxPooling_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleVolumetricDilatedMaxPooling_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleVolumetricReplicationPadding_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
/home/opuser/torch/install/bin/lua: /home/opuser/torch/install/share/lua/5.2/torch/File.lua:370: table index is nil
stack traceback:
        /home/opuser/torch/install/share/lua/5.2/torch/File.lua:370: in function 'readObject'
        /home/opuser/torch/install/share/lua/5.2/nn/Module.lua:192: in function 'read'
        /home/opuser/torch/install/share/lua/5.2/torch/File.lua:351: in function 'readObject'
        /home/opuser/torch/install/share/lua/5.2/torch/File.lua:369: in function 'readObject'
        /home/opuser/torch/install/share/lua/5.2/torch/File.lua:369: in function 'readObject'
        /home/opuser/torch/install/share/lua/5.2/torch/File.lua:369: in function 'readObject'
        /home/opuser/torch/install/share/lua/5.2/torch/File.lua:369: in function 'readObject'
        /home/opuser/torch/install/share/lua/5.2/torch/File.lua:353: in function 'readObject'
        /home/opuser/torch/install/share/lua/5.2/torch/File.lua:369: in function 'readObject'
        /home/opuser/torch/install/share/lua/5.2/torch/File.lua:369: in function 'readObject'
        /home/opuser/torch/install/share/lua/5.2/torch/File.lua:353: in function 'readObject'
        /home/opuser/torch/install/share/lua/5.2/torch/File.lua:369: in function 'readObject'
        .../opuser/torch/install/share/lua/5.2/nngraph/gmodule.lua:495: in function 'read'
        /home/opuser/torch/install/share/lua/5.2/torch/File.lua:351: in function 'readObject'
        /home/opuser/torch/install/share/lua/5.2/torch/File.lua:369: in function 'readObject'
        /home/opuser/torch/install/share/lua/5.2/torch/File.lua:409: in function 'load'
        colorize.lua:23: in main chunk
        [C]: in function 'dofile'
        ...radm/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
        [C]: in ?

 ギャー、エラーメッセージが増えた。とは言っても、直接的にエラー原因の解消につながりそうなメッセージも無いですし、元を辿れば従来同様colorize.luaの23行目、すなわちモデルのロード時に発生しています。

 当該箇所のtorch.loadを(colorize.luaではなく、広くTorch一般の情報として)調べてみると、ASCIIを指定すると当該エラーが起きなくなるという類似事例が見つかったので、以下のように書き換えてみることにしました。

local d        = torch.load( 'colornet.t7', 'ascii' )

 

再々実行
opuser@orangepione:~/colorize$ th colorize.lua ansel_colorado_1941.png out.png
not found: THNN_FloatAbs_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_FloatAbsCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatAbsCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatBCECriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatBCECriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatClassNLLCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatClassNLLCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatSpatialClassNLLCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatSpatialClassNLLCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatELU_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatELU_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatDistKLDivCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatDistKLDivCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatHardTanh_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatHardTanh_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatLeakyReLU_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatLeakyReLU_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatLookupTable_accGradParameters/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatMarginCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatMarginCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatSoftMarginCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatSoftMarginCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatMSECriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatMSECriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatMultiLabelMarginCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatMultiLabelMarginCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatMultiMarginCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatMultiMarginCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatPReLU_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_FloatRReLU_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatRReLU_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatSmoothL1Criterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatSmoothL1Criterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatSparseLinear_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_FloatTanh_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_FloatThreshold_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatThreshold_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatBatchNormalization_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatBatchNormalization_backward/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatSpatialConvolutionMap_accGradParameters/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_FloatSpatialAveragePooling_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatSpatialAveragePooling_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatSpatialFractionalMaxPooling_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_FloatSpatialDilatedConvolution_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_FloatSpatialMaxPooling_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatSpatialMaxPooling_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatSpatialDilatedMaxPooling_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatSpatialDilatedMaxPooling_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_Floatunfolded_copy/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_FloatVolumetricFullConvolution_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_FloatVolumetricMaxPooling_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatVolumetricMaxPooling_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatVolumetricDilatedMaxPooling_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatVolumetricDilatedMaxPooling_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_FloatSpatialReflectionPadding_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_DoubleAbsCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleAbsCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleBCECriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleBCECriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleClassNLLCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleClassNLLCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleSpatialClassNLLCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleSpatialClassNLLCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleELU_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleELU_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleDistKLDivCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleDistKLDivCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleHardTanh_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleHardTanh_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleLeakyReLU_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleLeakyReLU_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleLogSigmoid_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_DoubleLookupTable_accGradParameters/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleMarginCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleMarginCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleSoftMarginCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleSoftMarginCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleMSECriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleMSECriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleMultiLabelMarginCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleMultiLabelMarginCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleMultiMarginCriterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleMultiMarginCriterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleRReLU_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleRReLU_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleSigmoid_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_DoubleSmoothL1Criterion_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleSmoothL1Criterion_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleSparseLinear_legacyZeroGradParameters/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_DoubleThreshold_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleThreshold_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleTemporalSubSampling_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_DoubleBatchNormalization_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleBatchNormalization_backward/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleSpatialConvolutionLocal_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_DoubleSpatialAveragePooling_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleSpatialAveragePooling_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleSpatialFullConvolution_accGradParameters/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_DoubleSpatialMaxPooling_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleSpatialMaxPooling_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleSpatialDilatedMaxPooling_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleSpatialDilatedMaxPooling_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleSpatialSubSampling_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_DoubleVolumetricConvolution_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_DoubleVolumetricDilatedConvolution_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
not found: THNN_DoubleVolumetricMaxPooling_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleVolumetricMaxPooling_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleVolumetricDilatedMaxPooling_updateOutput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleVolumetricDilatedMaxPooling_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: NYI: call arg type
not found: THNN_DoubleVolumetricReplicationPadding_updateGradInput/home/opuser/torch/install/share/lua/5.2/nn/THNN.lua:108: internal error: missing link for to_typed_pointer
/home/opuser/torch/install/bin/lua: /home/opuser/torch/install/share/lua/5.2/torch/File.lua:259: read error: read 0 blocks instead of 1 at /home/opuser/torch/pkg/torch/lib/TH/THDiskFile.c:349
stack traceback:
        [C]: in function 'readInt'
        /home/opuser/torch/install/share/lua/5.2/torch/File.lua:259: in function 'readObject'
        /home/opuser/torch/install/share/lua/5.2/torch/File.lua:409: in function 'load'
        colorize.lua:23: in main chunk
        [C]: in function 'dofile'
        ...radm/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
        [C]: in ?

 相変わらずcolorize.luaの23行目をトリガとしてエラーが継続していますが、"table index is nil"から"read error: read 0 blocks instead of 1"に変わっています。
 このエラーメッセージをキーワードに調べてみると、確定的な情報は無いものの64bit環境か否かとかメモリ搭載量といった環境依存で発生有無に違いがありそうな雰囲気を感じます。もちろん、Orange Pi Oneなんてマイナー端末で試しているユーザは見当たらず。。。本家Raspberry Piでも同様のユーザはいるようですが。。。
 

LUAJIT版に戻してLUAROCKSで新パッケージを導入する

 TorchのGettingStartedには以下のコマンドを叩くと新パッケージが導入されるとあるので、JIT版に戻したうえで以下のコマンドを叩きました。

luarocks install image
luarocks list

 

再再々実行
opuser@orangepione:~/colorize$ th colorize.lua ansel_colorado_1941.png out.png
/home/opuser/torch/install/bin/luajit: /home/opuser/torch/install/share/lua/5.1/torch/File.lua:259: read error: read 0 blocks instead of 1 at /home/opuser/torch/pkg/torch/lib/TH/THDiskFile.c:349
stack traceback:
        [C]: in function 'readInt'
        /home/opuser/torch/install/share/lua/5.1/torch/File.lua:259: in function 'readObject'
        /home/opuser/torch/install/share/lua/5.1/torch/File.lua:409: in function 'load'
        colorize.lua:23: in main chunk
        [C]: in function 'dofile'
        ...radm/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
        [C]: at 0x00014895

 変わらず"read error: read 0 blocks instead of 1"です。
 
 手詰まり感を覚えつつ、colorize.luaの23行目で読み込もうとしているモデルcolornet.t7のサイズを何となく確認すると、700MB弱ありました。

opuser@orangepione:~/colorize$ ls -l colornet.t7
-rw-rw-r-- 1 opuser opuser 694703608 Apr 22  2016 colornet.t7

 Orange Pi Oneの物理メモリは512MBしかないし、仮想メモリも考慮してもロードできないんじゃないかと思い、改めて確認すると以下の通り。

opuser@orangepione:~/colorize$ free -m
              total        used        free      shared  buff/cache   available
Mem:            494          32         175         202         286         235
Swap:           127           0         127

 どう頑張ってもこのOrange Pi Oneでは175+127=302MBしかロードできない訳で、700MB弱もロードできるはずがないのです。
 エラーメッセージから想像つきにくいですが、単にメモリ不足な気がしてきました。
 

TorchのNNのテスト

 プリコンパイル版で試行していた際に最も多く出力されていた"NYI: call arg type"について調べていたところ、以下の投稿が見つかりました。
nn not working · Issue #803 · torch/nn · GitHub

 このスレッド中で、

th -lnn -e "nn.test()"

 を叩けばTorchのNeural Network機能のテストが出来ることが判りました。

 早速試してみた結果、エラーが2つ検出されました。

Completed 96799 asserts in 187 tests with 0 failures and 2 errors
--------------------------------------------------------------------------------
Add
 Function call failed
$ Torch: not enough memory: you tried to allocate 0GB. Buy new RAM! at /home/opuser/torch/pkg/torch/lib/TH/THGeneral.c:270
stack traceback:
        [C]: at 0xb6b61b65
        [C]: in function 'Tensor'
        /home/opuser/torch/install/share/lua/5.1/nn/Jacobian.lua:15: in function 'backward'
        /home/opuser/torch/install/share/lua/5.1/nn/Jacobian.lua:235: in function 'testJacobian'
        /home/opuser/torch/install/share/lua/5.1/nn/test.lua:68: in function </home/opuser/torch/install/share/lua/5.1/nn/test.lua:41>
        [C]: in function 'xpcall'
        /home/opuser/torch/install/share/lua/5.1/torch/Tester.lua:477: in function '_pcall'
        /home/opuser/torch/install/share/lua/5.1/torch/Tester.lua:436: in function '_run'
        /home/opuser/torch/install/share/lua/5.1/torch/Tester.lua:355: in function 'run'
        /home/opuser/torch/install/share/lua/5.1/nn/test.lua:7515: in function 'test'
        [string "nn.test()"]:1: in main chunk
        [C]: in function 'pcall'
        ...radm/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:136: in main chunk
        [C]: at 0x00014895

--------------------------------------------------------------------------------
SpatialDilatedConvolution
 Function call failed
$ Torch: not enough memory: you tried to allocate 0GB. Buy new RAM! at /home/opuser/torch/pkg/torch/lib/TH/THGeneral.c:270
stack traceback:
        [C]: at 0xb6b61b65
        [C]: in function 'Tensor'
        /home/opuser/torch/install/share/lua/5.1/nn/Jacobian.lua:15: in function 'backward'
        /home/opuser/torch/install/share/lua/5.1/nn/Jacobian.lua:235: in function 'testJacobian'
        /home/opuser/torch/install/share/lua/5.1/nn/test.lua:3250: in function </home/opuser/torch/install/share/lua/5.1/nn/test.lua:3191>
        [C]: in function 'xpcall'
        /home/opuser/torch/install/share/lua/5.1/torch/Tester.lua:477: in function '_pcall'
        /home/opuser/torch/install/share/lua/5.1/torch/Tester.lua:436: in function '_run'
        /home/opuser/torch/install/share/lua/5.1/torch/Tester.lua:355: in function 'run'
        /home/opuser/torch/install/share/lua/5.1/nn/test.lua:7515: in function 'test'
        [string "nn.test()"]:1: in main chunk
        [C]: in function 'pcall'
        ...radm/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:136: in main chunk
        [C]: at 0x00014895

--------------------------------------------------------------------------------
/home/opuser/torch/install/share/lua/5.1/torch/Tester.lua:363: An error was found while running tests!

 検出されたエラーはいずれも、"not enough memory: you tried to allocate 0GB. Buy new RAM!"ですって。
 というわけでメモリ不足で確定。Buy new RAMと言われても、増設不能なシングルボードコンピュータでは不可能なわけで。
 



以上。

*1:正確には~/torch/install/install.logが出力されているものの、このログにはビルド時のwarningを含むコンソール出力は記録されていない。

*2:この時点ではモデルが700MB弱にも及ぶことに気付いていませんでした。

*3:JIT版のようにランタイム時に意味不明なエラーになるのではなく、プリコンパイル時にエラーが起きてくれるのではないかと期待して。