Skip to content

Commit

Permalink
Merge pull request #917 from JuliaAI/patch-for-static-in-learning-net…
Browse files Browse the repository at this point in the history
…works

Fix signature in operation overloadings for machines
  • Loading branch information
ablaom authored Jul 25, 2023
2 parents c87d559 + 6aa001f commit 9439d84
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/machines.jl
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ last_model(mach) = isdefined(mach, :old_model) ? mach.old_model : nothing
rows=nothing,
verbosity=1,
force=false,
composite=nothing
composite=nothing,
)
Without mutating any other machine on which it may depend, perform one of the following
Expand All @@ -553,7 +553,7 @@ data to `rows` if specified:
increment `mach.state`.
If the model, `model`, bound to `mach` is a symbol, then instead perform the action using
the true model `getproperty(composite, model)`.
the true model given by `getproperty(composite, model)`. See also [`machine`](@ref).
### Training action logic
Expand Down Expand Up @@ -762,13 +762,13 @@ end

"""
fit!(mach::Machine, rows=nothing, verbosity=1, force=false)
fit!(mach::Machine, rows=nothing, verbosity=1, force=false, composite=nothing)
Fit the machine `mach`. In the case that `mach` has `Node` arguments,
first train all other machines on which `mach` depends.
To attempt to fit a machine without touching any other machine, use
`fit_only!`. For more on the internal logic of fitting see
`fit_only!`. For more on options and the the internal logic of fitting see
[`fit_only!`](@ref)
"""
Expand Down
11 changes: 6 additions & 5 deletions src/operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ for operation in OPERATIONS
get!(ret, $quoted_operation, mach)
end

function $operation(mach::Machine{<:Static}, Xraw, Xraw_more...)
function $operation(mach::Machine, Xraw, Xraw_more...)
_check_and_fit_if_warranted!(mach)
ret = $(operation)(
last_model(mach),
Expand All @@ -153,10 +153,11 @@ for operation in OPERATIONS
$operation(mach::Machine, X::AbstractNode) =
node($(operation), mach, X)

$operation(mach::Machine{<:Static},
X::AbstractNode,
Xmore::AbstractNode...) =
node($(operation), mach, X, Xmore...)
$operation(
mach::Machine,
X::AbstractNode,
Xmore::AbstractNode...,
) = node($(operation), mach, X, Xmore...)
end
eval(ex)
end
Expand Down

0 comments on commit 9439d84

Please sign in to comment.