diff options
author | Laurent Mazare <laurent.mazare@gmail.com> | 2023-10-19 09:25:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-19 09:25:03 +0100 |
commit | 8e773cc0c61af4ee9015aedc1e71398185c84f25 (patch) | |
tree | d1e4703b8fd1bff4b89cccf127ca44eb534143ab /candle-nn | |
parent | 87eb1658e160a004d1800d70e8b0cb88b00a640f (diff) | |
download | candle-8e773cc0c61af4ee9015aedc1e71398185c84f25.tar.gz candle-8e773cc0c61af4ee9015aedc1e71398185c84f25.tar.bz2 candle-8e773cc0c61af4ee9015aedc1e71398185c84f25.zip |
Experiment with resnet (#1128)
* Add some preliminary support for resnet.
* Add an actual resnet example.
Diffstat (limited to 'candle-nn')
-rw-r--r-- | candle-nn/src/func.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/candle-nn/src/func.rs b/candle-nn/src/func.rs index c9ec287a..e7fd73ae 100644 --- a/candle-nn/src/func.rs +++ b/candle-nn/src/func.rs @@ -25,3 +25,12 @@ impl<'a> super::Module for Func<'a> { (*self.f)(xs) } } + +impl<'a> Func<'a> { + pub fn new<F>(f: F) -> Self + where + F: 'a + Fn(&Tensor) -> Result<Tensor> + Send, + { + Self { f: Box::new(f) } + } +} |