From 524a4925de6a97833aac777de1efb5402932c2e6 Mon Sep 17 00:00:00 2001 From: Javier Vargas Date: Sat, 23 Oct 2021 16:25:48 +0200 Subject: [PATCH] Added operation with gradients in modules --- experiment1/modules.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/experiment1/modules.py b/experiment1/modules.py index 8ff38ec..739e3ce 100644 --- a/experiment1/modules.py +++ b/experiment1/modules.py @@ -8,8 +8,7 @@ def __init__(self) -> None: def __call__(self, X: T.Tensor) -> T.Tensor: """Calling the adding operation without gradient""" - with T.no_grad(): - return X[0] + X[1] + return X[0] + X[1] class Substracter(object): @@ -19,8 +18,7 @@ def __init__(self) -> None: def __call__(self, X: T.Tensor) -> T.Tensor: """Calling the adding operation without gradient""" - with T.no_grad(): - return X[0] - X[1] + return X[0] - X[1] if __name__ == "__main__":