/monk/pytorch_tests.py

https://github.com/Tessellate-Imaging/monk_v1 · Python · 1129 lines · 850 code · 279 blank · 0 comment · 2 complexity · 175cfbf75d207a23778c5c6117716b47 MD5 · raw file

  1. import os
  2. import sys
  3. import time
  4. from monk.pip_unit_tests.pytorch.test_optimizer_sgd import test_optimizer_sgd
  5. from monk.pip_unit_tests.pytorch.test_optimizer_nesterov_sgd import test_optimizer_nesterov_sgd
  6. from monk.pip_unit_tests.pytorch.test_optimizer_rmsprop import test_optimizer_rmsprop
  7. from monk.pip_unit_tests.pytorch.test_optimizer_momentum_rmsprop import test_optimizer_momentum_rmsprop
  8. from monk.pip_unit_tests.pytorch.test_optimizer_adam import test_optimizer_adam
  9. from monk.pip_unit_tests.pytorch.test_optimizer_adamax import test_optimizer_adamax
  10. from monk.pip_unit_tests.pytorch.test_optimizer_adamw import test_optimizer_adamw
  11. from monk.pip_unit_tests.pytorch.test_optimizer_adadelta import test_optimizer_adadelta
  12. from monk.pip_unit_tests.pytorch.test_optimizer_adagrad import test_optimizer_adagrad
  13. from monk.pip_unit_tests.pytorch.test_loss_l1 import test_loss_l1
  14. from monk.pip_unit_tests.pytorch.test_loss_l2 import test_loss_l2
  15. from monk.pip_unit_tests.pytorch.test_loss_l2 import test_loss_l2
  16. from monk.pip_unit_tests.pytorch.test_loss_softmax_crossentropy import test_loss_softmax_crossentropy
  17. from monk.pip_unit_tests.pytorch.test_loss_crossentropy import test_loss_crossentropy
  18. from monk.pip_unit_tests.pytorch.test_loss_sigmoid_binary_crossentropy import test_loss_sigmoid_binary_crossentropy
  19. from monk.pip_unit_tests.pytorch.test_loss_binary_crossentropy import test_loss_binary_crossentropy
  20. from monk.pip_unit_tests.pytorch.test_loss_kldiv import test_loss_kldiv
  21. from monk.pip_unit_tests.pytorch.test_loss_poisson_nll import test_loss_poisson_nll
  22. from monk.pip_unit_tests.pytorch.test_loss_huber import test_loss_huber
  23. from monk.pip_unit_tests.pytorch.test_loss_hinge import test_loss_hinge
  24. from monk.pip_unit_tests.pytorch.test_loss_squared_hinge import test_loss_squared_hinge
  25. from monk.pip_unit_tests.pytorch.test_loss_multimargin import test_loss_multimargin
  26. from monk.pip_unit_tests.pytorch.test_loss_squared_multimargin import test_loss_squared_multimargin
  27. from monk.pip_unit_tests.pytorch.test_loss_multilabelmargin import test_loss_multilabelmargin
  28. from monk.pip_unit_tests.pytorch.test_loss_multilabelsoftmargin import test_loss_multilabelsoftmargin
  29. from monk.pip_unit_tests.pytorch.test_layer_convolution1d import test_layer_convolution1d
  30. from monk.pip_unit_tests.pytorch.test_layer_convolution2d import test_layer_convolution2d
  31. from monk.pip_unit_tests.pytorch.test_layer_convolution3d import test_layer_convolution3d
  32. from monk.pip_unit_tests.pytorch.test_layer_transposed_convolution1d import test_layer_transposed_convolution1d
  33. from monk.pip_unit_tests.pytorch.test_layer_transposed_convolution2d import test_layer_transposed_convolution2d
  34. from monk.pip_unit_tests.pytorch.test_layer_transposed_convolution3d import test_layer_transposed_convolution3d
  35. from monk.pip_unit_tests.pytorch.test_layer_max_pooling1d import test_layer_max_pooling1d
  36. from monk.pip_unit_tests.pytorch.test_layer_max_pooling2d import test_layer_max_pooling2d
  37. from monk.pip_unit_tests.pytorch.test_layer_max_pooling3d import test_layer_max_pooling3d
  38. from monk.pip_unit_tests.pytorch.test_layer_average_pooling1d import test_layer_average_pooling1d
  39. from monk.pip_unit_tests.pytorch.test_layer_average_pooling2d import test_layer_average_pooling2d
  40. from monk.pip_unit_tests.pytorch.test_layer_average_pooling3d import test_layer_average_pooling3d
  41. from monk.pip_unit_tests.pytorch.test_layer_global_max_pooling1d import test_layer_global_max_pooling1d
  42. from monk.pip_unit_tests.pytorch.test_layer_global_max_pooling2d import test_layer_global_max_pooling2d
  43. from monk.pip_unit_tests.pytorch.test_layer_global_max_pooling3d import test_layer_global_max_pooling3d
  44. from monk.pip_unit_tests.pytorch.test_layer_global_average_pooling1d import test_layer_global_average_pooling1d
  45. from monk.pip_unit_tests.pytorch.test_layer_global_average_pooling2d import test_layer_global_average_pooling2d
  46. from monk.pip_unit_tests.pytorch.test_layer_global_average_pooling3d import test_layer_global_average_pooling3d
  47. from monk.pip_unit_tests.pytorch.test_layer_batch_normalization import test_layer_batch_normalization
  48. from monk.pip_unit_tests.pytorch.test_layer_instance_normalization import test_layer_instance_normalization
  49. from monk.pip_unit_tests.pytorch.test_layer_layer_normalization import test_layer_layer_normalization
  50. from monk.pip_unit_tests.pytorch.test_layer_identity import test_layer_identity
  51. from monk.pip_unit_tests.pytorch.test_layer_fully_connected import test_layer_fully_connected
  52. from monk.pip_unit_tests.pytorch.test_layer_dropout import test_layer_dropout
  53. from monk.pip_unit_tests.pytorch.test_layer_flatten import test_layer_flatten
  54. from monk.pip_unit_tests.pytorch.test_activation_relu import test_activation_relu
  55. from monk.pip_unit_tests.pytorch.test_activation_sigmoid import test_activation_sigmoid
  56. from monk.pip_unit_tests.pytorch.test_activation_tanh import test_activation_tanh
  57. from monk.pip_unit_tests.pytorch.test_activation_softplus import test_activation_softplus
  58. from monk.pip_unit_tests.pytorch.test_activation_softsign import test_activation_softsign
  59. from monk.pip_unit_tests.pytorch.test_activation_elu import test_activation_elu
  60. from monk.pip_unit_tests.pytorch.test_activation_leaky_relu import test_activation_leaky_relu
  61. from monk.pip_unit_tests.pytorch.test_activation_prelu import test_activation_prelu
  62. from monk.pip_unit_tests.pytorch.test_activation_selu import test_activation_selu
  63. from monk.pip_unit_tests.pytorch.test_activation_hardshrink import test_activation_hardshrink
  64. from monk.pip_unit_tests.pytorch.test_activation_hardtanh import test_activation_hardtanh
  65. from monk.pip_unit_tests.pytorch.test_activation_logsigmoid import test_activation_logsigmoid
  66. from monk.pip_unit_tests.pytorch.test_activation_relu6 import test_activation_relu6
  67. from monk.pip_unit_tests.pytorch.test_activation_rrelu import test_activation_rrelu
  68. from monk.pip_unit_tests.pytorch.test_activation_celu import test_activation_celu
  69. from monk.pip_unit_tests.pytorch.test_activation_softshrink import test_activation_softshrink
  70. from monk.pip_unit_tests.pytorch.test_activation_tanhshrink import test_activation_tanhshrink
  71. from monk.pip_unit_tests.pytorch.test_activation_threshold import test_activation_threshold
  72. from monk.pip_unit_tests.pytorch.test_activation_softmin import test_activation_softmin
  73. from monk.pip_unit_tests.pytorch.test_activation_softmax import test_activation_softmax
  74. from monk.pip_unit_tests.pytorch.test_activation_logsoftmax import test_activation_logsoftmax
  75. from monk.pip_unit_tests.pytorch.test_layer_concatenate import test_layer_concatenate
  76. from monk.pip_unit_tests.pytorch.test_layer_add import test_layer_add
  77. from monk.pip_unit_tests.pytorch.test_block_resnet_v1 import test_block_resnet_v1
  78. from monk.pip_unit_tests.pytorch.test_block_resnet_v2 import test_block_resnet_v2
  79. from monk.pip_unit_tests.pytorch.test_block_resnet_v1_bottleneck import test_block_resnet_v1_bottleneck
  80. from monk.pip_unit_tests.pytorch.test_block_resnet_v2_bottleneck import test_block_resnet_v2_bottleneck
  81. from monk.pip_unit_tests.pytorch.test_block_resnext import test_block_resnext
  82. from monk.pip_unit_tests.pytorch.test_block_mobilenet_v2_linear_bottleneck import test_block_mobilenet_v2_linear_bottleneck
  83. from monk.pip_unit_tests.pytorch.test_block_mobilenet_v2_inverted_linear_bottleneck import test_block_mobilenet_v2_inverted_linear_bottleneck
  84. from monk.pip_unit_tests.pytorch.test_block_squeezenet_fire import test_block_squeezenet_fire
  85. from monk.pip_unit_tests.pytorch.test_block_densenet import test_block_densenet
  86. from monk.pip_unit_tests.pytorch.test_block_conv_bn_relu import test_block_conv_bn_relu
  87. from monk.pip_unit_tests.pytorch.test_block_inception_a import test_block_inception_a
  88. from monk.pip_unit_tests.pytorch.test_block_inception_b import test_block_inception_b
  89. from monk.pip_unit_tests.pytorch.test_block_inception_c import test_block_inception_c
  90. from monk.pip_unit_tests.pytorch.test_block_inception_d import test_block_inception_d
  91. from monk.pip_unit_tests.pytorch.test_block_inception_e import test_block_inception_e
  92. from monk.pip_functionality_tests.pytorch.test_default_train import test_default_train
  93. from monk.pip_functionality_tests.pytorch.test_default_eval_infer import test_default_eval_infer
  94. from monk.pip_functionality_tests.pytorch.test_update_copy_from import test_update_copy_from
  95. from monk.pip_functionality_tests.pytorch.test_update_normal import test_update_normal
  96. from monk.pip_functionality_tests.pytorch.test_update_eval_infer import test_update_eval_infer
  97. from monk.pip_functionality_tests.pytorch.test_expert_train import test_expert_train
  98. from monk.pip_functionality_tests.pytorch.test_expert_eval_infer import test_expert_eval_infer
  99. from monk.pip_functionality_tests.pytorch.test_switch_default import test_switch_default
  100. from monk.pip_functionality_tests.pytorch.test_switch_expert import test_switch_expert
  101. from monk.pip_functionality_tests.pytorch.test_compare import test_compare
  102. from monk.pip_functionality_tests.pytorch.test_analyse import test_analyse
  103. def run_functionality_tests():
  104. origstdout = sys.stdout
  105. print("Running Tests...");
  106. sys.stdout = open("test_logs.txt", 'w');
  107. system_dict = {};
  108. system_dict["total_tests"] = 0;
  109. system_dict["successful_tests"] = 0;
  110. system_dict["failed_tests_lists"] = [];
  111. system_dict["failed_tests_exceptions"] = [];
  112. system_dict["skipped_tests_lists"] = [];
  113. start = time.time()
  114. print("Running 1/11");
  115. system_dict = test_default_train(system_dict)
  116. sys.stdout = origstdout;
  117. print("Tests Completed - {}".format(system_dict["total_tests"]));
  118. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  119. print("")
  120. print("Running 2/11");
  121. sys.stdout = open("test_logs.txt", 'a');
  122. system_dict = test_default_eval_infer(system_dict)
  123. sys.stdout = origstdout;
  124. print("Tests Completed - {}".format(system_dict["total_tests"]));
  125. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  126. print("")
  127. print("Running 3/11");
  128. sys.stdout = open("test_logs.txt", 'a');
  129. system_dict = test_update_copy_from(system_dict)
  130. sys.stdout = origstdout;
  131. print("Tests Completed - {}".format(system_dict["total_tests"]));
  132. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  133. print("")
  134. print("Running 4/11");
  135. sys.stdout = open("test_logs.txt", 'a');
  136. system_dict = test_update_normal(system_dict)
  137. sys.stdout = origstdout;
  138. print("Tests Completed - {}".format(system_dict["total_tests"]));
  139. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  140. print("")
  141. print("Running 5/11");
  142. sys.stdout = open("test_logs.txt", 'a');
  143. system_dict = test_update_eval_infer(system_dict)
  144. sys.stdout = origstdout;
  145. print("Tests Completed - {}".format(system_dict["total_tests"]));
  146. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  147. print("")
  148. print("Running 6/11");
  149. sys.stdout = open("test_logs.txt", 'a');
  150. system_dict = test_expert_train(system_dict)
  151. sys.stdout = origstdout;
  152. print("Tests Completed - {}".format(system_dict["total_tests"]));
  153. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  154. print("Running 7/11");
  155. sys.stdout = open("test_logs.txt", 'a');
  156. system_dict = test_expert_eval_infer(system_dict)
  157. sys.stdout = origstdout;
  158. print("Tests Completed - {}".format(system_dict["total_tests"]));
  159. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  160. print("")
  161. print("Running 8/11");
  162. sys.stdout = open("test_logs.txt", 'a');
  163. system_dict = test_switch_default(system_dict)
  164. sys.stdout = origstdout;
  165. print("Tests Completed - {}".format(system_dict["total_tests"]));
  166. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  167. print("")
  168. print("Running 9/11");
  169. sys.stdout = open("test_logs.txt", 'a');
  170. system_dict = test_switch_expert(system_dict)
  171. sys.stdout = origstdout;
  172. print("Tests Completed - {}".format(system_dict["total_tests"]));
  173. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  174. print("")
  175. print("Running 10/11");
  176. sys.stdout = open("test_logs.txt", 'a');
  177. system_dict = test_compare(system_dict)
  178. sys.stdout = origstdout;
  179. print("Tests Completed - {}".format(system_dict["total_tests"]));
  180. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  181. print("")
  182. print("Running 11/11");
  183. sys.stdout = open("test_logs.txt", 'a');
  184. system_dict = test_analyse(system_dict)
  185. sys.stdout = origstdout;
  186. print("Tests Completed - {}".format(system_dict["total_tests"]));
  187. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  188. print("")
  189. sys.stdout = open("test_logs.txt", 'a');
  190. end = time.time();
  191. print("Total Tests - {}".format(system_dict["total_tests"]));
  192. print("Time Taken - {} sec".format(end-start));
  193. print("Num Successful Tests - {}".format(system_dict["successful_tests"]));
  194. print("Num Failed Tests - {}".format(len(system_dict["failed_tests_lists"])));
  195. print("Num Skipped Tests - {}".format(len(system_dict["skipped_tests_lists"])));
  196. print("");
  197. for i in range(len(system_dict["failed_tests_lists"])):
  198. print("{}. Failed Test:".format(i+1));
  199. print("Name - {}".format(system_dict["failed_tests_lists"][i]));
  200. print("Error - {}".format(system_dict["failed_tests_exceptions"][i]));
  201. print("");
  202. print("Skipped Tests List - {}".format(system_dict["skipped_tests_lists"]));
  203. print("");
  204. sys.stdout = origstdout;
  205. print("Total Tests - {}".format(system_dict["total_tests"]));
  206. print("Time Taken - {} sec".format(end-start));
  207. print("Num Successful Tests - {}".format(system_dict["successful_tests"]));
  208. print("Num Failed Tests - {}".format(len(system_dict["failed_tests_lists"])));
  209. print("Num Skipped Tests - {}".format(len(system_dict["skipped_tests_lists"])));
  210. print("See test_logs.txt for errors");
  211. print("");
  212. os.system("rm -r workspace");
  213. def run_unit_tests():
  214. origstdout = sys.stdout
  215. print("Running Tests...");
  216. sys.stdout = open("test_logs.txt", 'w');
  217. system_dict = {};
  218. system_dict["total_tests"] = 0;
  219. system_dict["successful_tests"] = 0;
  220. system_dict["failed_tests_lists"] = [];
  221. system_dict["failed_tests_exceptions"] = [];
  222. system_dict["skipped_tests_lists"] = [];
  223. start = time.time()
  224. exp_num = 1;
  225. print("Running {}/<num>".format(exp_num));
  226. exp_num += 1;
  227. system_dict = test_optimizer_sgd(system_dict)
  228. sys.stdout = origstdout;
  229. print("Tests Completed - {}".format(system_dict["total_tests"]));
  230. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  231. print("")
  232. print("Running {}/<num>".format(exp_num));
  233. exp_num += 1;
  234. system_dict = test_optimizer_nesterov_sgd(system_dict)
  235. sys.stdout = origstdout;
  236. print("Tests Completed - {}".format(system_dict["total_tests"]));
  237. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  238. print("")
  239. print("Running {}/<num>".format(exp_num));
  240. exp_num += 1;
  241. system_dict = test_optimizer_rmsprop(system_dict)
  242. sys.stdout = origstdout;
  243. print("Tests Completed - {}".format(system_dict["total_tests"]));
  244. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  245. print("")
  246. print("Running {}/<num>".format(exp_num));
  247. exp_num += 1;
  248. system_dict = test_optimizer_adam(system_dict)
  249. sys.stdout = origstdout;
  250. print("Tests Completed - {}".format(system_dict["total_tests"]));
  251. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  252. print("")
  253. print("Running {}/<num>".format(exp_num));
  254. exp_num += 1;
  255. system_dict = test_optimizer_adamax(system_dict)
  256. sys.stdout = origstdout;
  257. print("Tests Completed - {}".format(system_dict["total_tests"]));
  258. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  259. print("")
  260. print("Running {}/<num>".format(exp_num));
  261. exp_num += 1;
  262. system_dict = test_optimizer_adamw(system_dict)
  263. sys.stdout = origstdout;
  264. print("Tests Completed - {}".format(system_dict["total_tests"]));
  265. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  266. print("")
  267. print("Running {}/<num>".format(exp_num));
  268. exp_num += 1;
  269. system_dict = test_optimizer_adadelta(system_dict)
  270. sys.stdout = origstdout;
  271. print("Tests Completed - {}".format(system_dict["total_tests"]));
  272. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  273. print("")
  274. print("Running {}/<num>".format(exp_num));
  275. exp_num += 1;
  276. system_dict = test_optimizer_adagrad(system_dict)
  277. sys.stdout = origstdout;
  278. print("Tests Completed - {}".format(system_dict["total_tests"]));
  279. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  280. print("")
  281. print("Running {}/<num>".format(exp_num));
  282. exp_num += 1;
  283. system_dict = test_loss_l1(system_dict)
  284. sys.stdout = origstdout;
  285. print("Tests Completed - {}".format(system_dict["total_tests"]));
  286. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  287. print("")
  288. print("Running {}/<num>".format(exp_num));
  289. exp_num += 1;
  290. system_dict = test_loss_l2(system_dict)
  291. sys.stdout = origstdout;
  292. print("Tests Completed - {}".format(system_dict["total_tests"]));
  293. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  294. print("")
  295. print("Running {}/<num>".format(exp_num));
  296. exp_num += 1;
  297. system_dict = test_loss_softmax_crossentropy(system_dict)
  298. sys.stdout = origstdout;
  299. print("Tests Completed - {}".format(system_dict["total_tests"]));
  300. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  301. print("")
  302. print("Running {}/<num>".format(exp_num));
  303. exp_num += 1;
  304. system_dict = test_loss_crossentropy(system_dict)
  305. sys.stdout = origstdout;
  306. print("Tests Completed - {}".format(system_dict["total_tests"]));
  307. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  308. print("")
  309. print("Running {}/<num>".format(exp_num));
  310. exp_num += 1;
  311. system_dict = test_loss_sigmoid_binary_crossentropy(system_dict)
  312. sys.stdout = origstdout;
  313. print("Tests Completed - {}".format(system_dict["total_tests"]));
  314. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  315. print("")
  316. print("Running {}/<num>".format(exp_num));
  317. exp_num += 1;
  318. system_dict = test_loss_binary_crossentropy(system_dict)
  319. sys.stdout = origstdout;
  320. print("Tests Completed - {}".format(system_dict["total_tests"]));
  321. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  322. print("")
  323. print("Running {}/<num>".format(exp_num));
  324. exp_num += 1;
  325. system_dict = test_loss_kldiv(system_dict)
  326. sys.stdout = origstdout;
  327. print("Tests Completed - {}".format(system_dict["total_tests"]));
  328. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  329. print("")
  330. print("Running {}/<num>".format(exp_num));
  331. exp_num += 1;
  332. system_dict = test_loss_poisson_nll(system_dict)
  333. sys.stdout = origstdout;
  334. print("Tests Completed - {}".format(system_dict["total_tests"]));
  335. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  336. print("")
  337. print("Running {}/<num>".format(exp_num));
  338. exp_num += 1;
  339. system_dict = test_loss_huber(system_dict)
  340. sys.stdout = origstdout;
  341. print("Tests Completed - {}".format(system_dict["total_tests"]));
  342. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  343. print("")
  344. print("Running {}/<num>".format(exp_num));
  345. exp_num += 1;
  346. system_dict = test_loss_hinge(system_dict)
  347. sys.stdout = origstdout;
  348. print("Tests Completed - {}".format(system_dict["total_tests"]));
  349. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  350. print("")
  351. print("Running {}/<num>".format(exp_num));
  352. exp_num += 1;
  353. system_dict = test_loss_squared_hinge(system_dict)
  354. sys.stdout = origstdout;
  355. print("Tests Completed - {}".format(system_dict["total_tests"]));
  356. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  357. print("")
  358. print("Running {}/<num>".format(exp_num));
  359. exp_num += 1;
  360. system_dict = test_loss_multimargin(system_dict)
  361. sys.stdout = origstdout;
  362. print("Tests Completed - {}".format(system_dict["total_tests"]));
  363. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  364. print("")
  365. print("Running {}/<num>".format(exp_num));
  366. exp_num += 1;
  367. system_dict = test_loss_squared_multimargin(system_dict)
  368. sys.stdout = origstdout;
  369. print("Tests Completed - {}".format(system_dict["total_tests"]));
  370. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  371. print("")
  372. print("Running {}/<num>".format(exp_num));
  373. exp_num += 1;
  374. system_dict = test_loss_multilabelmargin(system_dict)
  375. sys.stdout = origstdout;
  376. print("Tests Completed - {}".format(system_dict["total_tests"]));
  377. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  378. print("")
  379. print("Running {}/<num>".format(exp_num));
  380. exp_num += 1;
  381. system_dict = test_loss_multilabelsoftmargin(system_dict)
  382. sys.stdout = origstdout;
  383. print("Tests Completed - {}".format(system_dict["total_tests"]));
  384. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  385. print("")
  386. print("Running {}/<num>".format(exp_num));
  387. exp_num += 1;
  388. system_dict = test_layer_convolution1d(system_dict)
  389. sys.stdout = origstdout;
  390. print("Tests Completed - {}".format(system_dict["total_tests"]));
  391. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  392. print("")
  393. print("Running {}/<num>".format(exp_num));
  394. exp_num += 1;
  395. system_dict = test_layer_convolution2d(system_dict)
  396. sys.stdout = origstdout;
  397. print("Tests Completed - {}".format(system_dict["total_tests"]));
  398. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  399. print("")
  400. print("Running {}/<num>".format(exp_num));
  401. exp_num += 1;
  402. system_dict = test_layer_convolution3d(system_dict)
  403. sys.stdout = origstdout;
  404. print("Tests Completed - {}".format(system_dict["total_tests"]));
  405. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  406. print("")
  407. print("Running {}/<num>".format(exp_num));
  408. exp_num += 1;
  409. system_dict = test_layer_transposed_convolution1d(system_dict)
  410. sys.stdout = origstdout;
  411. print("Tests Completed - {}".format(system_dict["total_tests"]));
  412. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  413. print("")
  414. print("Running {}/<num>".format(exp_num));
  415. exp_num += 1;
  416. system_dict = test_layer_transposed_convolution2d(system_dict)
  417. sys.stdout = origstdout;
  418. print("Tests Completed - {}".format(system_dict["total_tests"]));
  419. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  420. print("")
  421. print("Running {}/<num>".format(exp_num));
  422. exp_num += 1;
  423. system_dict = test_layer_transposed_convolution3d(system_dict)
  424. sys.stdout = origstdout;
  425. print("Tests Completed - {}".format(system_dict["total_tests"]));
  426. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  427. print("")
  428. print("Running {}/<num>".format(exp_num));
  429. exp_num += 1;
  430. system_dict = test_layer_max_pooling1d(system_dict)
  431. sys.stdout = origstdout;
  432. print("Tests Completed - {}".format(system_dict["total_tests"]));
  433. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  434. print("")
  435. print("Running {}/<num>".format(exp_num));
  436. exp_num += 1;
  437. system_dict = test_layer_max_pooling2d(system_dict)
  438. sys.stdout = origstdout;
  439. print("Tests Completed - {}".format(system_dict["total_tests"]));
  440. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  441. print("")
  442. print("Running {}/<num>".format(exp_num));
  443. exp_num += 1;
  444. system_dict = test_layer_max_pooling3d(system_dict)
  445. sys.stdout = origstdout;
  446. print("Tests Completed - {}".format(system_dict["total_tests"]));
  447. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  448. print("")
  449. print("Running {}/<num>".format(exp_num));
  450. exp_num += 1;
  451. system_dict = test_layer_average_pooling1d(system_dict)
  452. sys.stdout = origstdout;
  453. print("Tests Completed - {}".format(system_dict["total_tests"]));
  454. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  455. print("")
  456. print("Running {}/<num>".format(exp_num));
  457. exp_num += 1;
  458. system_dict = test_layer_average_pooling2d(system_dict)
  459. sys.stdout = origstdout;
  460. print("Tests Completed - {}".format(system_dict["total_tests"]));
  461. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  462. print("")
  463. print("Running {}/<num>".format(exp_num));
  464. exp_num += 1;
  465. system_dict = test_layer_average_pooling3d(system_dict)
  466. sys.stdout = origstdout;
  467. print("Tests Completed - {}".format(system_dict["total_tests"]));
  468. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  469. print("")
  470. print("Running {}/<num>".format(exp_num));
  471. exp_num += 1;
  472. system_dict = test_layer_global_max_pooling1d(system_dict)
  473. sys.stdout = origstdout;
  474. print("Tests Completed - {}".format(system_dict["total_tests"]));
  475. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  476. print("")
  477. print("Running {}/<num>".format(exp_num));
  478. exp_num += 1;
  479. system_dict = test_layer_global_max_pooling2d(system_dict)
  480. sys.stdout = origstdout;
  481. print("Tests Completed - {}".format(system_dict["total_tests"]));
  482. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  483. print("")
  484. print("Running {}/<num>".format(exp_num));
  485. exp_num += 1;
  486. system_dict = test_layer_global_max_pooling3d(system_dict)
  487. sys.stdout = origstdout;
  488. print("Tests Completed - {}".format(system_dict["total_tests"]));
  489. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  490. print("")
  491. print("Running {}/<num>".format(exp_num));
  492. exp_num += 1;
  493. system_dict = test_layer_global_average_pooling1d(system_dict)
  494. sys.stdout = origstdout;
  495. print("Tests Completed - {}".format(system_dict["total_tests"]));
  496. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  497. print("")
  498. print("Running {}/<num>".format(exp_num));
  499. exp_num += 1;
  500. system_dict = test_layer_global_average_pooling2d(system_dict)
  501. sys.stdout = origstdout;
  502. print("Tests Completed - {}".format(system_dict["total_tests"]));
  503. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  504. print("")
  505. print("Running {}/<num>".format(exp_num));
  506. exp_num += 1;
  507. system_dict = test_layer_global_average_pooling3d(system_dict)
  508. sys.stdout = origstdout;
  509. print("Tests Completed - {}".format(system_dict["total_tests"]));
  510. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  511. print("")
  512. print("Running {}/<num>".format(exp_num));
  513. exp_num += 1;
  514. system_dict = test_layer_batch_normalization(system_dict)
  515. sys.stdout = origstdout;
  516. print("Tests Completed - {}".format(system_dict["total_tests"]));
  517. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  518. print("")
  519. print("Running {}/<num>".format(exp_num));
  520. exp_num += 1;
  521. system_dict = test_layer_instance_normalization(system_dict)
  522. sys.stdout = origstdout;
  523. print("Tests Completed - {}".format(system_dict["total_tests"]));
  524. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  525. print("")
  526. print("Running {}/<num>".format(exp_num));
  527. exp_num += 1;
  528. system_dict = test_layer_layer_normalization(system_dict)
  529. sys.stdout = origstdout;
  530. print("Tests Completed - {}".format(system_dict["total_tests"]));
  531. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  532. print("")
  533. print("Running {}/<num>".format(exp_num));
  534. exp_num += 1;
  535. system_dict = test_layer_identity(system_dict)
  536. sys.stdout = origstdout;
  537. print("Tests Completed - {}".format(system_dict["total_tests"]));
  538. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  539. print("")
  540. print("Running {}/<num>".format(exp_num));
  541. exp_num += 1;
  542. system_dict = test_layer_fully_connected(system_dict)
  543. sys.stdout = origstdout;
  544. print("Tests Completed - {}".format(system_dict["total_tests"]));
  545. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  546. print("")
  547. print("Running {}/<num>".format(exp_num));
  548. exp_num += 1;
  549. system_dict = test_layer_dropout(system_dict)
  550. sys.stdout = origstdout;
  551. print("Tests Completed - {}".format(system_dict["total_tests"]));
  552. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  553. print("")
  554. print("Running {}/<num>".format(exp_num));
  555. exp_num += 1;
  556. system_dict = test_layer_flatten(system_dict)
  557. sys.stdout = origstdout;
  558. print("Tests Completed - {}".format(system_dict["total_tests"]));
  559. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  560. print("")
  561. print("Running {}/<num>".format(exp_num));
  562. exp_num += 1;
  563. system_dict = test_activation_relu(system_dict)
  564. sys.stdout = origstdout;
  565. print("Tests Completed - {}".format(system_dict["total_tests"]));
  566. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  567. print("")
  568. print("Running {}/<num>".format(exp_num));
  569. exp_num += 1;
  570. system_dict = test_activation_sigmoid(system_dict)
  571. sys.stdout = origstdout;
  572. print("Tests Completed - {}".format(system_dict["total_tests"]));
  573. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  574. print("")
  575. print("Running {}/<num>".format(exp_num));
  576. exp_num += 1;
  577. system_dict = test_activation_tanh(system_dict)
  578. sys.stdout = origstdout;
  579. print("Tests Completed - {}".format(system_dict["total_tests"]));
  580. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  581. print("")
  582. print("Running {}/<num>".format(exp_num));
  583. exp_num += 1;
  584. system_dict = test_activation_softplus(system_dict)
  585. sys.stdout = origstdout;
  586. print("Tests Completed - {}".format(system_dict["total_tests"]));
  587. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  588. print("")
  589. print("Running {}/<num>".format(exp_num));
  590. exp_num += 1;
  591. system_dict = test_activation_softsign(system_dict)
  592. sys.stdout = origstdout;
  593. print("Tests Completed - {}".format(system_dict["total_tests"]));
  594. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  595. print("")
  596. print("Running {}/<num>".format(exp_num));
  597. exp_num += 1;
  598. system_dict = test_activation_elu(system_dict)
  599. sys.stdout = origstdout;
  600. print("Tests Completed - {}".format(system_dict["total_tests"]));
  601. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  602. print("")
  603. print("Running {}/<num>".format(exp_num));
  604. exp_num += 1;
  605. system_dict = test_activation_leaky_relu(system_dict)
  606. sys.stdout = origstdout;
  607. print("Tests Completed - {}".format(system_dict["total_tests"]));
  608. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  609. print("")
  610. print("Running {}/<num>".format(exp_num));
  611. exp_num += 1;
  612. system_dict = test_activation_prelu(system_dict)
  613. sys.stdout = origstdout;
  614. print("Tests Completed - {}".format(system_dict["total_tests"]));
  615. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  616. print("")
  617. print("Running {}/<num>".format(exp_num));
  618. exp_num += 1;
  619. system_dict = test_activation_selu(system_dict)
  620. sys.stdout = origstdout;
  621. print("Tests Completed - {}".format(system_dict["total_tests"]));
  622. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  623. print("")
  624. print("Running {}/<num>".format(exp_num));
  625. exp_num += 1;
  626. system_dict = test_activation_hardshrink(system_dict)
  627. sys.stdout = origstdout;
  628. print("Tests Completed - {}".format(system_dict["total_tests"]));
  629. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  630. print("")
  631. print("Running {}/<num>".format(exp_num));
  632. exp_num += 1;
  633. system_dict = test_activation_hardtanh(system_dict)
  634. sys.stdout = origstdout;
  635. print("Tests Completed - {}".format(system_dict["total_tests"]));
  636. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  637. print("")
  638. print("Running {}/<num>".format(exp_num));
  639. exp_num += 1;
  640. system_dict = test_activation_logsigmoid(system_dict)
  641. sys.stdout = origstdout;
  642. print("Tests Completed - {}".format(system_dict["total_tests"]));
  643. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  644. print("")
  645. print("Running {}/<num>".format(exp_num));
  646. exp_num += 1;
  647. system_dict = test_activation_relu6(system_dict)
  648. sys.stdout = origstdout;
  649. print("Tests Completed - {}".format(system_dict["total_tests"]));
  650. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  651. print("")
  652. print("Running {}/<num>".format(exp_num));
  653. exp_num += 1;
  654. system_dict = test_activation_rrelu(system_dict)
  655. sys.stdout = origstdout;
  656. print("Tests Completed - {}".format(system_dict["total_tests"]));
  657. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  658. print("")
  659. print("Running {}/<num>".format(exp_num));
  660. exp_num += 1;
  661. system_dict = test_activation_celu(system_dict)
  662. sys.stdout = origstdout;
  663. print("Tests Completed - {}".format(system_dict["total_tests"]));
  664. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  665. print("")
  666. print("Running {}/<num>".format(exp_num));
  667. exp_num += 1;
  668. system_dict = test_activation_softshrink(system_dict)
  669. sys.stdout = origstdout;
  670. print("Tests Completed - {}".format(system_dict["total_tests"]));
  671. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  672. print("")
  673. print("Running {}/<num>".format(exp_num));
  674. exp_num += 1;
  675. system_dict = test_activation_tanhshrink(system_dict)
  676. sys.stdout = origstdout;
  677. print("Tests Completed - {}".format(system_dict["total_tests"]));
  678. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  679. print("")
  680. print("Running {}/<num>".format(exp_num));
  681. exp_num += 1;
  682. system_dict = test_activation_threshold(system_dict)
  683. sys.stdout = origstdout;
  684. print("Tests Completed - {}".format(system_dict["total_tests"]));
  685. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  686. print("")
  687. print("Running {}/<num>".format(exp_num));
  688. exp_num += 1;
  689. system_dict = test_activation_softmin(system_dict)
  690. sys.stdout = origstdout;
  691. print("Tests Completed - {}".format(system_dict["total_tests"]));
  692. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  693. print("")
  694. print("Running {}/<num>".format(exp_num));
  695. exp_num += 1;
  696. system_dict = test_activation_softmax(system_dict)
  697. sys.stdout = origstdout;
  698. print("Tests Completed - {}".format(system_dict["total_tests"]));
  699. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  700. print("")
  701. print("Running {}/<num>".format(exp_num));
  702. exp_num += 1;
  703. system_dict = test_activation_logsoftmax(system_dict)
  704. sys.stdout = origstdout;
  705. print("Tests Completed - {}".format(system_dict["total_tests"]));
  706. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  707. print("")
  708. print("Running {}/<num>".format(exp_num));
  709. exp_num += 1;
  710. system_dict = test_layer_concatenate(system_dict)
  711. sys.stdout = origstdout;
  712. print("Tests Completed - {}".format(system_dict["total_tests"]));
  713. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  714. print("")
  715. print("Running {}/<num>".format(exp_num));
  716. exp_num += 1;
  717. system_dict = test_layer_add(system_dict)
  718. sys.stdout = origstdout;
  719. print("Tests Completed - {}".format(system_dict["total_tests"]));
  720. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  721. print("")
  722. print("Running {}/<num>".format(exp_num));
  723. exp_num += 1;
  724. system_dict = test_block_resnet_v1(system_dict)
  725. sys.stdout = origstdout;
  726. print("Tests Completed - {}".format(system_dict["total_tests"]));
  727. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  728. print("")
  729. print("Running {}/<num>".format(exp_num));
  730. exp_num += 1;
  731. system_dict = test_block_resnet_v2(system_dict)
  732. sys.stdout = origstdout;
  733. print("Tests Completed - {}".format(system_dict["total_tests"]));
  734. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  735. print("")
  736. print("Running {}/<num>".format(exp_num));
  737. exp_num += 1;
  738. system_dict = test_block_resnet_v1_bottleneck(system_dict)
  739. sys.stdout = origstdout;
  740. print("Tests Completed - {}".format(system_dict["total_tests"]));
  741. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  742. print("")
  743. print("Running {}/<num>".format(exp_num));
  744. exp_num += 1;
  745. system_dict = test_block_resnet_v2_bottleneck(system_dict)
  746. sys.stdout = origstdout;
  747. print("Tests Completed - {}".format(system_dict["total_tests"]));
  748. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  749. print("")
  750. print("Running {}/<num>".format(exp_num));
  751. exp_num += 1;
  752. system_dict = test_block_resnext(system_dict)
  753. sys.stdout = origstdout;
  754. print("Tests Completed - {}".format(system_dict["total_tests"]));
  755. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  756. print("")
  757. print("Running {}/<num>".format(exp_num));
  758. exp_num += 1;
  759. system_dict = test_block_mobilenet_v2_linear_bottleneck(system_dict)
  760. sys.stdout = origstdout;
  761. print("Tests Completed - {}".format(system_dict["total_tests"]));
  762. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  763. print("")
  764. print("Running {}/<num>".format(exp_num));
  765. exp_num += 1;
  766. system_dict = test_block_mobilenet_v2_inverted_linear_bottleneck(system_dict)
  767. sys.stdout = origstdout;
  768. print("Tests Completed - {}".format(system_dict["total_tests"]));
  769. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  770. print("")
  771. print("Running {}/<num>".format(exp_num));
  772. exp_num += 1;
  773. system_dict = test_block_squeezenet_fire(system_dict)
  774. sys.stdout = origstdout;
  775. print("Tests Completed - {}".format(system_dict["total_tests"]));
  776. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  777. print("")
  778. print("Running {}/<num>".format(exp_num));
  779. exp_num += 1;
  780. system_dict = test_block_densenet(system_dict)
  781. sys.stdout = origstdout;
  782. print("Tests Completed - {}".format(system_dict["total_tests"]));
  783. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  784. print("")
  785. print("Running {}/<num>".format(exp_num));
  786. exp_num += 1;
  787. system_dict = test_block_conv_bn_relu(system_dict)
  788. sys.stdout = origstdout;
  789. print("Tests Completed - {}".format(system_dict["total_tests"]));
  790. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  791. print("")
  792. print("Running {}/<num>".format(exp_num));
  793. exp_num += 1;
  794. system_dict = test_block_inception_a(system_dict)
  795. sys.stdout = origstdout;
  796. print("Tests Completed - {}".format(system_dict["total_tests"]));
  797. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  798. print("")
  799. print("Running {}/<num>".format(exp_num));
  800. exp_num += 1;
  801. system_dict = test_block_inception_b(system_dict)
  802. sys.stdout = origstdout;
  803. print("Tests Completed - {}".format(system_dict["total_tests"]));
  804. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  805. print("")
  806. print("Running {}/<num>".format(exp_num));
  807. exp_num += 1;
  808. system_dict = test_block_inception_c(system_dict)
  809. sys.stdout = origstdout;
  810. print("Tests Completed - {}".format(system_dict["total_tests"]));
  811. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  812. print("")
  813. print("Running {}/<num>".format(exp_num));
  814. exp_num += 1;
  815. system_dict = test_block_inception_d(system_dict)
  816. sys.stdout = origstdout;
  817. print("Tests Completed - {}".format(system_dict["total_tests"]));
  818. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  819. print("")
  820. print("Running {}/<num>".format(exp_num));
  821. exp_num += 1;
  822. system_dict = test_block_inception_e(system_dict)
  823. sys.stdout = origstdout;
  824. print("Tests Completed - {}".format(system_dict["total_tests"]));
  825. print("Tests Succesful - {}".format(system_dict["successful_tests"]));
  826. print("")
  827. sys.stdout = open("test_logs.txt", 'a');
  828. end = time.time();
  829. print("Total Tests - {}".format(system_dict["total_tests"]));
  830. print("Time Taken - {} sec".format(end-start));
  831. print("Num Successful Tests - {}".format(system_dict["successful_tests"]));
  832. print("Num Failed Tests - {}".format(len(system_dict["failed_tests_lists"])));
  833. print("Num Skipped Tests - {}".format(len(system_dict["skipped_tests_lists"])));
  834. print("");
  835. for i in range(len(system_dict["failed_tests_lists"])):
  836. print("{}. Failed Test:".format(i+1));
  837. print("Name - {}".format(system_dict["failed_tests_lists"][i]));
  838. print("Error - {}".format(system_dict["failed_tests_exceptions"][i]));
  839. print("");
  840. print("Skipped Tests List - {}".format(system_dict["skipped_tests_lists"]));
  841. print("");
  842. sys.stdout = origstdout;
  843. print("Total Tests - {}".format(system_dict["total_tests"]));
  844. print("Time Taken - {} sec".format(end-start));
  845. print("Num Successful Tests - {}".format(system_dict["successful_tests"]));
  846. print("Num Failed Tests - {}".format(len(system_dict["failed_tests_lists"])));
  847. print("Num Skipped Tests - {}".format(len(system_dict["skipped_tests_lists"])));
  848. print("See test_logs.txt for errors");
  849. print("");
  850. os.system("rm -r workspace");