Skip to content

Commit

Permalink
update submod; autodiff with callables
Browse files Browse the repository at this point in the history
  • Loading branch information
shiinamiyuki committed Oct 19, 2023
1 parent 52cc707 commit dd04749
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions luisa_compute/tests/autodiff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1371,11 +1371,15 @@ fn autodiff_callable2() {
let callable = Callable::<fn(Expr<f32>, Expr<f32>, Expr<i32>) -> Expr<f32>>::new(
&device,
track!(|x, y, t| {
switch::<Expr<f32>>(t)
.case(0, || x * 4.0)
.case(1, || x * 2.0)
.case(2, || y * 0.5)
.finish()
let ret = 0.0f32.var();
outline(|| {
*ret = switch::<Expr<f32>>(t)
.case(0, || x * 4.0)
.case(1, || x * 2.0)
.case(2, || y * 0.5)
.finish();
});
**ret
}),
);
let kernel = Kernel::<fn()>::new(
Expand Down

0 comments on commit dd04749

Please sign in to comment.