Skip to content

Commit

Permalink
Merge pull request apache#73 from oist/vc/executor
Browse files Browse the repository at this point in the history
add function to get debug_str, similar to python
  • Loading branch information
pluskid committed Apr 9, 2016
2 parents fbcd12c + f898837 commit f7562e9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/executor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,22 @@ function copy_params_from(self::Executor, arg_params::Dict{Base.Symbol,NDArray},
end
end
end


"""
Get a debug string about internal execution plan.
Can be used to get an estimated about the memory cost.
```julia
net = ... # Symbol
dProvider = ... # DataProvider
exec = mx.simple_bind(net, mx.cpu(), data=size(dProvider.data_batch[1]))
dbg_str = mx.debug_str(exec)
println(split(ref, ['\n'])[end-2])
```
"""
function debug_str(self :: Executor)
s_ref = Ref{Cstring}()
@mxcall(:MXExecutorPrint, (MX_handle, Ptr{Cstring}), self.handle, s_ref)
bytestring(s_ref[])
end

0 comments on commit f7562e9

Please sign in to comment.