File tree 1 file changed +2
-7
lines changed
pytorch_lightning/trainer
1 file changed +2
-7
lines changed Original file line number Diff line number Diff line change @@ -11,8 +11,6 @@ class TensorRunningMean(object):
11
11
>>> accum.last(), accum.mean()
12
12
(None, None)
13
13
>>> accum.append(torch.tensor(1.5))
14
- >>> accum.last(), accum.mean()
15
- (tensor(1.5000), tensor(1.5000))
16
14
>>> accum.append(torch.tensor(2.5))
17
15
>>> accum.last(), accum.mean()
18
16
(tensor(2.5000), tensor(2.))
@@ -29,7 +27,7 @@ def __init__(self, window_length: int):
29
27
self .rotated : bool = False
30
28
31
29
def reset (self ) -> None :
32
- self = TensorRunningMean (self .window_length )
30
+ self . memory = TensorRunningMean (self .window_length ) * 0
33
31
34
32
def last (self ):
35
33
if self .last_idx :
@@ -55,7 +53,4 @@ def append(self, x):
55
53
self .rotated = True
56
54
57
55
def mean (self ):
58
- if self .last_idx is None :
59
- return None
60
- avg = self .memory .mean () if self .rotated else self .memory [:self .current_idx ].mean ()
61
- return avg
56
+ return self .memory .mean ()
You can’t perform that action at this time.
0 commit comments