Skip to content

Commit

Permalink
Added operation with gradients in modules
Browse files Browse the repository at this point in the history
  • Loading branch information
JVGD committed Oct 23, 2021
1 parent 3f39c18 commit 524a492
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions experiment1/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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__":
Expand Down

0 comments on commit 524a492

Please sign in to comment.