You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: DifferentiationInterfaceTest/src/scenarios/modify.jl
+49Lines changed: 49 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -163,6 +163,54 @@ function closurify(scen::Scenario{op,pl_op,pl_fun}) where {op,pl_op,pl_fun}
163
163
)
164
164
end
165
165
166
+
struct UnknownActivityReturn{pl_fun,F}
167
+
f::F
168
+
end
169
+
170
+
function Base.show(io::IO, f::UnknownActivityReturn)
171
+
returnprint(io, "UnknownActivityReturn($(f.f))")
172
+
end
173
+
174
+
function (f::UnknownActivityReturn{:out})(x, yc, return_constant::Bool)
175
+
if return_constant
176
+
returncopy(yc)
177
+
else
178
+
return f.f(x)
179
+
end
180
+
end
181
+
182
+
function (f::UnknownActivityReturn{:in})(y, x, yc, return_constant::Bool)
183
+
if return_constant
184
+
copyto!(y, copy(yc))
185
+
else
186
+
f.f(y, x)
187
+
end
188
+
returnnothing
189
+
end
190
+
191
+
"""
192
+
unknown_activity(scen::Scenario)
193
+
194
+
Return a new scenario identical to `scen` except that the function now takes an additional constant argument which is the theoretical output, and a constant boolean condition stating whether or not that output should be recomputed.
195
+
"""
196
+
functionunknown_activity(scen::Scenario{op,pl_op,pl_fun}) where {op,pl_op,pl_fun}
0 commit comments