Skip to content

Commit 3f098d9

Browse files
authored
Merge pull request #3 from janhenrikbern/master
Assert float input type for Scalar class
2 parents 5c005d0 + 97ed981 commit 3f098d9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

minitorch/scalar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class Scalar(Variable):
4545

4646
def __init__(self, v, back=History(), name=None):
4747
super().__init__(back, name=name)
48-
self.data = v
48+
self.data = float(v)
4949

5050
def __repr__(self):
5151
return "Scalar(%f)" % self.data

0 commit comments

Comments
 (0)