You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.
grad = require 'autograd'
params = {
[":a1"] = 1,
[":a2"] = 2
}
f = function(params, x)
val = x["value"]
w = params[x["address"].raw]
return w * val
end
df = grad(f, {optimize = true})
x = {value = 47, address = ":a1"}
dparam, loss = df(params, x)
produces
return function(locals, rlocals, vlocals)
local nn = require('autograd').nn
local util = require('autograd.util')
return function(p1, p2)
locals[1] = p2.value * 1
locals[2] = p1.:a1 * p2.value
return {
:a1 = locals[1],
}, locals[2]
end
end
[string "return function(locals, rlocals, vlocals)..."]:6: '<name>' expected near ':'
/Users/username/torch/install/bin/luajit: ...re/lua/5.1/autograd/runtime/codegen/backend/lua/init.lua:757: failed to parse generated code.
stack traceback:
[C]: in function 'error'
...re/lua/5.1/autograd/runtime/codegen/backend/lua/init.lua:757: in function 'generateFn'
.../install/share/lua/5.1/autograd/runtime/codegen/init.lua:140: in function 'df'
test2.lua:25: in main chunk
[C]: in function 'dofile'
...nhle/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
[C]: at 0x010c506bc0
while running
grad = require 'autograd'
params = {
["a1"] = 1,
["a2"] = 2
}
f = function(params, x)
val = x["value"]
w = params[x["address"].raw]
return w * val
end
df = grad(f, {optimize = true})
x = {value = 47, address = "a1"}
dparam, loss = df(params, x)
doesn't.
In the first case, keys of params are strings that start with a colon while in the second they don't.
The text was updated successfully, but these errors were encountered:
Running the following:
produces
while running
doesn't.
In the first case, keys of
params
are strings that start with a colon while in the second they don't.The text was updated successfully, but these errors were encountered: