Skip to content

Commit

Permalink
Added more docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
JVGD committed Dec 8, 2021
1 parent c77a348 commit 1431a87
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
9 changes: 9 additions & 0 deletions experiment1/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@


class Model1(LightningModule):
"""First iteration model 1
This model is given with two intrinsic knowlegde modules: the Adder
and the Substracter. The model is expected to learn when to use
the Adder or when to use the Substracter. However the adder and the
substracter are already implemented (they are not learnable). This
experiment tries to teach this model to use innate knowledge rather
than learning it from the ground up.
"""
def __init__(self, lr: float, optim_conf: dict) -> None:
"""Modular AI approach 1
Expand Down
12 changes: 10 additions & 2 deletions experiment1/modules.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
import torch as T

"""
Modules without learnable parameters, this
modules will act as intrinsic knowledge that
the AI must decide when to use and when not
"""


class Adder(object):
"""Adder module without learnable parameters"""
def __init__(self) -> None:
"""Init adder module"""
super().__init__()

def __call__(self, X: T.Tensor) -> T.Tensor:
"""Calling the adding operation without gradient"""
"""Performing the adding operation"""
return X[:, 0] + X[:, 1]


class Substracter(object):
"""Substracter module without learnable parameters"""
def __init__(self) -> None:
"""Init substracter module"""
super().__init__()

def __call__(self, X: T.Tensor) -> T.Tensor:
"""Calling the adding operation without gradient"""
"""Performing the substracting operation"""
return X[:, 0] - X[:, 1]


Expand Down

0 comments on commit 1431a87

Please sign in to comment.