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
Add more statement reflection to start looking at assignment statements
And update build and version number.
This test case:
test: @autodiff@print type = {
// A simple first function would be:
// func: (a: double, b: double) -> double = { return a + b; }
func: (a: double, b: double) -> (r: double) = { r = a + b; }
// The generated autodiff forward transformation would be:
// func_diff: (a: double, a_d: double, b: double, b_d: double) -> (r: double, r_d: double) = {
// r_d = a * b_d + b * a_d;
// r = a * b;
// }
}
Now generates this output, recognizing that the statement is an assignment, and that the left-hand side of the assignment is a parameter or return name (but not yet manipulating the right-hand expression):
test:/* @autodiff@print */ type =
{
func:(
in a: double,
in b: double,
) -> (out r: double, ) =
{
r = a + b;
return;
}
func_diff:(
in a: double,
in a_d: double,
in b: double,
in b_d: double,
) -> (
out r: double = 1,
out r_d: double = 1,
) =
{
r_d = TODO_computed_derivative_expression;
r = TODO_changed_original_expression;
return;
}
}
0 commit comments