Skip to content

Commit

Permalink
Merge pull request #283 from iblis17/issue-283
Browse files Browse the repository at this point in the history
update OpReqType enum
  • Loading branch information
vchuravy committed Sep 25, 2017
2 parents b68ca2e + 16c2c5a commit bb88d79
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 12 additions & 0 deletions src/base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ const MX_handle = Ptr{Void}
const char_p = Ptr{UInt8}
const char_pp = Ptr{char_p}

################################################################################
# Enumeration from MXNet headers
################################################################################
# OpReqType in include/mxnet/op_attr_types.h
@enum GRAD_REQ GRAD_NOP=0 GRAD_WRITE=1 GRAD_INPLACE=2 GRAD_ADD=3
const grad_req_map = Dict{Symbol, GRAD_REQ}(
:nop => GRAD_NOP, # no operation, do not write anything
:write => GRAD_WRITE, # write gradient to provided space
:inplace => GRAD_INPLACE, # perform an inplace write
:add => GRAD_ADD, # add to the provided space
)

################################################################################
# Initialization and library API entrance
################################################################################
Expand Down
2 changes: 0 additions & 2 deletions src/executor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ function _get_ndarray_inputs(arg_key::AbstractString, args::Dict{Base.Symbol,NDA
return (args_hdr, args_vec)
end

@enum GRAD_REQ GRAD_NOP=0 GRAD_WRITE=1 GRAD_ADD=3

"""
bind(sym, ctx, args; args_grad=Dict(), aux_states=Dict(), grad_req=GRAD_WRITE)
Expand Down

0 comments on commit bb88d79

Please sign in to comment.