emirhanyildirim34555's picture
Publish reviewed research staging to main
a9eb5bf verified
Raw History Blame Contribute Delete
1.16 kB
import json
from pathlib import Path
import numpy as np
from inference import predict,ROOT
if __name__=='__main__':
x=np.random.default_rng(13).uniform(size=(19,64)).astype(np.float32);checks=0;results=[]
for task in ['identity','parity','magnitude']:
for seed in range(5):
a=predict(x,task,seed);b=predict(x,task,seed)
assert np.array_equal(a,b) and np.isfinite(a).all() and a.shape==(19,10 if task=='identity' else 2)
results.append({'task':task,'seed':seed,'rows':19,'max_reload_difference':float(np.max(np.abs(a-b))) });checks+=1
for bad in [np.zeros((1,63)),np.full((1,64),float('nan')),np.full((1,64),2.)]:
try:predict(bad)
except ValueError:checks+=1
else:raise AssertionError('Invalid input accepted')
for task,seed in [('../x',0),('identity',True),('identity',5)]:
try:predict(x,task,seed)
except ValueError:checks+=1
else:raise AssertionError('Invalid selector accepted')
Path('VALIDATION.json').write_text(json.dumps({'passed':True,'checks':checks,'weights':15,'checks_detail':results,'claim':'Reload and contract checks only'},indent=2))
print('PASS',checks)