Skip to content

Commit

Permalink
Update ext/MathOptAIPythonCallExt.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored Jan 16, 2025
1 parent b14c820 commit e637bc9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ext/MathOptAIPythonCallExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ function MathOptAI.GrayBox(
# We do this instead of `torch_model[-1].out_features` as the last layer
# may not support out_features.
z = torch.zeros(length(x))
return PythonCall.pyconvert(Int, PythonCall.pybuiltins.len(torch_model(z)))
y = torch_model(z)
return PythonCall.pyconvert(Int, PythonCall.pybuiltins.len(y))
end
function callback(x)
py_x = torch.tensor(collect(x); device = device)
Expand Down

0 comments on commit e637bc9

Please sign in to comment.