Skip to content

Commit

Permalink
Add the generic discrete_control_parameter_update! method which magic…
Browse files Browse the repository at this point in the history
…ally disappeared
  • Loading branch information
SouthEndMusic committed Jun 10, 2024
1 parent 68577fe commit 965686d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions core/src/callback.jl
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,22 @@ function discrete_control_parameter_update!(
return nothing
end

function discrete_control_parameter_update!(
node::AbstractParameterNode,
node_id::NodeID,
control_state::String,
)::Nothing
new_state = node.control_mapping[(node_id, control_state)]
(; node_idx) = new_state
for (field, value) in zip(keys(new_state), new_state)
if field == :node_idx
continue
end
vec = get_tmp(getfield(node, field), 0)
vec[node_idx] = value
end
end

function set_control_params!(p::Parameters, node_id::NodeID, control_state::String)::Nothing

# Check node type here to avoid runtime dispatch on the node type
Expand Down

0 comments on commit 965686d

Please sign in to comment.