twitter-archive / torch-autograd

Autograd automatically differentiates native Torch code
Apache License 2.0
560 stars 115 forks source link

Failed to parse generated code when optimize=true #178

Open farleylai opened 5 years ago

farleylai commented 5 years ago

I am working on implementing SSIM in Torch7 with autograd. Everything works as expected. However, when optimize is set to true, the following error is thrown:

[string "return function(locals, rlocals, vlocals, obj..."]:15: ')' expected near ','
/home/ml/farleylai/Downloads/pkg/torch/install/bin/luajit: ...re/lua/5.1/autograd/runtime/codegen/backend/lua/init.lua:775: failed to parse generated code.
stack traceback:
    [C]: in function 'error'
    ...re/lua/5.1/autograd/runtime/codegen/backend/lua/init.lua:775: in function 'generateFn'
    .../install/share/lua/5.1/autograd/runtime/codegen/init.lua:140: in function 'fn'
    .../pkg/torch/install/share/lua/5.1/autograd/optim/init.lua:11: in function 'optim'
    demo-simple.lua:53: in main chunk
    [C]: in function 'dofile'
    .../pkg/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
    [C]: at 0x00405d50

The sources are attached FYI:

Any ideas?