op_test.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import tensorflow as tf
  2. import numpy as np
  3. from IPython import embed
  4. import sys
  5. import os
  6. sys.path.append('..')
  7. from hostLib.layers.conv2D import Conv2D as Conv2DFPGA
  8. from hostLib import load_op
  9. class FPGALibTest(tf.test.TestCase):
  10. def testDummyOp(self):
  11. input = [1337, 42, 2**31-1, -1]
  12. with self.session():
  13. result = load_op.op_lib.MyDummy(input=input)
  14. self.assertAllEqual(result, input)
  15. def testDummyOp100(self):
  16. with self.session():
  17. for i in range(100):
  18. input = [i+1, 42, 2**31-1, -1]
  19. result = load_op.op_lib.MyDummy(input=input)
  20. self.assertAllEqual(result, input)
  21. def testDummyOpBig(self):
  22. input = [i+1 for i in range(1024)]
  23. with self.session():
  24. result = load_op.op_lib.MyDummyBig(input=input)
  25. self.assertAllEqual(result, input)
  26. def testDummyOpBig100(self):
  27. with self.session():
  28. for i in range(100):
  29. input = [i*100+k+1 for k in range(1024)]
  30. result = load_op.op_lib.MyDummyBig(input=input)
  31. self.assertAllEqual(result, input)
  32. if __name__ == "__main__":
  33. tf.test.main()