diff options
author | Laurent Mazare <laurent.mazare@gmail.com> | 2024-02-13 14:26:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-13 14:26:32 +0100 |
commit | ad73e93da2cf7311cb5c5bc39250aa335c5f9b76 (patch) | |
tree | 5b5ea591d0fda870f4499869e3a8feb9718cfebf /candle-core/src/backprop.rs | |
parent | 13c67226e68de216b731707067f7e68af0438821 (diff) | |
download | candle-ad73e93da2cf7311cb5c5bc39250aa335c5f9b76.tar.gz candle-ad73e93da2cf7311cb5c5bc39250aa335c5f9b76.tar.bz2 candle-ad73e93da2cf7311cb5c5bc39250aa335c5f9b76.zip |
Detach the tensors on batch-norm eval. (#1702)
* Detach the tensors on batch-norm eval.
* Fix pyo3 bindings.
* Black tweak.
* Formatting.
* Also update the pyo3-onnx formatting.
* Apply black.
Diffstat (limited to 'candle-core/src/backprop.rs')
-rw-r--r-- | candle-core/src/backprop.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/candle-core/src/backprop.rs b/candle-core/src/backprop.rs index c152f31f..e7e3e129 100644 --- a/candle-core/src/backprop.rs +++ b/candle-core/src/backprop.rs @@ -175,7 +175,7 @@ impl Tensor { // the backprop graph of the backprop itself. This would be an issue for second order // derivatives but these are out of scope at the moment. let do_not_detach = CANDLE_GRAD_DO_NOT_DETACH.with(|b| *b); - let grad = if do_not_detach { grad } else { grad.detach()? }; + let grad = if do_not_detach { grad } else { grad.detach() }; if let Some(op) = node.op() { match op { Op::Binary(lhs, rhs, BinaryOp::Add) => { |