This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- [python] --------- | |
* tests/algorithms/sqrt.py | |
def abs(x): | |
if x > 0: | |
return x | |
else: | |
return -x | |
def sqrt(x): | |
eps = 1e-10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat broadcast.py | |
from benchmarker import Benchmarker | |
import numpy as np | |
## specify number of loop | |
with Benchmarker(10000, width=20) as bench: | |
@bench(None) ## empty loop | |
def _(bm): | |
x = np.ones([1000,784], dtype=np.float32) |