aioway 0.3.2__tar.gz → 0.3.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (260) hide show
  1. {aioway-0.3.2 → aioway-0.3.3}/Makefile +2 -0
  2. {aioway-0.3.2/src/aioway.egg-info → aioway-0.3.3}/PKG-INFO +4 -11
  3. {aioway-0.3.2/docs → aioway-0.3.3}/README.md +3 -10
  4. aioway-0.3.3/assets/aioway-noto-sans.svg +51 -0
  5. aioway-0.3.3/assets/aioway-noto-serif.svg +51 -0
  6. {aioway-0.3.2 → aioway-0.3.3/docs}/README.md +3 -10
  7. {aioway-0.3.2 → aioway-0.3.3}/notebooks/attributes.py +1 -1
  8. {aioway-0.3.2 → aioway-0.3.3}/notebooks/history.py +3 -4
  9. {aioway-0.3.2 → aioway-0.3.3}/notebooks/mnist.py +1 -1
  10. {aioway-0.3.2 → aioway-0.3.3}/notebooks/state_dicts.py +1 -1
  11. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/_api/items.py +1 -1
  12. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/_utils/sets.py +61 -23
  13. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/_utils/types.py +24 -1
  14. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/_utils/typing.py +14 -12
  15. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/apps/entrypoint.py +1 -1
  16. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/cc/__init__.py +1 -2
  17. aioway-0.3.3/src/aioway/cc/regs.py +42 -0
  18. aioway-0.3.3/src/aioway/cc/rewrites/morphing.py +100 -0
  19. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/cc/rewrites/rewrites.py +4 -4
  20. aioway-0.3.3/src/aioway/cc/signs/__init__.py +4 -0
  21. aioway-0.3.3/src/aioway/cc/signs/modules.py +49 -0
  22. {aioway-0.3.2/src/aioway/cc → aioway-0.3.3/src/aioway/cc/signs}/signs.py +9 -3
  23. aioway-0.3.3/src/aioway/contrib/_renders.py +400 -0
  24. {aioway-0.3.2/src/aioway/tasks → aioway-0.3.3/src/aioway/em}/static.py +34 -2
  25. aioway-0.3.3/src/aioway/em/tasks.py +33 -0
  26. {aioway-0.3.2/src/aioway/cc → aioway-0.3.3/src/aioway}/ir/__init__.py +4 -3
  27. {aioway-0.3.2/src/aioway/cc → aioway-0.3.3/src/aioway}/ir/calls.py +16 -10
  28. aioway-0.3.3/src/aioway/ir/instrs/__init__.py +6 -0
  29. aioway-0.3.3/src/aioway/ir/instrs/calls.py +104 -0
  30. aioway-0.3.3/src/aioway/ir/instrs/instrs.py +136 -0
  31. aioway-0.3.2/src/aioway/tasks/supervised.py → aioway-0.3.3/src/aioway/ir/intrptrs/__init__.py +2 -0
  32. {aioway-0.3.2/src/aioway/cc/ir → aioway-0.3.3/src/aioway/ir/intrptrs}/execs.py +42 -28
  33. aioway-0.3.3/src/aioway/ir/intrptrs/intrptrs.py +92 -0
  34. {aioway-0.3.2/src/aioway/cc → aioway-0.3.3/src/aioway}/ir/modules.py +17 -25
  35. aioway-0.3.3/src/aioway/ir/progs/__init__.py +4 -0
  36. aioway-0.3.3/src/aioway/ir/progs/progs.py +521 -0
  37. aioway-0.3.3/src/aioway/ir/progs/subs.py +15 -0
  38. aioway-0.3.3/src/aioway/ir/queries/__init__.py +4 -0
  39. aioway-0.3.3/src/aioway/ir/queries/queries.py +158 -0
  40. aioway-0.3.3/src/aioway/ir/queries/seqs.py +109 -0
  41. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/__init__.py +0 -1
  42. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/attrs/attrs.py +28 -7
  43. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/attrs/caches.py +3 -3
  44. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/discovery.py +2 -2
  45. aioway-0.3.3/src/aioway/t/lists.py +203 -0
  46. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/nested.py +9 -9
  47. aioway-0.3.3/src/aioway/t/overrides/fake.py +105 -0
  48. {aioway-0.3.2 → aioway-0.3.3/src/aioway.egg-info}/PKG-INFO +4 -11
  49. {aioway-0.3.2 → aioway-0.3.3}/src/aioway.egg-info/SOURCES.txt +43 -38
  50. {aioway-0.3.2 → aioway-0.3.3}/src/aioway.egg-info/scm_file_list.json +42 -37
  51. aioway-0.3.3/src/aioway.egg-info/scm_version.json +8 -0
  52. {aioway-0.3.2 → aioway-0.3.3}/tests/_utils/test_types.py +14 -1
  53. aioway-0.3.3/tests/cc/rewrites/test_morphing.py +268 -0
  54. {aioway-0.3.2 → aioway-0.3.3}/tests/cc/test_rebuilds.py +4 -4
  55. aioway-0.3.3/tests/cc/test_regs.py +74 -0
  56. {aioway-0.3.2/tests/tasks → aioway-0.3.3/tests/em}/test_distils.py +1 -1
  57. {aioway-0.3.2/tests/tasks → aioway-0.3.3/tests/em}/test_expls.py +1 -1
  58. {aioway-0.3.2/tests/cc → aioway-0.3.3/tests}/ir/conftest.py +6 -6
  59. {aioway-0.3.2/tests/cc → aioway-0.3.3/tests}/ir/test_calls.py +47 -44
  60. {aioway-0.3.2/tests/cc → aioway-0.3.3/tests}/ir/test_dags.py +14 -14
  61. {aioway-0.3.2/tests/cc → aioway-0.3.3/tests}/ir/test_execs.py +2 -2
  62. {aioway-0.3.2/tests/cc → aioway-0.3.3/tests}/ir/test_modules.py +10 -10
  63. aioway-0.3.3/tests/ir/test_queries.py +346 -0
  64. aioway-0.3.3/tests/t/overrides/test_fake.py +279 -0
  65. {aioway-0.3.2 → aioway-0.3.3}/tests/t/test_lists.py +18 -6
  66. aioway-0.3.2/src/aioway/cc/deductions/__init__.py +0 -6
  67. aioway-0.3.2/src/aioway/cc/deductions/containers.py +0 -21
  68. aioway-0.3.2/src/aioway/cc/deductions/deductions.py +0 -235
  69. aioway-0.3.2/src/aioway/cc/deductions/dense.py +0 -56
  70. aioway-0.3.2/src/aioway/cc/deductions/losses.py +0 -26
  71. aioway-0.3.2/src/aioway/cc/deductions/miscs.py +0 -43
  72. aioway-0.3.2/src/aioway/cc/deductions/sliding.py +0 -41
  73. aioway-0.3.2/src/aioway/cc/ir/_utils.py +0 -98
  74. aioway-0.3.2/src/aioway/cc/ir/dags.py +0 -420
  75. aioway-0.3.2/src/aioway/cc/ir/queries.py +0 -25
  76. aioway-0.3.2/src/aioway/cc/regs.py +0 -118
  77. aioway-0.3.2/src/aioway/cc/rewrites/morphing.py +0 -60
  78. aioway-0.3.2/src/aioway/t/lists.py +0 -119
  79. aioway-0.3.2/src/aioway/t/overrides/fake.py +0 -157
  80. aioway-0.3.2/src/aioway/t/visitors.py +0 -70
  81. aioway-0.3.2/src/aioway/tasks/tasks.py +0 -43
  82. aioway-0.3.2/src/aioway.egg-info/scm_version.json +0 -8
  83. aioway-0.3.2/tests/cc/rewrites/test_morphing.py +0 -62
  84. aioway-0.3.2/tests/cc/test_deductions.py +0 -61
  85. aioway-0.3.2/tests/t/overrides/test_utils.py +0 -163
  86. {aioway-0.3.2 → aioway-0.3.3}/.gitattributes +0 -0
  87. {aioway-0.3.2 → aioway-0.3.3}/.github/workflows/pre-commit.yaml +0 -0
  88. {aioway-0.3.2 → aioway-0.3.3}/.github/workflows/publish.yaml +0 -0
  89. {aioway-0.3.2 → aioway-0.3.3}/.github/workflows/unit-test.yaml +0 -0
  90. {aioway-0.3.2 → aioway-0.3.3}/.github/workflows/website.yaml +0 -0
  91. {aioway-0.3.2 → aioway-0.3.3}/.gitignore +0 -0
  92. {aioway-0.3.2 → aioway-0.3.3}/CITATIONS.cff +0 -0
  93. {aioway-0.3.2 → aioway-0.3.3}/CODEOWNERS +0 -0
  94. {aioway-0.3.2 → aioway-0.3.3}/CODE_OF_CONDUCT.md +0 -0
  95. {aioway-0.3.2 → aioway-0.3.3}/CONTRIBUTING.md +0 -0
  96. {aioway-0.3.2 → aioway-0.3.3}/LICENSE.md +0 -0
  97. {aioway-0.3.2 → aioway-0.3.3}/assets/architecture.excalidraw +0 -0
  98. {aioway-0.3.2 → aioway-0.3.3}/assets/architecture.svg +0 -0
  99. {aioway-0.3.2 → aioway-0.3.3}/ci/cleanup-github.sh +0 -0
  100. {aioway-0.3.2 → aioway-0.3.3}/ci/docs.sh +0 -0
  101. {aioway-0.3.2 → aioway-0.3.3}/ci/echo-run.sh +0 -0
  102. {aioway-0.3.2 → aioway-0.3.3}/ci/group-actions.py +0 -0
  103. {aioway-0.3.2 → aioway-0.3.3}/ci/install-linux.sh +0 -0
  104. {aioway-0.3.2 → aioway-0.3.3}/ci/install-mac.sh +0 -0
  105. {aioway-0.3.2 → aioway-0.3.3}/docs/.nojekyll +0 -0
  106. {aioway-0.3.2 → aioway-0.3.3}/docs/CNAME +0 -0
  107. {aioway-0.3.2 → aioway-0.3.3}/docs/Makefile +0 -0
  108. {aioway-0.3.2 → aioway-0.3.3}/docs/_coverpage.md +0 -0
  109. {aioway-0.3.2 → aioway-0.3.3}/docs/coverpage.css +0 -0
  110. {aioway-0.3.2 → aioway-0.3.3}/docs/dev/conf.py +0 -0
  111. {aioway-0.3.2 → aioway-0.3.3}/docs/dev/index.md +0 -0
  112. {aioway-0.3.2 → aioway-0.3.3}/docs/dev/index.rst +0 -0
  113. {aioway-0.3.2 → aioway-0.3.3}/docs/index.html +0 -0
  114. {aioway-0.3.2 → aioway-0.3.3}/media/.gitkeep +0 -0
  115. {aioway-0.3.2 → aioway-0.3.3}/media/file_example_JPG_2500kB.jpg +0 -0
  116. {aioway-0.3.2 → aioway-0.3.3}/media/file_example_MP3_5MG.mp3 +0 -0
  117. {aioway-0.3.2 → aioway-0.3.3}/media/file_example_MP4_1920_18MG.mp4 +0 -0
  118. {aioway-0.3.2 → aioway-0.3.3}/media/file_example_PNG_3MB.png +0 -0
  119. {aioway-0.3.2 → aioway-0.3.3}/media/in_search_of_lost_time.txt +0 -0
  120. {aioway-0.3.2 → aioway-0.3.3}/notebooks/aten.py +0 -0
  121. {aioway-0.3.2 → aioway-0.3.3}/notebooks/disable_ops.py +0 -0
  122. {aioway-0.3.2 → aioway-0.3.3}/notebooks/grads.py +0 -0
  123. {aioway-0.3.2 → aioway-0.3.3}/notebooks/hello.py +0 -0
  124. {aioway-0.3.2 → aioway-0.3.3}/notebooks/missing_values.py +0 -0
  125. {aioway-0.3.2 → aioway-0.3.3}/notebooks/print_torch_ops.py +0 -0
  126. {aioway-0.3.2 → aioway-0.3.3}/pdm.lock +0 -0
  127. {aioway-0.3.2 → aioway-0.3.3}/pyproject.toml +0 -0
  128. {aioway-0.3.2 → aioway-0.3.3}/setup.cfg +0 -0
  129. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/__init__.py +0 -0
  130. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/_api/__init__.py +0 -0
  131. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/_api/fast.py +0 -0
  132. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/_thunks.py +0 -0
  133. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/_utils/__init__.py +0 -0
  134. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/_utils/platforms.py +0 -0
  135. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/_utils/profs.py +0 -0
  136. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/_utils/renders.py +0 -0
  137. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/_utils/signs.py +0 -0
  138. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/api.py +0 -0
  139. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/apps/__init__.py +0 -0
  140. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/apps/server.py +0 -0
  141. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/cc/README.md +0 -0
  142. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/cc/args.py +0 -0
  143. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/cc/emits/__init__.py +0 -0
  144. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/cc/emits/_utils.py +0 -0
  145. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/cc/emits/compound.py +0 -0
  146. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/cc/emits/convs.py +0 -0
  147. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/cc/emits/emitters.py +0 -0
  148. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/cc/emits/linear.py +0 -0
  149. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/cc/emits/losses/__init__.py +0 -0
  150. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/cc/emits/losses/contrastive.py +0 -0
  151. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/cc/emits/losses/recon.py +0 -0
  152. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/cc/emits/losses/routes.py +0 -0
  153. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/cc/emits/norms.py +0 -0
  154. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/cc/hashes.py +0 -0
  155. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/cc/rebuild.py +0 -0
  156. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/cc/rewrites/__init__.py +0 -0
  157. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/cc/rewrites/matchers.py +0 -0
  158. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/contrib/__init__.py +0 -0
  159. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/contrib/dsets.py +0 -0
  160. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/contrib/mnist.py +0 -0
  161. {aioway-0.3.2/src/aioway/tasks → aioway-0.3.3/src/aioway/em}/__init__.py +0 -0
  162. {aioway-0.3.2/src/aioway/tasks → aioway-0.3.3/src/aioway/em}/distils.py +0 -0
  163. {aioway-0.3.2/src/aioway/tasks → aioway-0.3.3/src/aioway/em}/expls/__init__.py +0 -0
  164. {aioway-0.3.2/src/aioway/tasks → aioway-0.3.3/src/aioway/em}/expls/expls.py +0 -0
  165. {aioway-0.3.2/src/aioway/tasks → aioway-0.3.3/src/aioway/em}/expls/inputs.py +0 -0
  166. {aioway-0.3.2/src/aioway/tasks → aioway-0.3.3/src/aioway/em}/losses.py +0 -0
  167. {aioway-0.3.2/src/aioway/tasks → aioway-0.3.3/src/aioway/em}/nmf.py +0 -0
  168. {aioway-0.3.2/src/aioway/tasks → aioway-0.3.3/src/aioway/em}/rl.py +0 -0
  169. {aioway-0.3.2/src/aioway/tasks → aioway-0.3.3/src/aioway/em}/steps.py +0 -0
  170. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/errors/__init__.py +0 -0
  171. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/errors/exceptions.py +0 -0
  172. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/errors/raising.py +0 -0
  173. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/io/__init__.py +0 -0
  174. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/io/codecs/__init__.py +0 -0
  175. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/io/codecs/_av.py +0 -0
  176. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/io/codecs/_bases.py +0 -0
  177. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/io/codecs/audios.py +0 -0
  178. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/io/codecs/collates.py +0 -0
  179. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/io/codecs/images.py +0 -0
  180. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/io/codecs/texts.py +0 -0
  181. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/io/codecs/videos.py +0 -0
  182. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/io/dsets/__init__.py +0 -0
  183. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/io/dsets/comps.py +0 -0
  184. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/io/dsets/dsets.py +0 -0
  185. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/README.md +0 -0
  186. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/_utils.py +0 -0
  187. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/aten/README.md +0 -0
  188. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/aten/__init__.py +0 -0
  189. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/aten/aten.py +0 -0
  190. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/aten/binary.py +0 -0
  191. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/aten/fn.py +0 -0
  192. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/aten/getitem.py +0 -0
  193. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/attrs/README.md +0 -0
  194. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/attrs/__init__.py +0 -0
  195. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/attrs/_bases.py +0 -0
  196. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/attrs/_utils.py +0 -0
  197. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/attrs/devices.py +0 -0
  198. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/attrs/dtypes.py +0 -0
  199. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/attrs/layouts.py +0 -0
  200. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/attrs/shapes.py +0 -0
  201. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/guards.py +0 -0
  202. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/hooks.py +0 -0
  203. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/overrides/README.md +0 -0
  204. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/overrides/__init__.py +0 -0
  205. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/overrides/contexts.py +0 -0
  206. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/overrides/modes.py +0 -0
  207. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/overrides/toggles.py +0 -0
  208. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/routes.py +0 -0
  209. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/sessions/__init__.py +0 -0
  210. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/sessions/costs.py +0 -0
  211. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/sessions/sessions.py +0 -0
  212. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/tspecs/README.md +0 -0
  213. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/tspecs/__init__.py +0 -0
  214. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/tspecs/_utils.py +0 -0
  215. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/tspecs/boxes.py +0 -0
  216. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/tspecs/coercions.py +0 -0
  217. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/tspecs/gym.py +0 -0
  218. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/tspecs/losses.py +0 -0
  219. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/tspecs/media.py +0 -0
  220. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/tspecs/sampling.py +0 -0
  221. {aioway-0.3.2 → aioway-0.3.3}/src/aioway/t/tspecs/tspecs.py +0 -0
  222. {aioway-0.3.2 → aioway-0.3.3}/src/aioway.egg-info/dependency_links.txt +0 -0
  223. {aioway-0.3.2 → aioway-0.3.3}/src/aioway.egg-info/requires.txt +0 -0
  224. {aioway-0.3.2 → aioway-0.3.3}/src/aioway.egg-info/top_level.txt +0 -0
  225. {aioway-0.3.2 → aioway-0.3.3}/tests/__init__.py +0 -0
  226. {aioway-0.3.2 → aioway-0.3.3}/tests/_utils/test_sets.py +0 -0
  227. {aioway-0.3.2 → aioway-0.3.3}/tests/_utils/test_signs.py +0 -0
  228. {aioway-0.3.2 → aioway-0.3.3}/tests/cc/emits/losses/test_contrastive.py +0 -0
  229. {aioway-0.3.2 → aioway-0.3.3}/tests/cc/emits/losses/test_losses.py +0 -0
  230. {aioway-0.3.2 → aioway-0.3.3}/tests/cc/emits/test_compound.py +0 -0
  231. {aioway-0.3.2 → aioway-0.3.3}/tests/cc/emits/test_convs.py +0 -0
  232. {aioway-0.3.2 → aioway-0.3.3}/tests/cc/emits/test_linear.py +0 -0
  233. {aioway-0.3.2 → aioway-0.3.3}/tests/cc/emits/test_norms.py +0 -0
  234. {aioway-0.3.2 → aioway-0.3.3}/tests/cc/rewrites/test_matchers.py +0 -0
  235. {aioway-0.3.2 → aioway-0.3.3}/tests/cc/test_args.py +0 -0
  236. {aioway-0.3.2 → aioway-0.3.3}/tests/cc/test_hashes.py +0 -0
  237. {aioway-0.3.2 → aioway-0.3.3}/tests/conftest.py +0 -0
  238. {aioway-0.3.2 → aioway-0.3.3}/tests/io/codecs/conftest.py +0 -0
  239. {aioway-0.3.2 → aioway-0.3.3}/tests/io/codecs/test_audios.py +0 -0
  240. {aioway-0.3.2 → aioway-0.3.3}/tests/io/codecs/test_collate.py +0 -0
  241. {aioway-0.3.2 → aioway-0.3.3}/tests/io/codecs/test_images.py +0 -0
  242. {aioway-0.3.2 → aioway-0.3.3}/tests/io/codecs/test_media.py +0 -0
  243. {aioway-0.3.2 → aioway-0.3.3}/tests/io/codecs/test_texts.py +0 -0
  244. {aioway-0.3.2 → aioway-0.3.3}/tests/io/codecs/test_videos.py +0 -0
  245. {aioway-0.3.2 → aioway-0.3.3}/tests/mock.py +0 -0
  246. {aioway-0.3.2 → aioway-0.3.3}/tests/t/attrs/test_devices.py +0 -0
  247. {aioway-0.3.2 → aioway-0.3.3}/tests/t/attrs/test_dtypes.py +0 -0
  248. {aioway-0.3.2 → aioway-0.3.3}/tests/t/attrs/test_layouts.py +0 -0
  249. {aioway-0.3.2 → aioway-0.3.3}/tests/t/attrs/test_schemas.py +0 -0
  250. {aioway-0.3.2 → aioway-0.3.3}/tests/t/attrs/test_shapes.py +0 -0
  251. {aioway-0.3.2 → aioway-0.3.3}/tests/t/sessions/test_costs.py +0 -0
  252. {aioway-0.3.2 → aioway-0.3.3}/tests/t/sessions/test_sessions.py +0 -0
  253. {aioway-0.3.2 → aioway-0.3.3}/tests/t/test_discovery.py +0 -0
  254. {aioway-0.3.2 → aioway-0.3.3}/tests/t/test_nested.py +0 -0
  255. {aioway-0.3.2 → aioway-0.3.3}/tests/t/tspecs/test_boxes.py +0 -0
  256. {aioway-0.3.2 → aioway-0.3.3}/tests/t/tspecs/test_gym.py +0 -0
  257. {aioway-0.3.2 → aioway-0.3.3}/tests/t/tspecs/test_types.py +0 -0
  258. {aioway-0.3.2 → aioway-0.3.3}/tests/test_api.py +0 -0
  259. {aioway-0.3.2 → aioway-0.3.3}/tests/test_ci.py +0 -0
  260. {aioway-0.3.2 → aioway-0.3.3}/tests/test_notebooks.py +0 -0
@@ -19,6 +19,8 @@ else
19
19
  endif
20
20
 
21
21
 
22
+ ci: autoflake isort black pyrefly pytest
23
+
22
24
  setup: cleanup deps
23
25
 
24
26
  cleanup:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aioway
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: AI on the way
5
5
  Author-email: RenChu Wang <patrick1031wang@gmail.com>
6
6
  License-Expression: Apache-2.0
@@ -36,16 +36,9 @@ Requires-Dist: fastapi>=0.141; extra == "api"
36
36
  Requires-Dist: fastmcp>=3; extra == "api"
37
37
  Dynamic: license-file
38
38
 
39
- ```
40
- _____
41
- ______ ___(_)________ _______ _____ __
42
- _ __ `/_ /_ __ \_ | /| / / __ `/_ / / /
43
- / /_/ /_ / / /_/ /_ |/ |/ // /_/ /_ /_/ /
44
- \__,_/ /_/ \____/____/|__/ \__,_/ _\__, /
45
- /____/
46
-
47
- An optimizing compiler for ML algorithms.
48
- ```
39
+ <div align="center">
40
+ <img src="./assets/aioway-noto-sans.svg" />
41
+ </div>
49
42
 
50
43
  [![Unit Testing](https://github.com/rentruewang/aioway/actions/workflows/unit-test.yaml/badge.svg)](https://github.com/rentruewang/aioway/actions/workflows/unit-test.yaml)
51
44
  [![Pre Commit Checks](https://github.com/rentruewang/aioway/actions/workflows/pre-commit.yaml/badge.svg)](https://github.com/rentruewang/aioway/actions/workflows/pre-commit.yaml)
@@ -1,13 +1,6 @@
1
- ```
2
- _____
3
- ______ ___(_)________ _______ _____ __
4
- _ __ `/_ /_ __ \_ | /| / / __ `/_ / / /
5
- / /_/ /_ / / /_/ /_ |/ |/ // /_/ /_ /_/ /
6
- \__,_/ /_/ \____/____/|__/ \__,_/ _\__, /
7
- /____/
8
-
9
- An optimizing compiler for ML algorithms.
10
- ```
1
+ <div align="center">
2
+ <img src="./assets/aioway-noto-sans.svg" />
3
+ </div>
11
4
 
12
5
  [![Unit Testing](https://github.com/rentruewang/aioway/actions/workflows/unit-test.yaml/badge.svg)](https://github.com/rentruewang/aioway/actions/workflows/unit-test.yaml)
13
6
  [![Pre Commit Checks](https://github.com/rentruewang/aioway/actions/workflows/pre-commit.yaml/badge.svg)](https://github.com/rentruewang/aioway/actions/workflows/pre-commit.yaml)
@@ -0,0 +1,51 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128" width="400" height="400">
2
+ <!-- Based on the Noto Emoji "motorway" (U+1F6E3), Copyright 2013 Google Inc.,
3
+ licensed under the Apache License 2.0: http://www.apache.org/licenses/LICENSE-2.0
4
+ Modified: cleaned up, sign symbols replaced with "AI" in Noto Sans Bold. -->
5
+
6
+ <!-- hills -->
7
+ <path fill="#a1d1da" d="M32.2,68.3l16.3-2.7c0,0-6.2-6.8-14.4-8.6S22.2,55.5,22.2,55.5s-6.1-3.9-10.3-5.1 s-8.1-0.8-8.1-0.8l 0,17.4L32.2,68.3z"/>
8
+ <path fill="#a1d1da" d="M94.6,70l-14.6-4.8c0,0,9.3-6.7,14.4-8.1c5.4-1.4,11.3-0.9,11.3-0.9 s4.4-3.9,9.6-5.9s9-2.1,9-2.1l 0,17.5c0,0-5.1,5.9-5.2,5.8C118.9,71.5,94.6,70,94.6,70z"/>
9
+
10
+ <!-- bushes -->
11
+ <path fill="#518e2c" d="M99.2,65c0,0,2.6-4,5.6-4.2c4-0.3,5.3,0.7,5.3,0.7s1.9-1.4,3.7-1.3 c2.5,0.1,4,2.5,4,2.5s1.2-3.5,2.6-3.5c2.4,0.1,2.7,6.1,2.7,6.1l-8.1,3.1L99.2,65z"/>
12
+ <path fill="#518e2c" d="M4.8,65.9c0,0,2.1-6.4,3.6-6.3c1.5,0.1,2.6,2.9,2.6,2.9s1.4-7.3,3.6-7.3 c2,0,3.4,10.2,3.4,10.2l3,1.3l3.4-0.8c0,0,1.6-4.4,2.8-4.3c1.1,0.1,1.8,2.2,1.8,2.2s0.8-4.2,2.4-4.2 c1.8,0,3,6,3,6L18.4,70.9L4.8,65.9z"/>
13
+
14
+ <!-- grass -->
15
+ <path fill="#7db240" d="M124.2,64.7l0,52c0,4.2-3.4,7.5-7.5,7.5H11.4c-4.2,0-7.5-3.4-7.5-7.5L3.8,65.4 L124.2,64.7z"/>
16
+
17
+ <!-- road -->
18
+ <path fill="#5e6367" d="M48.5,65.1c0,0,6.3-0.1,16.8-0.1c10.2 0,15.7-0.1,15.7-0.1l33.8,59.3l-102.4,0 L48.5,65.1z"/>
19
+
20
+ <!-- edge lines -->
21
+ <polygon fill="#ffffff" points="18.4,124.2 50.5,65.1 51.5,65.1 52.7,65.1 22.2,124.2 20.4,124.2"/>
22
+ <polygon fill="#ffffff" points="79.5,64.9 78.2,64.9 76.7,65 106.1,124.2 107.6,124.2 109.3,124.2"/>
23
+
24
+ <!-- lane dashes -->
25
+ <polygon fill="#ffffff" points="45.6,120.1 50,120.2 52.9,106.6 48.9,106.5"/>
26
+ <polygon fill="#ffffff" points="75.1,106.9 79,106.8 81.9,120.1 77,120.1"/>
27
+ <polygon fill="#ffffff" points="74.1,101.3 78,101.2 75.5,90.4 72.3,90.4"/>
28
+ <polygon fill="#ffffff" points="56.3,90.1 52.9,90.1 50.3,101.4 53.9,101.4"/>
29
+ <polygon fill="#ffffff" points="55.9,77.8 58.8,77.8 57.3,85.4 53.9,85.4"/>
30
+ <path fill="#ffffff" d="M57.9,70.1c-0.1,0.2-1.1,4.5-1.1,4.5h2.8l0.8-4.5H57.9z"/>
31
+ <path fill="#ffffff" d="M58.5,67.8h2.4L61.4,65c0,0-0.9 0-1.2 0c-0.3,0-1,0-1,0L58.5,67.8z"/>
32
+ <polygon fill="#ffffff" points="68.8,67.8 71.5,67.8 70.9,65 69.7,65 68.5,65"/>
33
+ <polygon fill="#ffffff" points="69.5,70.3 71.8,70.3 72.7,74.6 70,74.7"/>
34
+ <polygon fill="#ffffff" points="70.6,77.8 73.3,77.7 74.8,85.6 71.5,85.7"/>
35
+
36
+ <!-- gantry: posts, beams, braces -->
37
+ <polygon fill="#9a9a9a" points="17.5,20.2 17.5,80.2 23.2,80.2 23.2,19.1"/>
38
+ <polygon fill="#9a9a9a" points="104.5,82.7 104.9,19.8 110.6,20.2 110.3,82.7"/>
39
+ <path fill="#c8c8c8" d="M113.1,21.4H14c-1.1,0-2-0.9-2-2s0.9-2,2-2h99.1c1.1,0,2,0.9,2,2S114.2,21.4,113.1,21.4z"/>
40
+ <path fill="#c8c8c8" d="M14.1,40.9c-1.1,0-2-0.9-2-2c0-1.1,0.9-2,2-2l99.4-0.1c0,0,0,0,0,0c1.1,0,2,0.9,2,2 c0,1.1-0.9,2-2,2L14.1,40.9C14.1,40.9,14.1,40.9,14.1,40.9z"/>
41
+ <rect x="85.1" y="26.7" transform="translate(8.6 77.5) rotate(-45)" fill="#c8c8c8" width="25.7" height="3.5"/>
42
+ <rect x="28.8" y="16.2" transform="translate(-11.5 30.1) rotate(-45)" fill="#c8c8c8" width="3.5" height="25.6"/>
43
+
44
+ <!-- sign: frame and green face -->
45
+ <path fill="#dfe1e0" d="M90.8,48.6h-53.9c-2,0-3.6-1.6-3.6-3.6V11.8c0-2,1.6-3.6,3.6-3.6h53.9 c2,0,3.6,1.6,3.6,3.6v33.1C94.4,47,92.8,48.6,90.8,48.6z"/>
46
+ <polygon fill="#1b9372" points="36.4,45.5 36.7,10.9 91.2,11.1 91.2,45.4"/>
47
+
48
+ <!-- AI on the sign, drawn from Noto Sans Bold
49
+ (SIL Open Font License 1.1, https://openfontlicense.org) -->
50
+ <path fill="white" d="M63.87 37.85 62.39 33.33H55.6L54.12 37.85H49.68L56.44 18.55H61.5L68.31 37.85ZM60.1 25.71Q59.99 25.31 59.76 24.5Q59.53 23.69 59.32 22.84Q59.1 22 58.97 21.46Q58.86 22.08 58.66 22.87Q58.46 23.66 58.27 24.43Q58.08 25.2 57.95 25.71L56.57 29.88H61.44ZM77.92 37.85H69.17V35.54L71.51 34.46V22.02L69.17 20.95V18.63H77.92V20.95L75.58 22.02V34.46L77.92 35.54Z"/>
51
+ </svg>
@@ -0,0 +1,51 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128" width="400" height="400">
2
+ <!-- Based on the Noto Emoji "motorway" (U+1F6E3), Copyright 2013 Google Inc.,
3
+ licensed under the Apache License 2.0: http://www.apache.org/licenses/LICENSE-2.0
4
+ Modified: cleaned up, sign symbols replaced with "AI" in Noto Serif Bold. -->
5
+
6
+ <!-- hills -->
7
+ <path fill="#a1d1da" d="M32.2,68.3l16.3-2.7c0,0-6.2-6.8-14.4-8.6S22.2,55.5,22.2,55.5s-6.1-3.9-10.3-5.1 s-8.1-0.8-8.1-0.8l 0,17.4L32.2,68.3z"/>
8
+ <path fill="#a1d1da" d="M94.6,70l-14.6-4.8c0,0,9.3-6.7,14.4-8.1c5.4-1.4,11.3-0.9,11.3-0.9 s4.4-3.9,9.6-5.9s9-2.1,9-2.1l 0,17.5c0,0-5.1,5.9-5.2,5.8C118.9,71.5,94.6,70,94.6,70z"/>
9
+
10
+ <!-- bushes -->
11
+ <path fill="#518e2c" d="M99.2,65c0,0,2.6-4,5.6-4.2c4-0.3,5.3,0.7,5.3,0.7s1.9-1.4,3.7-1.3 c2.5,0.1,4,2.5,4,2.5s1.2-3.5,2.6-3.5c2.4,0.1,2.7,6.1,2.7,6.1l-8.1,3.1L99.2,65z"/>
12
+ <path fill="#518e2c" d="M4.8,65.9c0,0,2.1-6.4,3.6-6.3c1.5,0.1,2.6,2.9,2.6,2.9s1.4-7.3,3.6-7.3 c2,0,3.4,10.2,3.4,10.2l3,1.3l3.4-0.8c0,0,1.6-4.4,2.8-4.3c1.1,0.1,1.8,2.2,1.8,2.2s0.8-4.2,2.4-4.2 c1.8,0,3,6,3,6L18.4,70.9L4.8,65.9z"/>
13
+
14
+ <!-- grass -->
15
+ <path fill="#7db240" d="M124.2,64.7l0,52c0,4.2-3.4,7.5-7.5,7.5H11.4c-4.2,0-7.5-3.4-7.5-7.5L3.8,65.4 L124.2,64.7z"/>
16
+
17
+ <!-- road -->
18
+ <path fill="#5e6367" d="M48.5,65.1c0,0,6.3-0.1,16.8-0.1c10.2 0,15.7-0.1,15.7-0.1l33.8,59.3l-102.4,0 L48.5,65.1z"/>
19
+
20
+ <!-- edge lines -->
21
+ <polygon fill="#ffffff" points="18.4,124.2 50.5,65.1 51.5,65.1 52.7,65.1 22.2,124.2 20.4,124.2"/>
22
+ <polygon fill="#ffffff" points="79.5,64.9 78.2,64.9 76.7,65 106.1,124.2 107.6,124.2 109.3,124.2"/>
23
+
24
+ <!-- lane dashes -->
25
+ <polygon fill="#ffffff" points="45.6,120.1 50,120.2 52.9,106.6 48.9,106.5"/>
26
+ <polygon fill="#ffffff" points="75.1,106.9 79,106.8 81.9,120.1 77,120.1"/>
27
+ <polygon fill="#ffffff" points="74.1,101.3 78,101.2 75.5,90.4 72.3,90.4"/>
28
+ <polygon fill="#ffffff" points="56.3,90.1 52.9,90.1 50.3,101.4 53.9,101.4"/>
29
+ <polygon fill="#ffffff" points="55.9,77.8 58.8,77.8 57.3,85.4 53.9,85.4"/>
30
+ <path fill="#ffffff" d="M57.9,70.1c-0.1,0.2-1.1,4.5-1.1,4.5h2.8l0.8-4.5H57.9z"/>
31
+ <path fill="#ffffff" d="M58.5,67.8h2.4L61.4,65c0,0-0.9 0-1.2 0c-0.3,0-1,0-1,0L58.5,67.8z"/>
32
+ <polygon fill="#ffffff" points="68.8,67.8 71.5,67.8 70.9,65 69.7,65 68.5,65"/>
33
+ <polygon fill="#ffffff" points="69.5,70.3 71.8,70.3 72.7,74.6 70,74.7"/>
34
+ <polygon fill="#ffffff" points="70.6,77.8 73.3,77.7 74.8,85.6 71.5,85.7"/>
35
+
36
+ <!-- gantry: posts, beams, braces -->
37
+ <polygon fill="#9a9a9a" points="17.5,20.2 17.5,80.2 23.2,80.2 23.2,19.1"/>
38
+ <polygon fill="#9a9a9a" points="104.5,82.7 104.9,19.8 110.6,20.2 110.3,82.7"/>
39
+ <path fill="#c8c8c8" d="M113.1,21.4H14c-1.1,0-2-0.9-2-2s0.9-2,2-2h99.1c1.1,0,2,0.9,2,2S114.2,21.4,113.1,21.4z"/>
40
+ <path fill="#c8c8c8" d="M14.1,40.9c-1.1,0-2-0.9-2-2c0-1.1,0.9-2,2-2l99.4-0.1c0,0,0,0,0,0c1.1,0,2,0.9,2,2 c0,1.1-0.9,2-2,2L14.1,40.9C14.1,40.9,14.1,40.9,14.1,40.9z"/>
41
+ <rect x="85.1" y="26.7" transform="translate(8.6 77.5) rotate(-45)" fill="#c8c8c8" width="25.7" height="3.5"/>
42
+ <rect x="28.8" y="16.2" transform="translate(-11.5 30.1) rotate(-45)" fill="#c8c8c8" width="3.5" height="25.6"/>
43
+
44
+ <!-- sign: frame and green face -->
45
+ <path fill="#dfe1e0" d="M90.8,48.6h-53.9c-2,0-3.6-1.6-3.6-3.6V11.8c0-2,1.6-3.6,3.6-3.6h53.9 c2,0,3.6,1.6,3.6,3.6v33.1C94.4,47,92.8,48.6,90.8,48.6z"/>
46
+ <polygon fill="#1b9372" points="36.4,45.5 36.7,10.9 91.2,11.1 91.2,45.4"/>
47
+
48
+ <!-- AI on the sign, drawn from Noto Serif Bold
49
+ (SIL Open Font License 1.1, https://openfontlicense.org) -->
50
+ <path fill="white" d="M48.62 37.85V36.42H48.95Q49.68 36.42 50.16 36.04Q50.65 35.66 51.11 34.44L56.97 18.55H60.7L66.46 34.77Q66.79 35.69 67.29 36.05Q67.79 36.42 68.54 36.42H68.87V37.85H59.95V36.42H60.84Q61.43 36.42 61.8 36.19Q62.16 35.96 62.16 35.39Q62.16 35.07 62.08 34.74Q62 34.42 61.92 34.2L60.98 31.5H54.41L53.62 33.82Q53.51 34.15 53.41 34.59Q53.3 35.04 53.3 35.36Q53.3 36.42 54.62 36.42H55.65V37.85ZM54.97 29.85H60.43L58.84 24.88Q58.54 23.96 58.26 23.05Q57.97 22.15 57.79 21.23Q57.57 22.15 57.31 22.98Q57.06 23.82 56.73 24.74ZM69.63 37.85V36.42H70.6Q71.19 36.42 71.67 36.08Q72.14 35.74 72.14 34.85V21.63Q72.14 20.66 71.67 20.32Q71.19 19.98 70.6 19.98H69.63V18.55H78.98V19.98H77.95Q77.3 19.98 76.87 20.33Q76.44 20.69 76.44 21.66V34.82Q76.44 35.71 76.88 36.07Q77.33 36.42 77.95 36.42H78.98V37.85Z"/>
51
+ </svg>
@@ -1,13 +1,6 @@
1
- ```
2
- _____
3
- ______ ___(_)________ _______ _____ __
4
- _ __ `/_ /_ __ \_ | /| / / __ `/_ / / /
5
- / /_/ /_ / / /_/ /_ |/ |/ // /_/ /_ /_/ /
6
- \__,_/ /_/ \____/____/|__/ \__,_/ _\__, /
7
- /____/
8
-
9
- An optimizing compiler for ML algorithms.
10
- ```
1
+ <div align="center">
2
+ <img src="./assets/aioway-noto-sans.svg" />
3
+ </div>
11
4
 
12
5
  [![Unit Testing](https://github.com/rentruewang/aioway/actions/workflows/unit-test.yaml/badge.svg)](https://github.com/rentruewang/aioway/actions/workflows/unit-test.yaml)
13
6
  [![Pre Commit Checks](https://github.com/rentruewang/aioway/actions/workflows/pre-commit.yaml/badge.svg)](https://github.com/rentruewang/aioway/actions/workflows/pre-commit.yaml)
@@ -5,7 +5,7 @@
5
5
  # extension: .py
6
6
  # format_name: percent
7
7
  # format_version: '1.3'
8
- # jupytext_version: 1.19.3
8
+ # jupytext_version: 1.19.5
9
9
  # kernelspec:
10
10
  # display_name: Python 3 (ipykernel)
11
11
  # language: python
@@ -22,8 +22,7 @@ from torch import nn
22
22
  pretty.install()
23
23
 
24
24
  # %%
25
- from aioway.cc import track_module_thunks
26
- from aioway.cc.ir.queries import IndexQuery
25
+ from aioway.ir import IndexQuery, track_module_thunks
27
26
  from aioway.t import fake_mode
28
27
 
29
28
  # %%
@@ -45,7 +44,7 @@ with track_module_thunks() as hist:
45
44
  hist
46
45
 
47
46
  # %%
48
- list(hist.dag())
47
+ list(hist.program)
49
48
 
50
49
  # %%
51
- list(IndexQuery([0, 1, 2])(hist.dag()))
50
+ list(hist.program[IndexQuery([0, 1, 2])])
@@ -24,9 +24,9 @@ from torchrl.data import tensor_specs as tspecs
24
24
 
25
25
  from aioway.cc import ClfLogitHead, linear_regression
26
26
  from aioway.contrib.mnist import MnistDataset
27
+ from aioway.em import StaticTrainer, TrainCfg
27
28
  from aioway.io import DatasetIdxDset, Dset, InputTarget
28
29
  from aioway.t import as_tspec
29
- from aioway.tasks import StaticTrainer, TrainCfg
30
30
 
31
31
 
32
32
  # %%
@@ -5,7 +5,7 @@
5
5
  # extension: .py
6
6
  # format_name: percent
7
7
  # format_version: '1.3'
8
- # jupytext_version: 1.19.3
8
+ # jupytext_version: 1.19.5
9
9
  # kernelspec:
10
10
  # display_name: Python 3 (ipykernel)
11
11
  # language: python
@@ -21,7 +21,7 @@ class FuncOrClass(typing.Protocol):
21
21
 
22
22
 
23
23
  @typing.runtime_checkable
24
- class AiowayApi[**P = ..., T = typing.Any](FuncOrClass, typing.Protocol):
24
+ class AiowayApi[**P = ..., T: object = typing.Any](FuncOrClass, typing.Protocol):
25
25
  "The aioway marker."
26
26
 
27
27
  __aioway_internal_ref__: FuncOrClass
@@ -1,5 +1,6 @@
1
1
  # Copyright (c) AIoWay Authors - All Rights Reserved
2
2
 
3
+ import dataclasses as dcls
3
4
  import typing
4
5
  from collections import abc as cabc
5
6
 
@@ -31,7 +32,7 @@ def any_set(base, /, *default) -> AnySet: ...
31
32
 
32
33
 
33
34
  def any_set(base=object, /, *default) -> AnySet:
34
- aset = AnySet(base, {})
35
+ aset = AnySet(base=base, keys={})
35
36
 
36
37
  # Add all the default values.
37
38
  for key in default:
@@ -63,7 +64,7 @@ def any_dict(base, /, *default) -> AnyDict: ...
63
64
  def any_dict[K = typing.Any, V = typing.Any](
64
65
  base: type | tuple[type, ...] = object, /, *default: tuple[K, V]
65
66
  ):
66
- adict = AnyDict(base, {}, {})
67
+ adict = AnyDict(base=base, keys={}, vals={})
67
68
 
68
69
  # Add all default values.
69
70
  for key, val in default:
@@ -75,12 +76,12 @@ def any_dict[K = typing.Any, V = typing.Any](
75
76
  # Class definitions, private. Exposed to `__all__` for type hints. ====
76
77
 
77
78
 
78
- class AnySet[K = typing.Any]:
79
+ class AnySet[K: object = typing.Any]:
79
80
  """
80
81
  `AnySet` allows to store a set of items, using their `id` or `hash` to compare equality.
81
82
  """
82
83
 
83
- def __init__(self, base: type | tuple[type, ...], keys: dict[AnyId, K]) -> None:
84
+ def __init__(self, *, base: type | tuple[type, ...], keys: dict[AnyId, K]) -> None:
84
85
  self._keys: dict[AnyId, K] = keys
85
86
  """
86
87
  The keys that has been stored in the `AnyDict`.
@@ -103,7 +104,7 @@ class AnySet[K = typing.Any]:
103
104
 
104
105
  def __contains__(self, key: object, /) -> bool:
105
106
  if isinstance(key, self._type):
106
- key_id = _hash_or_id(key)
107
+ key_id = _HASH(key)
107
108
  return key_id in self._keys
108
109
 
109
110
  raise TypeError(f"{type(key)=} is not `{self._type}`.")
@@ -116,35 +117,46 @@ class AnySet[K = typing.Any]:
116
117
  copied -= other
117
118
  return copied
118
119
 
120
+ def __and__(self, other: AnySet[K]) -> AnySet[K]:
121
+ result = any_set(self._type)
122
+ for item in self:
123
+ if item in other:
124
+ result.add(item)
125
+ return result
126
+
119
127
  def __isub__(self, other: AnySet[K]) -> AnySet[K]:
120
128
  for item in other:
121
129
  self.discard(item)
122
130
  return self
123
131
 
124
132
  def isdisjoint(self, other: cabc.Iterable[K]) -> bool:
125
- return all(_hash_or_id(item) not in self._keys for item in other)
133
+ return self._keys.keys().isdisjoint(_HASH(item) for item in other)
126
134
 
127
135
  def add(self, key: K) -> None:
128
- self._keys[_hash_or_id(key)] = key
136
+ self._keys[_HASH(key)] = key
129
137
 
130
138
  def discard(self, key: K) -> None:
131
- if (key_hash := _hash_or_id(key)) in self._keys:
139
+ if (key_hash := _HASH(key)) in self._keys:
132
140
  del self._keys[key_hash]
133
141
 
134
142
  def copy(self) -> typing.Self:
135
- return type(self)(self._type, self._keys.copy())
143
+ return type(self)(base=self._type, keys=self._keys.copy())
136
144
 
137
145
 
138
- class AnyDict[K = typing.Any, V = typing.Any](AnySet[K]):
146
+ class AnyDict[K: object = typing.Any, V: object = typing.Any](AnySet[K]):
139
147
  """
140
148
  `AnyDict` allows you to treat `T` as if it's `Hashable` (it's not).
141
149
  Each item would be compared with `is` rather than `==`.
142
150
  """
143
151
 
144
152
  def __init__(
145
- self, base: type | tuple[type, ...], keys: dict[AnyId, K], vals: dict[AnyId, V]
153
+ self,
154
+ *,
155
+ base: type | tuple[type, ...],
156
+ keys: dict[AnyId, K],
157
+ vals: dict[AnyId, V],
146
158
  ) -> None:
147
- super().__init__(base, keys)
159
+ super().__init__(base=base, keys=keys)
148
160
 
149
161
  self._vals: dict[AnyId, V] = vals
150
162
  """
@@ -158,13 +170,13 @@ class AnyDict[K = typing.Any, V = typing.Any](AnySet[K]):
158
170
  if key not in self:
159
171
  raise KeyError(f"{key=} is not found in `AnyDict`.")
160
172
 
161
- return self._vals[_hash_or_id(key)]
173
+ return self._vals[_HASH(key)]
162
174
 
163
175
  def __setitem__(self, key: K, val: V, /) -> None:
164
176
  self.__assert_same_length()
165
177
 
166
178
  super().add(key)
167
- self._vals[_hash_or_id(key)] = val
179
+ self._vals[_HASH(key)] = val
168
180
 
169
181
  def __delitem__(self, key: K, /) -> None:
170
182
  self.__assert_same_length()
@@ -173,7 +185,7 @@ class AnyDict[K = typing.Any, V = typing.Any](AnySet[K]):
173
185
  raise KeyError(f"{key=} is not in `AnyDict`.")
174
186
 
175
187
  super().discard(key)
176
- del self._vals[_hash_or_id(key)]
188
+ del self._vals[_HASH(key)]
177
189
 
178
190
  def __or__(self, other: typing.Self) -> typing.Self:
179
191
  copied = self.copy()
@@ -186,7 +198,7 @@ class AnyDict[K = typing.Any, V = typing.Any](AnySet[K]):
186
198
  return self
187
199
 
188
200
  def keys(self) -> AnySet[K]:
189
- return AnySet(self._type, self._keys.copy())
201
+ return AnySet(base=self._type, keys=self._keys.copy())
190
202
 
191
203
  def values(self) -> cabc.Iterable[V]:
192
204
  for key in self.keys():
@@ -209,7 +221,9 @@ class AnyDict[K = typing.Any, V = typing.Any](AnySet[K]):
209
221
  return default
210
222
 
211
223
  def copy(self) -> typing.Self:
212
- return type(self)(self._type, self._keys.copy(), self._vals.copy())
224
+ return type(self)(
225
+ base=self._type, keys=self._keys.copy(), vals=self._vals.copy()
226
+ )
213
227
 
214
228
  def __assert_same_length(self) -> None:
215
229
  assert super().__len__() == len(self._vals)
@@ -218,10 +232,34 @@ class AnyDict[K = typing.Any, V = typing.Any](AnySet[K]):
218
232
  add = discard = typing.cast(typing.Any, None)
219
233
 
220
234
 
221
- def _hash_or_id(obj) -> AnyId:
222
- "Get the hash or id values."
235
+ # Helper hashing function. ====
236
+
237
+
238
+ @dcls.dataclass
239
+ class HashId:
240
+ """
241
+ The hasher that uses `id` for non hashable types.
242
+ """
243
+
244
+ no_hash: set[type] = dcls.field(default_factory=set)
245
+ """
246
+ The types that we don't want to hash.
247
+ """
248
+
249
+ def __call__(self, obj) -> AnyId:
250
+ if (type_obj := type(obj)) in self.no_hash:
251
+ return id(obj)
252
+
253
+ try:
254
+ return hash(obj)
255
+
256
+ # Tried hash, but it's not hashable.
257
+ except TypeError:
258
+ self.no_hash.add(type_obj)
259
+ return id(obj)
260
+
223
261
 
224
- try:
225
- return hash(obj)
226
- except TypeError:
227
- return id(obj)
262
+ _HASH = HashId()
263
+ """
264
+ The global hasher for both hashable and non hashable objects.
265
+ """
@@ -5,7 +5,7 @@ import dataclasses as dcls
5
5
  import typing
6
6
  from collections import abc as cabc
7
7
 
8
- __all__ = ["track_call_count", "Stack"]
8
+ __all__ = ["track_call_count", "Stack", "find_common_base"]
9
9
 
10
10
 
11
11
  class _CallCounter[**P, T]:
@@ -153,3 +153,26 @@ class Stack[T]:
153
153
  yield item
154
154
  finally:
155
155
  self.append(item)
156
+
157
+
158
+ def find_common_base(iterable: cabc.Iterable) -> type | None:
159
+ """
160
+ Find the common base type.
161
+
162
+ Returns:
163
+ The common type if found. If sequence is empty return `None`.
164
+
165
+ Raises:
166
+ ValueError: If the input iterable is empty.
167
+ """
168
+
169
+ if not iterable:
170
+ return None
171
+
172
+ first, *rest = [type(e) for e in iterable]
173
+
174
+ for typ in first.mro():
175
+ if all(issubclass(other, typ) for other in rest):
176
+ return typ
177
+
178
+ raise RuntimeError("Unrachable code, since all objects have base type `object`.")
@@ -20,6 +20,7 @@ __all__ = [
20
20
  "is_list_of",
21
21
  "is_tuple_of",
22
22
  "is_seq_of",
23
+ "is_set_of",
23
24
  "is_any_type_hint",
24
25
  "is_dict_of_str_to",
25
26
  "is_nn_type",
@@ -46,12 +47,7 @@ def is_any_type_hint(typ) -> bool:
46
47
 
47
48
 
48
49
  @typing.no_type_check
49
- def _seq_check[T](seq: type, typ: type[T]):
50
- if not issubclass(seq, cabc.Sequence):
51
- raise TypeError(
52
- f"The given seq: `{seq}` should be subclass of `cabc.Sequence`."
53
- )
54
-
50
+ def _iter_check[T](seq: type, typ: type[T]):
55
51
  if not isinstance(typ, type):
56
52
  raise TypeError(f"The given typ: `{typ}` should be a type.")
57
53
 
@@ -84,20 +80,26 @@ def _mapping_check[K, V](mapping: type, key: type[K], val: type[V]):
84
80
 
85
81
  def is_seq_of[T](
86
82
  typ: type[T], /
87
- ) -> cabc.Callable[[typing.Any], typing.TypeGuard[cabc.Sequence[T]]]:
88
- return _seq_check(cabc.Sequence, typ)
83
+ ) -> cabc.Callable[[typing.Any], typing.TypeIs[cabc.Sequence[T]]]:
84
+ return _iter_check(cabc.Sequence, typ)
89
85
 
90
86
 
91
87
  def is_list_of[T](
92
88
  typ: type[T], /
93
- ) -> cabc.Callable[[typing.Any], typing.TypeGuard[list[T]]]:
94
- return _seq_check(list, typ)
89
+ ) -> cabc.Callable[[typing.Any], typing.TypeIs[list[T]]]:
90
+ return _iter_check(list, typ)
95
91
 
96
92
 
97
93
  def is_tuple_of[T](
98
94
  typ: type[T], /
99
- ) -> cabc.Callable[[typing.Any], typing.TypeGuard[tuple[T, ...]]]:
100
- return _seq_check(tuple, typ)
95
+ ) -> cabc.Callable[[typing.Any], typing.TypeIs[tuple[T, ...]]]:
96
+ return _iter_check(tuple, typ)
97
+
98
+
99
+ def is_set_of[T](
100
+ typ: type[T], /
101
+ ) -> cabc.Callable[[typing.Any], typing.TypeGuard[cabc.Set[T]]]:
102
+ return _iter_check(cabc.Set, typ)
101
103
 
102
104
 
103
105
  def is_dict_of_str_to[T](
@@ -7,9 +7,9 @@ from torch import nn, optim
7
7
 
8
8
  from aioway.cc import emit, route_loss
9
9
  from aioway.contrib.dsets import route_dset
10
+ from aioway.em import StaticTrainer, TrainCfg
10
11
  from aioway.io import Dset
11
12
  from aioway.t import TSpec, as_tspec
12
- from aioway.tasks import StaticTrainer, TrainCfg
13
13
 
14
14
  from .server import serve
15
15
 
@@ -1,10 +1,9 @@
1
1
  # Copyright (c) AIoWay Authors - All Rights Reserved
2
2
 
3
3
  from .args import *
4
- from .deductions import *
5
4
  from .emits import *
6
5
  from .hashes import *
7
- from .ir import *
8
6
  from .rebuild import *
9
7
  from .regs import *
10
8
  from .rewrites import *
9
+ from .signs import *
@@ -0,0 +1,42 @@
1
+ # Copyright (c) AIoWay Authors - All Rights Reserved
2
+
3
+ "A unified registry for `type[nn.Module]` storing `aioway` operations."
4
+
5
+ import dataclasses as dcls
6
+
7
+ from torch import nn
8
+
9
+ from aioway._utils import Sign, is_nn_type
10
+
11
+ from .signs import sign_reg
12
+
13
+
14
+ @dcls.dataclass
15
+ class NnOp:
16
+ """
17
+ The dataclass that stores all the operations associated `type[nn.Module]`.
18
+
19
+ This is a shared location s.t. we can store all needed operations together,
20
+ without having to import multiple functions to access multiple utilities.
21
+ """
22
+
23
+ sign: Sign | None = None
24
+ "The signature of `nn.Module` using `.forward`."
25
+
26
+ def __bool__(self) -> bool:
27
+ """
28
+ Check if `NnOp` has any attribute defined.
29
+ """
30
+
31
+ return any(val for val in dcls.asdict(self).values())
32
+
33
+
34
+ def nn_op(module: type[nn.Module]) -> NnOp:
35
+ """
36
+ Get all the operations associated with a specific type.
37
+ """
38
+
39
+ if not is_nn_type(module):
40
+ raise TypeError(type(module))
41
+
42
+ return NnOp(sign=sign_reg()[module])