Multiplication / test.py
xcx0902's picture
Upload folder using huggingface_hub
893cb78 verified
from run import run
from tqdm import trange
import random
def test(round):
sumacc = 0
lenacc = 0
pbar = trange(round)
for r in pbar:
x = random.randint(1, 100)
y = random.randint(1, 100)
pans = run([x, y])
tans = x * y
acc = 1 - abs(tans - pans) / tans
sumacc += acc
lenacc += 1
pbar.set_description_str(f"Round {r}, Average Accuracy = {sumacc / lenacc * 100}%")
print(f"Final Accuracy: {sumacc / lenacc * 100}%")
if __name__ == '__main__':
test(100000)