Skip to content

Commit

Permalink
experiment training
Browse files Browse the repository at this point in the history
  • Loading branch information
JVGD committed Nov 1, 2021
1 parent 8a35608 commit eebaf4e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion experiment1/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class NumberAdd(Dataset):
def __init__(self, total_samples: int) -> None:
"""Generate dataset with pairs of numbers and their sum"""
self.N = total_samples
self.samples = T.randint(low=-1000, high=1000, size=(self.N, 2))
self.samples = T.randint(low=-1000, high=1000, size=(self.N, 2), dtype=T.float32)
self.targets = T.sum(self.samples, dim=-1)

def __getitem__(self, index: int) -> tuple:
Expand Down
4 changes: 2 additions & 2 deletions experiment1/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def __init__(self) -> None:

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


class Substracter(object):
Expand All @@ -18,7 +18,7 @@ def __init__(self) -> None:

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


if __name__ == "__main__":
Expand Down

0 comments on commit eebaf4e

Please sign in to comment.