Skip to content

Commit 045ab4a

Browse files
authored
Update how verbose works in timing
1 parent f10cd86 commit 045ab4a

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

deepxde/utils/internal.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,13 @@ def timing(f):
1818

1919
@wraps(f)
2020
def wrapper(*args, **kwargs):
21+
ts = timeit.default_timer()
22+
result = f(*args, **kwargs)
23+
te = timeit.default_timer()
2124
verbose = kwargs.get('verbose', 1)
2225
if verbose > 0 and config.rank == 0:
23-
ts = timeit.default_timer()
24-
result = f(*args, **kwargs)
25-
te = timeit.default_timer()
2626
print("%r took %f s\n" % (f.__name__, te - ts))
2727
sys.stdout.flush()
28-
else:
29-
result = f(*args, **kwargs)
3028
return result
3129

3230
return wrapper

0 commit comments

Comments
 (0)