We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This is now possible with Rc usage in #62.
Something like:
pub fn map_dff<T: Tensor<Dtype = f32>, F, Df>(mut t: T, mut f: F, mut df: Df) -> T where F: 'static + FnMut(&f32) -> f32, Df: 'static + FnMut(&f32) -> f32, { T::Device::foreach_m(t.mut_data(), &mut |x| *x = f(x)); let (t, mut tape) = t.split_tape(); let result = t.clone(); // should add a new reference, not start a new one let phantom_result = result.phantom(); tape.add_backward_op(move |grads| { let (t_grad, result_grad) = grads.mut_and_ref(&t, &phantom_result); T::Device::foreach_mrr(t_grad, t.data(), result_grad, &mut |g, t, r| { *g += df(t) * r; }); }); result.put_tape(tape)
The text was updated successfully, but these errors were encountered:
#69 adding map_df_uses_fx
d05a39d
6a61e75
da54efc
Successfully merging a pull request may close this issue.
This is now possible with Rc usage in #62.
Something like:
The text was updated successfully, but these errors were encountered: