beantensor 1.0.0rc1__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 (498) hide show
  1. beantensor-1.0.0rc1/.github/ISSUE_TEMPLATE/agent_bug_report.md +64 -0
  2. beantensor-1.0.0rc1/.github/ISSUE_TEMPLATE/bug_report.md +33 -0
  3. beantensor-1.0.0rc1/.github/ISSUE_TEMPLATE/config.yml +5 -0
  4. beantensor-1.0.0rc1/.github/ISSUE_TEMPLATE/feature_request.md +38 -0
  5. beantensor-1.0.0rc1/.github/ISSUE_TEMPLATE/feedback.md +41 -0
  6. beantensor-1.0.0rc1/.github/PULL_REQUEST_TEMPLATE.md +76 -0
  7. beantensor-1.0.0rc1/.github/workflows/ci.yml +46 -0
  8. beantensor-1.0.0rc1/.github/workflows/docs.yml +48 -0
  9. beantensor-1.0.0rc1/.gitignore +22 -0
  10. beantensor-1.0.0rc1/BeanTensor.h +80 -0
  11. beantensor-1.0.0rc1/Bindings/CMakeLists.txt +59 -0
  12. beantensor-1.0.0rc1/Bindings/pybind_module.cpp +981 -0
  13. beantensor-1.0.0rc1/CMakeLists.txt +2010 -0
  14. beantensor-1.0.0rc1/CODE_OF_CONDUCT.md +22 -0
  15. beantensor-1.0.0rc1/CONTRIBUTING.md +83 -0
  16. beantensor-1.0.0rc1/CUDA_GLIBC_PATCH.md +57 -0
  17. beantensor-1.0.0rc1/Data/Csv.cpp +444 -0
  18. beantensor-1.0.0rc1/Data/Csv.h +188 -0
  19. beantensor-1.0.0rc1/Data/DataLoader.cpp +145 -0
  20. beantensor-1.0.0rc1/Data/DataLoader.h +128 -0
  21. beantensor-1.0.0rc1/Doxyfile +75 -0
  22. beantensor-1.0.0rc1/Helpers/Alloc.h +57 -0
  23. beantensor-1.0.0rc1/Helpers/Bits.h +11 -0
  24. beantensor-1.0.0rc1/Helpers/CPUThreading.h +856 -0
  25. beantensor-1.0.0rc1/Helpers/Dashboard/Dashboard.cpp +435 -0
  26. beantensor-1.0.0rc1/Helpers/Dashboard/Dashboard.h +177 -0
  27. beantensor-1.0.0rc1/Helpers/Errors.h +526 -0
  28. beantensor-1.0.0rc1/Helpers/Hardware.h +613 -0
  29. beantensor-1.0.0rc1/Helpers/KernelTune.cpp +609 -0
  30. beantensor-1.0.0rc1/Helpers/KernelTune.h +110 -0
  31. beantensor-1.0.0rc1/Helpers/OOMPolicy.cpp +184 -0
  32. beantensor-1.0.0rc1/Helpers/OOMPolicy.h +182 -0
  33. beantensor-1.0.0rc1/Helpers/PoolMonitor.h +230 -0
  34. beantensor-1.0.0rc1/Intrinsics/AVX2/DTypeConversions.cpp +1086 -0
  35. beantensor-1.0.0rc1/Intrinsics/AVX2/DTypeConversions.h +31 -0
  36. beantensor-1.0.0rc1/Intrinsics/AVX512/DTypeConversions.cpp +1465 -0
  37. beantensor-1.0.0rc1/Intrinsics/AVX512/DTypeConversions.h +34 -0
  38. beantensor-1.0.0rc1/Intrinsics/Compat/DeviceStd.h +27 -0
  39. beantensor-1.0.0rc1/Intrinsics/Compat/MsvcIsaDefs.h +170 -0
  40. beantensor-1.0.0rc1/Intrinsics/ConversionMethods.h +26 -0
  41. beantensor-1.0.0rc1/Intrinsics/DispatchFeatures.cpp +24 -0
  42. beantensor-1.0.0rc1/Intrinsics/Dispatcher.cpp +179 -0
  43. beantensor-1.0.0rc1/Intrinsics/Dispatcher.h +410 -0
  44. beantensor-1.0.0rc1/Intrinsics/Native/DTypeConversions.h +258 -0
  45. beantensor-1.0.0rc1/Intrinsics/Shared/SharedIntrinsics.h +75 -0
  46. beantensor-1.0.0rc1/LICENSE +21 -0
  47. beantensor-1.0.0rc1/Math/Activations/Activations.h +13 -0
  48. beantensor-1.0.0rc1/Math/Activations/ActivationsCudaShared.h +98 -0
  49. beantensor-1.0.0rc1/Math/Activations/ActivationsHipShared.h +97 -0
  50. beantensor-1.0.0rc1/Math/Activations/ActivationsShared.h +179 -0
  51. beantensor-1.0.0rc1/Math/Activations/Gelu/Gelu.h +25 -0
  52. beantensor-1.0.0rc1/Math/Activations/Gelu/Gelu.hpp +27 -0
  53. beantensor-1.0.0rc1/Math/Activations/Gelu/GeluAVX2.cpp +59 -0
  54. beantensor-1.0.0rc1/Math/Activations/Gelu/GeluAVX2F64.cpp +42 -0
  55. beantensor-1.0.0rc1/Math/Activations/Gelu/GeluAVX512.cpp +63 -0
  56. beantensor-1.0.0rc1/Math/Activations/Gelu/GeluAVX512F64.cpp +47 -0
  57. beantensor-1.0.0rc1/Math/Activations/Gelu/GeluCPU.cpp +213 -0
  58. beantensor-1.0.0rc1/Math/Activations/Gelu/GeluCUDA.cu +126 -0
  59. beantensor-1.0.0rc1/Math/Activations/Gelu/GeluHIP.cpp +125 -0
  60. beantensor-1.0.0rc1/Math/Activations/Gelu/GeluKernels.h +269 -0
  61. beantensor-1.0.0rc1/Math/Activations/Relu/Relu.h +25 -0
  62. beantensor-1.0.0rc1/Math/Activations/Relu/Relu.hpp +27 -0
  63. beantensor-1.0.0rc1/Math/Activations/Relu/ReluAVX2.cpp +64 -0
  64. beantensor-1.0.0rc1/Math/Activations/Relu/ReluAVX512.cpp +65 -0
  65. beantensor-1.0.0rc1/Math/Activations/Relu/ReluCPU.cpp +357 -0
  66. beantensor-1.0.0rc1/Math/Activations/Relu/ReluCUDA.cu +139 -0
  67. beantensor-1.0.0rc1/Math/Activations/Relu/ReluHIP.cpp +138 -0
  68. beantensor-1.0.0rc1/Math/Activations/Relu/ReluKernels.h +53 -0
  69. beantensor-1.0.0rc1/Math/Activations/Softmax/Softmax.h +25 -0
  70. beantensor-1.0.0rc1/Math/Activations/Softmax/Softmax.hpp +26 -0
  71. beantensor-1.0.0rc1/Math/Activations/Softmax/SoftmaxAVX2.cpp +64 -0
  72. beantensor-1.0.0rc1/Math/Activations/Softmax/SoftmaxAVX512.cpp +62 -0
  73. beantensor-1.0.0rc1/Math/Activations/Softmax/SoftmaxCPU.cpp +192 -0
  74. beantensor-1.0.0rc1/Math/Activations/Softmax/SoftmaxCUDA.cu +164 -0
  75. beantensor-1.0.0rc1/Math/Activations/Softmax/SoftmaxCudaShared.h +150 -0
  76. beantensor-1.0.0rc1/Math/Activations/Softmax/SoftmaxHIP.cpp +147 -0
  77. beantensor-1.0.0rc1/Math/Activations/Softmax/SoftmaxHipShared.h +123 -0
  78. beantensor-1.0.0rc1/Math/Activations/Softmax/SoftmaxKernels.h +51 -0
  79. beantensor-1.0.0rc1/Math/Activations/Softmax/SoftmaxShared.h +244 -0
  80. beantensor-1.0.0rc1/Math/Activations/SoftmaxCE/SoftmaxCE.h +25 -0
  81. beantensor-1.0.0rc1/Math/Activations/SoftmaxCE/SoftmaxCE.hpp +27 -0
  82. beantensor-1.0.0rc1/Math/Activations/SoftmaxCE/SoftmaxCECPU.cpp +489 -0
  83. beantensor-1.0.0rc1/Math/Activations/SoftmaxCE/SoftmaxCECUDA.cu +381 -0
  84. beantensor-1.0.0rc1/Math/Activations/SoftmaxCE/SoftmaxCEHIP.cpp +380 -0
  85. beantensor-1.0.0rc1/Math/Autograd/Autograd.h +31 -0
  86. beantensor-1.0.0rc1/Math/Autograd/AutogradCudaShared.h +97 -0
  87. beantensor-1.0.0rc1/Math/Autograd/AutogradHipShared.h +96 -0
  88. beantensor-1.0.0rc1/Math/Autograd/AutogradShared.h +220 -0
  89. beantensor-1.0.0rc1/Math/Autograd/AvgPool2dG/AvgPool2dG.h +30 -0
  90. beantensor-1.0.0rc1/Math/Autograd/AvgPool2dG/AvgPool2dGCPU.cpp +76 -0
  91. beantensor-1.0.0rc1/Math/Autograd/Backward.cpp +378 -0
  92. beantensor-1.0.0rc1/Math/Autograd/BatchNormG/BatchNormG.h +91 -0
  93. beantensor-1.0.0rc1/Math/Autograd/BatchNormG/BatchNormGCPU.cpp +553 -0
  94. beantensor-1.0.0rc1/Math/Autograd/BatchNormG/BatchNormGCUDA.cu +492 -0
  95. beantensor-1.0.0rc1/Math/Autograd/BatchNormG/BatchNormGHIP.cpp +493 -0
  96. beantensor-1.0.0rc1/Math/Autograd/BatchNormG/BatchNormGShared.h +86 -0
  97. beantensor-1.0.0rc1/Math/Autograd/BiasAddG/BiasAddG.h +35 -0
  98. beantensor-1.0.0rc1/Math/Autograd/BiasAddG/BiasAddG.hpp +25 -0
  99. beantensor-1.0.0rc1/Math/Autograd/BiasAddG/BiasAddGAVX2.cpp +70 -0
  100. beantensor-1.0.0rc1/Math/Autograd/BiasAddG/BiasAddGAVX512.cpp +71 -0
  101. beantensor-1.0.0rc1/Math/Autograd/BiasAddG/BiasAddGCPU.cpp +482 -0
  102. beantensor-1.0.0rc1/Math/Autograd/BiasAddG/BiasAddGCUDA.cu +240 -0
  103. beantensor-1.0.0rc1/Math/Autograd/BiasAddG/BiasAddGHIP.cpp +239 -0
  104. beantensor-1.0.0rc1/Math/Autograd/BiasAddG/BiasAddGKernels.h +21 -0
  105. beantensor-1.0.0rc1/Math/Autograd/ElementwiseG/ElementwiseG.h +142 -0
  106. beantensor-1.0.0rc1/Math/Autograd/ElementwiseG/ElementwiseG.hpp +24 -0
  107. beantensor-1.0.0rc1/Math/Autograd/ElementwiseG/ElementwiseGCPU.cpp +728 -0
  108. beantensor-1.0.0rc1/Math/Autograd/ElementwiseG/ElementwiseGCUDA.cu +249 -0
  109. beantensor-1.0.0rc1/Math/Autograd/ElementwiseG/ElementwiseGHIP.cpp +248 -0
  110. beantensor-1.0.0rc1/Math/Autograd/ElementwiseG/ElementwiseGShared.h +108 -0
  111. beantensor-1.0.0rc1/Math/Autograd/FlattenG/FlattenG.cpp +52 -0
  112. beantensor-1.0.0rc1/Math/Autograd/FlattenG/FlattenG.h +29 -0
  113. beantensor-1.0.0rc1/Math/Autograd/GeluG/GeluG.h +34 -0
  114. beantensor-1.0.0rc1/Math/Autograd/GeluG/GeluG.hpp +25 -0
  115. beantensor-1.0.0rc1/Math/Autograd/GeluG/GeluGAVX2.cpp +59 -0
  116. beantensor-1.0.0rc1/Math/Autograd/GeluG/GeluGAVX2F64.cpp +44 -0
  117. beantensor-1.0.0rc1/Math/Autograd/GeluG/GeluGAVX512.cpp +63 -0
  118. beantensor-1.0.0rc1/Math/Autograd/GeluG/GeluGAVX512F64.cpp +49 -0
  119. beantensor-1.0.0rc1/Math/Autograd/GeluG/GeluGCPU.cpp +250 -0
  120. beantensor-1.0.0rc1/Math/Autograd/GeluG/GeluGCUDA.cu +133 -0
  121. beantensor-1.0.0rc1/Math/Autograd/GeluG/GeluGHIP.cpp +132 -0
  122. beantensor-1.0.0rc1/Math/Autograd/GeluG/GeluGKernels.h +53 -0
  123. beantensor-1.0.0rc1/Math/Autograd/GemmG/GemmG.h +25 -0
  124. beantensor-1.0.0rc1/Math/Autograd/GemmG/GemmGCPU.cpp +90 -0
  125. beantensor-1.0.0rc1/Math/Autograd/GradAcc/GradAcc.h +26 -0
  126. beantensor-1.0.0rc1/Math/Autograd/GradAcc/GradAcc.hpp +25 -0
  127. beantensor-1.0.0rc1/Math/Autograd/GradAcc/GradAccAVX2.cpp +65 -0
  128. beantensor-1.0.0rc1/Math/Autograd/GradAcc/GradAccAVX512.cpp +66 -0
  129. beantensor-1.0.0rc1/Math/Autograd/GradAcc/GradAccCPU.cpp +406 -0
  130. beantensor-1.0.0rc1/Math/Autograd/GradAcc/GradAccCUDA.cu +147 -0
  131. beantensor-1.0.0rc1/Math/Autograd/GradAcc/GradAccHIP.cpp +146 -0
  132. beantensor-1.0.0rc1/Math/Autograd/GradAcc/GradAccKernels.h +23 -0
  133. beantensor-1.0.0rc1/Math/Autograd/GradDType.h +120 -0
  134. beantensor-1.0.0rc1/Math/Autograd/IndexingG/IndexingG.h +93 -0
  135. beantensor-1.0.0rc1/Math/Autograd/IndexingG/IndexingG.hpp +47 -0
  136. beantensor-1.0.0rc1/Math/Autograd/IndexingG/IndexingGCPU.cpp +536 -0
  137. beantensor-1.0.0rc1/Math/Autograd/IndexingG/IndexingGCUDA.cu +482 -0
  138. beantensor-1.0.0rc1/Math/Autograd/IndexingG/IndexingGHIP.cpp +482 -0
  139. beantensor-1.0.0rc1/Math/Autograd/IndexingG/IndexingGShared.h +75 -0
  140. beantensor-1.0.0rc1/Math/Autograd/MeanG/MeanG.h +29 -0
  141. beantensor-1.0.0rc1/Math/Autograd/MeanG/MeanGCPU.cpp +62 -0
  142. beantensor-1.0.0rc1/Math/Autograd/ReluG/ReluG.h +37 -0
  143. beantensor-1.0.0rc1/Math/Autograd/ReluG/ReluG.hpp +25 -0
  144. beantensor-1.0.0rc1/Math/Autograd/ReluG/ReluGAVX2.cpp +72 -0
  145. beantensor-1.0.0rc1/Math/Autograd/ReluG/ReluGAVX512.cpp +75 -0
  146. beantensor-1.0.0rc1/Math/Autograd/ReluG/ReluGCPU.cpp +481 -0
  147. beantensor-1.0.0rc1/Math/Autograd/ReluG/ReluGCUDA.cu +148 -0
  148. beantensor-1.0.0rc1/Math/Autograd/ReluG/ReluGHIP.cpp +147 -0
  149. beantensor-1.0.0rc1/Math/Autograd/ReluG/ReluGKernels.h +23 -0
  150. beantensor-1.0.0rc1/Math/Autograd/SigmoidG/SigmoidG.h +24 -0
  151. beantensor-1.0.0rc1/Math/Autograd/SigmoidG/SigmoidGCPU.cpp +50 -0
  152. beantensor-1.0.0rc1/Math/Autograd/SoftmaxCEG/SoftmaxCEG.h +42 -0
  153. beantensor-1.0.0rc1/Math/Autograd/SoftmaxCEG/SoftmaxCEG.hpp +25 -0
  154. beantensor-1.0.0rc1/Math/Autograd/SoftmaxCEG/SoftmaxCEGCPU.cpp +533 -0
  155. beantensor-1.0.0rc1/Math/Autograd/SoftmaxCEG/SoftmaxCEGCUDA.cu +501 -0
  156. beantensor-1.0.0rc1/Math/Autograd/SoftmaxCEG/SoftmaxCEGHIP.cpp +500 -0
  157. beantensor-1.0.0rc1/Math/Autograd/SoftmaxG/SoftmaxG.h +42 -0
  158. beantensor-1.0.0rc1/Math/Autograd/SoftmaxG/SoftmaxG.hpp +26 -0
  159. beantensor-1.0.0rc1/Math/Autograd/SoftmaxG/SoftmaxGCPU.cpp +258 -0
  160. beantensor-1.0.0rc1/Math/Autograd/SoftmaxG/SoftmaxGCUDA.cu +176 -0
  161. beantensor-1.0.0rc1/Math/Autograd/SoftmaxG/SoftmaxGHIP.cpp +176 -0
  162. beantensor-1.0.0rc1/Math/Autograd/SumG/SumG.h +29 -0
  163. beantensor-1.0.0rc1/Math/Autograd/SumG/SumGCPU.cpp +60 -0
  164. beantensor-1.0.0rc1/Math/Autograd/TanhG/TanhG.h +24 -0
  165. beantensor-1.0.0rc1/Math/Autograd/TanhG/TanhGCPU.cpp +50 -0
  166. beantensor-1.0.0rc1/Math/Autograd/TransposeLast2/TransposeLast2.h +26 -0
  167. beantensor-1.0.0rc1/Math/Autograd/TransposeLast2/TransposeLast2.hpp +25 -0
  168. beantensor-1.0.0rc1/Math/Autograd/TransposeLast2/TransposeLast2CPU.cpp +117 -0
  169. beantensor-1.0.0rc1/Math/Autograd/TransposeLast2/TransposeLast2CUDA.cu +116 -0
  170. beantensor-1.0.0rc1/Math/Autograd/TransposeLast2/TransposeLast2HIP.cpp +116 -0
  171. beantensor-1.0.0rc1/Math/Compare/Compare.h +10 -0
  172. beantensor-1.0.0rc1/Math/Compare/CompareCudaShared.h +34 -0
  173. beantensor-1.0.0rc1/Math/Compare/CompareHipShared.h +34 -0
  174. beantensor-1.0.0rc1/Math/Compare/CompareShared.h +132 -0
  175. beantensor-1.0.0rc1/Math/Compare/Equal/Equal.h +25 -0
  176. beantensor-1.0.0rc1/Math/Compare/Equal/Equal.hpp +26 -0
  177. beantensor-1.0.0rc1/Math/Compare/Equal/EqualCPU.cpp +245 -0
  178. beantensor-1.0.0rc1/Math/Compare/Equal/EqualCUDA.cu +147 -0
  179. beantensor-1.0.0rc1/Math/Compare/Equal/EqualHIP.cpp +145 -0
  180. beantensor-1.0.0rc1/Math/Convolution/Col2Im/Op.h +10 -0
  181. beantensor-1.0.0rc1/Math/Convolution/Col2Im/OpCPU.cpp +25 -0
  182. beantensor-1.0.0rc1/Math/Convolution/Col2Im/OpCUDA.cu +39 -0
  183. beantensor-1.0.0rc1/Math/Convolution/Col2Im/OpHIP.cpp +39 -0
  184. beantensor-1.0.0rc1/Math/Convolution/Conv2d/Op.h +10 -0
  185. beantensor-1.0.0rc1/Math/Convolution/Conv2d/OpCPU.cpp +43 -0
  186. beantensor-1.0.0rc1/Math/Convolution/Conv2d/OpCUDA.cu +118 -0
  187. beantensor-1.0.0rc1/Math/Convolution/Conv2d/OpHIP.cpp +118 -0
  188. beantensor-1.0.0rc1/Math/Convolution/Conv2dG.h +25 -0
  189. beantensor-1.0.0rc1/Math/Convolution/Conv2dGCPU.cpp +198 -0
  190. beantensor-1.0.0rc1/Math/Convolution/Conv2dGCUDA.cu +131 -0
  191. beantensor-1.0.0rc1/Math/Convolution/Conv2dGHIP.cpp +131 -0
  192. beantensor-1.0.0rc1/Math/Convolution/Convolution.cpp +133 -0
  193. beantensor-1.0.0rc1/Math/Convolution/Convolution.h +147 -0
  194. beantensor-1.0.0rc1/Math/Convolution/ConvolutionCudaShared.h +250 -0
  195. beantensor-1.0.0rc1/Math/Convolution/ConvolutionHipShared.h +242 -0
  196. beantensor-1.0.0rc1/Math/Convolution/ConvolutionShared.h +519 -0
  197. beantensor-1.0.0rc1/Math/Convolution/Im2Col/Op.h +10 -0
  198. beantensor-1.0.0rc1/Math/Convolution/Im2Col/OpCPU.cpp +50 -0
  199. beantensor-1.0.0rc1/Math/Convolution/Im2Col/OpCUDA.cu +41 -0
  200. beantensor-1.0.0rc1/Math/Convolution/Im2Col/OpHIP.cpp +41 -0
  201. beantensor-1.0.0rc1/Math/Dropout/Dropout.h +61 -0
  202. beantensor-1.0.0rc1/Math/Dropout/DropoutCPU.cpp +152 -0
  203. beantensor-1.0.0rc1/Math/Dropout/DropoutCUDA.cu +96 -0
  204. beantensor-1.0.0rc1/Math/Dropout/DropoutCudaShared.h +100 -0
  205. beantensor-1.0.0rc1/Math/Dropout/DropoutHIP.cpp +96 -0
  206. beantensor-1.0.0rc1/Math/Dropout/DropoutHipShared.h +97 -0
  207. beantensor-1.0.0rc1/Math/Dropout/DropoutKernels.h +14 -0
  208. beantensor-1.0.0rc1/Math/Dropout/DropoutShared.h +78 -0
  209. beantensor-1.0.0rc1/Math/Elementwise/Elementwise.h +91 -0
  210. beantensor-1.0.0rc1/Math/Elementwise/Elementwise.hpp +41 -0
  211. beantensor-1.0.0rc1/Math/Elementwise/ElementwiseAVX2.cpp +1978 -0
  212. beantensor-1.0.0rc1/Math/Elementwise/ElementwiseAVX512.cpp +2035 -0
  213. beantensor-1.0.0rc1/Math/Elementwise/ElementwiseCPU.cpp +1544 -0
  214. beantensor-1.0.0rc1/Math/Elementwise/ElementwiseCUDA.cu +485 -0
  215. beantensor-1.0.0rc1/Math/Elementwise/ElementwiseCudaShared.h +540 -0
  216. beantensor-1.0.0rc1/Math/Elementwise/ElementwiseHIP.cpp +484 -0
  217. beantensor-1.0.0rc1/Math/Elementwise/ElementwiseHipShared.h +539 -0
  218. beantensor-1.0.0rc1/Math/Elementwise/ElementwiseKernels.h +1128 -0
  219. beantensor-1.0.0rc1/Math/Elementwise/ElementwiseShared.h +131 -0
  220. beantensor-1.0.0rc1/Math/LinearAlgebra/BiasAdd/BiasAdd.h +25 -0
  221. beantensor-1.0.0rc1/Math/LinearAlgebra/BiasAdd/BiasAdd.hpp +27 -0
  222. beantensor-1.0.0rc1/Math/LinearAlgebra/BiasAdd/BiasAddAVX2.cpp +79 -0
  223. beantensor-1.0.0rc1/Math/LinearAlgebra/BiasAdd/BiasAddAVX512.cpp +86 -0
  224. beantensor-1.0.0rc1/Math/LinearAlgebra/BiasAdd/BiasAddCPU.cpp +361 -0
  225. beantensor-1.0.0rc1/Math/LinearAlgebra/BiasAdd/BiasAddCUDA.cu +153 -0
  226. beantensor-1.0.0rc1/Math/LinearAlgebra/BiasAdd/BiasAddHIP.cpp +152 -0
  227. beantensor-1.0.0rc1/Math/LinearAlgebra/BiasAdd/BiasAddKernels.h +49 -0
  228. beantensor-1.0.0rc1/Math/LinearAlgebra/LinearAlgebra.h +11 -0
  229. beantensor-1.0.0rc1/Math/LinearAlgebra/LinearAlgebraCudaShared.h +97 -0
  230. beantensor-1.0.0rc1/Math/LinearAlgebra/LinearAlgebraHipShared.h +95 -0
  231. beantensor-1.0.0rc1/Math/LinearAlgebra/LinearAlgebraShared.h +179 -0
  232. beantensor-1.0.0rc1/Math/LinearAlgebra/MatMul/GemmAVX2.cpp +935 -0
  233. beantensor-1.0.0rc1/Math/LinearAlgebra/MatMul/GemmAVX512.cpp +1927 -0
  234. beantensor-1.0.0rc1/Math/LinearAlgebra/MatMul/GemmKernels.h +183 -0
  235. beantensor-1.0.0rc1/Math/LinearAlgebra/MatMul/Matmul.h +28 -0
  236. beantensor-1.0.0rc1/Math/LinearAlgebra/MatMul/Matmul.hpp +28 -0
  237. beantensor-1.0.0rc1/Math/LinearAlgebra/MatMul/MatmulCPU.cpp +616 -0
  238. beantensor-1.0.0rc1/Math/LinearAlgebra/MatMul/MatmulCUDA.cu +655 -0
  239. beantensor-1.0.0rc1/Math/LinearAlgebra/MatMul/MatmulHIP.cpp +658 -0
  240. beantensor-1.0.0rc1/Math/Loss/Bce/Bce.h +29 -0
  241. beantensor-1.0.0rc1/Math/Loss/Bce/Bce.hpp +26 -0
  242. beantensor-1.0.0rc1/Math/Loss/Bce/BceCPU.cpp +389 -0
  243. beantensor-1.0.0rc1/Math/Loss/Bce/BceCUDA.cu +253 -0
  244. beantensor-1.0.0rc1/Math/Loss/Bce/BceHIP.cpp +188 -0
  245. beantensor-1.0.0rc1/Math/Loss/BceG/BceG.h +39 -0
  246. beantensor-1.0.0rc1/Math/Loss/BceG/BceG.hpp +25 -0
  247. beantensor-1.0.0rc1/Math/Loss/BceG/BceGCPU.cpp +195 -0
  248. beantensor-1.0.0rc1/Math/Loss/BceG/BceGCUDA.cu +143 -0
  249. beantensor-1.0.0rc1/Math/Loss/BceG/BceGHIP.cpp +142 -0
  250. beantensor-1.0.0rc1/Math/Loss/BceWithLogits/BceWithLogits.h +29 -0
  251. beantensor-1.0.0rc1/Math/Loss/BceWithLogits/BceWithLogits.hpp +26 -0
  252. beantensor-1.0.0rc1/Math/Loss/BceWithLogits/BceWithLogitsCPU.cpp +363 -0
  253. beantensor-1.0.0rc1/Math/Loss/BceWithLogits/BceWithLogitsCUDA.cu +182 -0
  254. beantensor-1.0.0rc1/Math/Loss/BceWithLogits/BceWithLogitsHIP.cpp +179 -0
  255. beantensor-1.0.0rc1/Math/Loss/BceWithLogitsG/BceWithLogitsG.h +38 -0
  256. beantensor-1.0.0rc1/Math/Loss/BceWithLogitsG/BceWithLogitsG.hpp +25 -0
  257. beantensor-1.0.0rc1/Math/Loss/BceWithLogitsG/BceWithLogitsGCPU.cpp +182 -0
  258. beantensor-1.0.0rc1/Math/Loss/BceWithLogitsG/BceWithLogitsGCUDA.cu +134 -0
  259. beantensor-1.0.0rc1/Math/Loss/BceWithLogitsG/BceWithLogitsGHIP.cpp +133 -0
  260. beantensor-1.0.0rc1/Math/Loss/Loss.cpp +47 -0
  261. beantensor-1.0.0rc1/Math/Loss/Loss.h +35 -0
  262. beantensor-1.0.0rc1/Math/Loss/LossCudaShared.h +92 -0
  263. beantensor-1.0.0rc1/Math/Loss/LossHipShared.h +91 -0
  264. beantensor-1.0.0rc1/Math/Loss/LossShared.h +194 -0
  265. beantensor-1.0.0rc1/Math/Loss/Mse/Mse.h +28 -0
  266. beantensor-1.0.0rc1/Math/Loss/Mse/Mse.hpp +26 -0
  267. beantensor-1.0.0rc1/Math/Loss/Mse/MseCPU.cpp +325 -0
  268. beantensor-1.0.0rc1/Math/Loss/Mse/MseCUDA.cu +314 -0
  269. beantensor-1.0.0rc1/Math/Loss/Mse/MseHIP.cpp +313 -0
  270. beantensor-1.0.0rc1/Math/Loss/MseG/MseG.h +41 -0
  271. beantensor-1.0.0rc1/Math/Loss/MseG/MseG.hpp +26 -0
  272. beantensor-1.0.0rc1/Math/Loss/MseG/MseGCPU.cpp +335 -0
  273. beantensor-1.0.0rc1/Math/Loss/MseG/MseGCUDA.cu +255 -0
  274. beantensor-1.0.0rc1/Math/Loss/MseG/MseGHIP.cpp +254 -0
  275. beantensor-1.0.0rc1/Math/Normalization/BatchNorm/BatchNorm.h +34 -0
  276. beantensor-1.0.0rc1/Math/Normalization/BatchNorm/BatchNorm.hpp +27 -0
  277. beantensor-1.0.0rc1/Math/Normalization/BatchNorm/BatchNormCPU.cpp +427 -0
  278. beantensor-1.0.0rc1/Math/Normalization/BatchNorm/BatchNormCUDA.cu +411 -0
  279. beantensor-1.0.0rc1/Math/Normalization/BatchNorm/BatchNormHIP.cpp +412 -0
  280. beantensor-1.0.0rc1/Math/Normalization/BatchNorm/BatchNormShared.h +125 -0
  281. beantensor-1.0.0rc1/Math/Optimization/Adam/Adam.h +35 -0
  282. beantensor-1.0.0rc1/Math/Optimization/Adam/Adam.hpp +27 -0
  283. beantensor-1.0.0rc1/Math/Optimization/Adam/AdamCPU.cpp +616 -0
  284. beantensor-1.0.0rc1/Math/Optimization/Adam/AdamCUDA.cu +220 -0
  285. beantensor-1.0.0rc1/Math/Optimization/Adam/AdamHIP.cpp +219 -0
  286. beantensor-1.0.0rc1/Math/Optimization/GradScaler/GradScaler.cpp +346 -0
  287. beantensor-1.0.0rc1/Math/Optimization/GradScaler/GradScaler.h +207 -0
  288. beantensor-1.0.0rc1/Math/Optimization/GradScaler/GradScalerCUDA.cu +116 -0
  289. beantensor-1.0.0rc1/Math/Optimization/GradScaler/GradScalerHIP.cpp +115 -0
  290. beantensor-1.0.0rc1/Math/Optimization/Optimization.h +13 -0
  291. beantensor-1.0.0rc1/Math/Optimization/OptimizationCudaShared.h +92 -0
  292. beantensor-1.0.0rc1/Math/Optimization/OptimizationHipShared.h +91 -0
  293. beantensor-1.0.0rc1/Math/Optimization/OptimizationShared.h +195 -0
  294. beantensor-1.0.0rc1/Math/Optimization/SgdUpdate/SgdUpdate.h +27 -0
  295. beantensor-1.0.0rc1/Math/Optimization/SgdUpdate/SgdUpdate.hpp +26 -0
  296. beantensor-1.0.0rc1/Math/Optimization/SgdUpdate/SgdUpdateAVX2.cpp +70 -0
  297. beantensor-1.0.0rc1/Math/Optimization/SgdUpdate/SgdUpdateAVX512.cpp +74 -0
  298. beantensor-1.0.0rc1/Math/Optimization/SgdUpdate/SgdUpdateCPU.cpp +355 -0
  299. beantensor-1.0.0rc1/Math/Optimization/SgdUpdate/SgdUpdateCUDA.cu +186 -0
  300. beantensor-1.0.0rc1/Math/Optimization/SgdUpdate/SgdUpdateHIP.cpp +185 -0
  301. beantensor-1.0.0rc1/Math/Optimization/SgdUpdate/SgdUpdateKernels.h +44 -0
  302. beantensor-1.0.0rc1/Math/Reductions/Argmax/Argmax.h +35 -0
  303. beantensor-1.0.0rc1/Math/Reductions/Argmax/Argmax.hpp +34 -0
  304. beantensor-1.0.0rc1/Math/Reductions/Argmax/ArgmaxCPU.cpp +721 -0
  305. beantensor-1.0.0rc1/Math/Reductions/Argmax/ArgmaxCUDA.cu +499 -0
  306. beantensor-1.0.0rc1/Math/Reductions/Argmax/ArgmaxHIP.cpp +474 -0
  307. beantensor-1.0.0rc1/Math/Reductions/Max/Max.h +25 -0
  308. beantensor-1.0.0rc1/Math/Reductions/Max/Max.hpp +26 -0
  309. beantensor-1.0.0rc1/Math/Reductions/Max/MaxCPU.cpp +424 -0
  310. beantensor-1.0.0rc1/Math/Reductions/Max/MaxCUDA.cu +434 -0
  311. beantensor-1.0.0rc1/Math/Reductions/Max/MaxHIP.cpp +390 -0
  312. beantensor-1.0.0rc1/Math/Reductions/Mean/Mean.h +25 -0
  313. beantensor-1.0.0rc1/Math/Reductions/Mean/Mean.hpp +26 -0
  314. beantensor-1.0.0rc1/Math/Reductions/Mean/MeanCPU.cpp +389 -0
  315. beantensor-1.0.0rc1/Math/Reductions/Mean/MeanCUDA.cu +381 -0
  316. beantensor-1.0.0rc1/Math/Reductions/Mean/MeanHIP.cpp +335 -0
  317. beantensor-1.0.0rc1/Math/Reductions/Min/Min.h +25 -0
  318. beantensor-1.0.0rc1/Math/Reductions/Min/Min.hpp +26 -0
  319. beantensor-1.0.0rc1/Math/Reductions/Min/MinCPU.cpp +424 -0
  320. beantensor-1.0.0rc1/Math/Reductions/Min/MinCUDA.cu +434 -0
  321. beantensor-1.0.0rc1/Math/Reductions/Min/MinHIP.cpp +390 -0
  322. beantensor-1.0.0rc1/Math/Reductions/Reductions.h +14 -0
  323. beantensor-1.0.0rc1/Math/Reductions/ReductionsCudaShared.h +104 -0
  324. beantensor-1.0.0rc1/Math/Reductions/ReductionsHipShared.h +124 -0
  325. beantensor-1.0.0rc1/Math/Reductions/ReductionsShared.h +237 -0
  326. beantensor-1.0.0rc1/Math/Reductions/Sum/Sum.h +25 -0
  327. beantensor-1.0.0rc1/Math/Reductions/Sum/Sum.hpp +26 -0
  328. beantensor-1.0.0rc1/Math/Reductions/Sum/SumAVX2.cpp +103 -0
  329. beantensor-1.0.0rc1/Math/Reductions/Sum/SumAVX512.cpp +92 -0
  330. beantensor-1.0.0rc1/Math/Reductions/Sum/SumCPU.cpp +308 -0
  331. beantensor-1.0.0rc1/Math/Reductions/Sum/SumCUDA.cu +342 -0
  332. beantensor-1.0.0rc1/Math/Reductions/Sum/SumHIP.cpp +312 -0
  333. beantensor-1.0.0rc1/Math/Reductions/Sum/SumKernels.h +49 -0
  334. beantensor-1.0.0rc1/Math/Shape/Flatten.cpp +38 -0
  335. beantensor-1.0.0rc1/Math/Shape/Indexing/Indexing.h +44 -0
  336. beantensor-1.0.0rc1/Math/Shape/Indexing/Indexing.hpp +41 -0
  337. beantensor-1.0.0rc1/Math/Shape/Indexing/IndexingCPU.cpp +327 -0
  338. beantensor-1.0.0rc1/Math/Shape/Indexing/IndexingCUDA.cu +221 -0
  339. beantensor-1.0.0rc1/Math/Shape/Indexing/IndexingHIP.cpp +222 -0
  340. beantensor-1.0.0rc1/Math/Shape/Indexing/IndexingShared.h +80 -0
  341. beantensor-1.0.0rc1/Math/Shape/Reshape.cpp +52 -0
  342. beantensor-1.0.0rc1/Math/Shape/Shape.h +11 -0
  343. beantensor-1.0.0rc1/Math/Shape/Slice.cpp +124 -0
  344. beantensor-1.0.0rc1/Math/Spatial/AvgPool2d/AvgPool2d.h +67 -0
  345. beantensor-1.0.0rc1/Math/Spatial/AvgPool2d/AvgPool2d.hpp +34 -0
  346. beantensor-1.0.0rc1/Math/Spatial/AvgPool2d/AvgPool2dAVX2.cpp +93 -0
  347. beantensor-1.0.0rc1/Math/Spatial/AvgPool2d/AvgPool2dAVX512.cpp +92 -0
  348. beantensor-1.0.0rc1/Math/Spatial/AvgPool2d/AvgPool2dCPU.cpp +621 -0
  349. beantensor-1.0.0rc1/Math/Spatial/AvgPool2d/AvgPool2dCUDA.cu +333 -0
  350. beantensor-1.0.0rc1/Math/Spatial/AvgPool2d/AvgPool2dHIP.cpp +333 -0
  351. beantensor-1.0.0rc1/Math/Spatial/AvgPool2d/AvgPool2dKernels.h +44 -0
  352. beantensor-1.0.0rc1/Math/Spatial/MaxPool2d/MaxPool2d.h +46 -0
  353. beantensor-1.0.0rc1/Math/Spatial/MaxPool2d/MaxPool2d.hpp +34 -0
  354. beantensor-1.0.0rc1/Math/Spatial/MaxPool2d/MaxPool2dAVX2.cpp +99 -0
  355. beantensor-1.0.0rc1/Math/Spatial/MaxPool2d/MaxPool2dAVX512.cpp +98 -0
  356. beantensor-1.0.0rc1/Math/Spatial/MaxPool2d/MaxPool2dCPU.cpp +931 -0
  357. beantensor-1.0.0rc1/Math/Spatial/MaxPool2d/MaxPool2dCUDA.cu +296 -0
  358. beantensor-1.0.0rc1/Math/Spatial/MaxPool2d/MaxPool2dHIP.cpp +292 -0
  359. beantensor-1.0.0rc1/Math/Spatial/MaxPool2d/MaxPool2dKernels.h +44 -0
  360. beantensor-1.0.0rc1/Math/Spatial/Spatial.h +11 -0
  361. beantensor-1.0.0rc1/Math/Spatial/SpatialCudaShared.h +16 -0
  362. beantensor-1.0.0rc1/Math/Spatial/SpatialHipShared.h +16 -0
  363. beantensor-1.0.0rc1/Math/Spatial/SpatialShared.h +15 -0
  364. beantensor-1.0.0rc1/Metrics/Metrics.cpp +167 -0
  365. beantensor-1.0.0rc1/Metrics/Metrics.h +60 -0
  366. beantensor-1.0.0rc1/Module/AvgPool2d.cpp +55 -0
  367. beantensor-1.0.0rc1/Module/AvgPool2d.h +69 -0
  368. beantensor-1.0.0rc1/Module/BatchNorm.cpp +117 -0
  369. beantensor-1.0.0rc1/Module/BatchNorm.h +134 -0
  370. beantensor-1.0.0rc1/Module/Conv2d.cpp +108 -0
  371. beantensor-1.0.0rc1/Module/Conv2d.h +95 -0
  372. beantensor-1.0.0rc1/Module/Dropout.cpp +59 -0
  373. beantensor-1.0.0rc1/Module/Dropout.h +66 -0
  374. beantensor-1.0.0rc1/Module/Flatten.cpp +41 -0
  375. beantensor-1.0.0rc1/Module/Flatten.h +51 -0
  376. beantensor-1.0.0rc1/Module/Gelu.cpp +41 -0
  377. beantensor-1.0.0rc1/Module/Gelu.h +48 -0
  378. beantensor-1.0.0rc1/Module/Linear.cpp +108 -0
  379. beantensor-1.0.0rc1/Module/Linear.h +111 -0
  380. beantensor-1.0.0rc1/Module/MaxPool2d.cpp +55 -0
  381. beantensor-1.0.0rc1/Module/MaxPool2d.h +70 -0
  382. beantensor-1.0.0rc1/Module/Module.cpp +483 -0
  383. beantensor-1.0.0rc1/Module/Module.h +500 -0
  384. beantensor-1.0.0rc1/Module/ModuleSpec.h +97 -0
  385. beantensor-1.0.0rc1/Module/ModuleStream.h +35 -0
  386. beantensor-1.0.0rc1/Module/Relu.cpp +41 -0
  387. beantensor-1.0.0rc1/Module/Relu.h +55 -0
  388. beantensor-1.0.0rc1/Module/Sequential.cpp +104 -0
  389. beantensor-1.0.0rc1/Module/Sequential.h +182 -0
  390. beantensor-1.0.0rc1/Module/Sigmoid.cpp +41 -0
  391. beantensor-1.0.0rc1/Module/Sigmoid.h +48 -0
  392. beantensor-1.0.0rc1/Module/Softmax.cpp +41 -0
  393. beantensor-1.0.0rc1/Module/Softmax.h +53 -0
  394. beantensor-1.0.0rc1/Module/Tanh.cpp +41 -0
  395. beantensor-1.0.0rc1/Module/Tanh.h +48 -0
  396. beantensor-1.0.0rc1/Module/WeightInit.h +52 -0
  397. beantensor-1.0.0rc1/PKG-INFO +82 -0
  398. beantensor-1.0.0rc1/README.md +71 -0
  399. beantensor-1.0.0rc1/Random/Generator.h +147 -0
  400. beantensor-1.0.0rc1/SECURITY.md +20 -0
  401. beantensor-1.0.0rc1/Serialization/Lz77.cpp +150 -0
  402. beantensor-1.0.0rc1/Serialization/Lz77.h +45 -0
  403. beantensor-1.0.0rc1/Serialization/Serialization.cpp +954 -0
  404. beantensor-1.0.0rc1/Serialization/Serialization.h +85 -0
  405. beantensor-1.0.0rc1/Tensor/DTypes.h +366 -0
  406. beantensor-1.0.0rc1/Tensor/Ops/TensorOps.cpp +1073 -0
  407. beantensor-1.0.0rc1/Tensor/Ops/TensorOps.cu +1068 -0
  408. beantensor-1.0.0rc1/Tensor/Ops/TensorOps.h +72 -0
  409. beantensor-1.0.0rc1/Tensor/Ops/TensorOps.hpp +41 -0
  410. beantensor-1.0.0rc1/Tensor/Tensor.cpp +1316 -0
  411. beantensor-1.0.0rc1/Tensor/Tensor.h +2673 -0
  412. beantensor-1.0.0rc1/Verifications/TARGET.MD +10 -0
  413. beantensor-1.0.0rc1/Verifications/aligned_alloc_banned.sh +34 -0
  414. beantensor-1.0.0rc1/Verifications/bind_clean_negative_controls.sh +158 -0
  415. beantensor-1.0.0rc1/Verifications/bind_clean_public_api.sh +60 -0
  416. beantensor-1.0.0rc1/Verifications/bind_clean_scanner.awk +878 -0
  417. beantensor-1.0.0rc1/Verifications/cuda_glibc_noexcept.sh +55 -0
  418. beantensor-1.0.0rc1/Verifications/illegal_dispatch_gates.sh +77 -0
  419. beantensor-1.0.0rc1/Verifications/no_float80.sh +27 -0
  420. beantensor-1.0.0rc1/Verifications/run_all.sh +17 -0
  421. beantensor-1.0.0rc1/benchmark/benchmark.cpp +251 -0
  422. beantensor-1.0.0rc1/benchmark/gradient_parity_perf.cpp +359 -0
  423. beantensor-1.0.0rc1/benchmark/run.sh +60 -0
  424. beantensor-1.0.0rc1/comparison/bench_pytorch.py +96 -0
  425. beantensor-1.0.0rc1/comparison/cnn_pytorch.py +88 -0
  426. beantensor-1.0.0rc1/comparison/cpp.txt +80 -0
  427. beantensor-1.0.0rc1/comparison/gradient_parity.cpp +489 -0
  428. beantensor-1.0.0rc1/comparison/gradient_parity.py +269 -0
  429. beantensor-1.0.0rc1/comparison/gradient_parity_perf.py +153 -0
  430. beantensor-1.0.0rc1/comparison/mnist_pytorch.py +213 -0
  431. beantensor-1.0.0rc1/comparison/python.txt +52 -0
  432. beantensor-1.0.0rc1/comparison/requirements.txt +2 -0
  433. beantensor-1.0.0rc1/comparison/run_gradient_parity.sh +79 -0
  434. beantensor-1.0.0rc1/comparison/run_gradient_parity_perf.sh +140 -0
  435. beantensor-1.0.0rc1/demos/Mnist.h +299 -0
  436. beantensor-1.0.0rc1/demos/cnn.cpp +337 -0
  437. beantensor-1.0.0rc1/demos/csv_demo.cpp +130 -0
  438. beantensor-1.0.0rc1/demos/mnist.cpp +196 -0
  439. beantensor-1.0.0rc1/docs/architecture.md +146 -0
  440. beantensor-1.0.0rc1/docs/btui.md +64 -0
  441. beantensor-1.0.0rc1/docs/dev/benchmarks.md +38 -0
  442. beantensor-1.0.0rc1/docs/dev/bt-format.md +80 -0
  443. beantensor-1.0.0rc1/docs/dev/btui.md +38 -0
  444. beantensor-1.0.0rc1/docs/dev/cnn-results.md +104 -0
  445. beantensor-1.0.0rc1/docs/dev/dashboard.md +11 -0
  446. beantensor-1.0.0rc1/docs/dev/gradient-parity.md +55 -0
  447. beantensor-1.0.0rc1/docs/dev/mnist-results.md +74 -0
  448. beantensor-1.0.0rc1/docs/dev/transfers.md +10 -0
  449. beantensor-1.0.0rc1/docs/python-api.md +322 -0
  450. beantensor-1.0.0rc1/docs/quickstart.md +97 -0
  451. beantensor-1.0.0rc1/fetch_mnist.sh +37 -0
  452. beantensor-1.0.0rc1/hooks/pre-push +14 -0
  453. beantensor-1.0.0rc1/pyproject.toml +21 -0
  454. beantensor-1.0.0rc1/python/btui.py +2529 -0
  455. beantensor-1.0.0rc1/python/cnn.py +213 -0
  456. beantensor-1.0.0rc1/python/csv_demo.py +153 -0
  457. beantensor-1.0.0rc1/python/digits.py +184 -0
  458. beantensor-1.0.0rc1/scripts/pre-push-check.sh +161 -0
  459. beantensor-1.0.0rc1/tests/activation_tests.cpp +430 -0
  460. beantensor-1.0.0rc1/tests/autograd_tests.cpp +2108 -0
  461. beantensor-1.0.0rc1/tests/avg_pool2d_tests.cpp +700 -0
  462. beantensor-1.0.0rc1/tests/basic_ops_tests.cpp +1001 -0
  463. beantensor-1.0.0rc1/tests/batch_norm_tests.cpp +2053 -0
  464. beantensor-1.0.0rc1/tests/bce_tests.cpp +894 -0
  465. beantensor-1.0.0rc1/tests/bindings_smoke.py +1440 -0
  466. beantensor-1.0.0rc1/tests/btui_logic_tests.py +1041 -0
  467. beantensor-1.0.0rc1/tests/btui_ui_tests.py +1918 -0
  468. beantensor-1.0.0rc1/tests/cnn_parity.sh +68 -0
  469. beantensor-1.0.0rc1/tests/cnn_tests.cpp +112 -0
  470. beantensor-1.0.0rc1/tests/complex_ops_tests.cpp +961 -0
  471. beantensor-1.0.0rc1/tests/conv2d_tests.cpp +594 -0
  472. beantensor-1.0.0rc1/tests/csv_loader_tests.cpp +405 -0
  473. beantensor-1.0.0rc1/tests/dashboard_tests.cpp +456 -0
  474. beantensor-1.0.0rc1/tests/data_loader_tests.cpp +327 -0
  475. beantensor-1.0.0rc1/tests/dropout_tests.cpp +335 -0
  476. beantensor-1.0.0rc1/tests/elementwise_tests.cpp +2645 -0
  477. beantensor-1.0.0rc1/tests/flatten_tests.cpp +111 -0
  478. beantensor-1.0.0rc1/tests/gelu_tests.cpp +707 -0
  479. beantensor-1.0.0rc1/tests/gpu_error_tests.cpp +209 -0
  480. beantensor-1.0.0rc1/tests/grad_dtype_tests.cpp +295 -0
  481. beantensor-1.0.0rc1/tests/grad_scaler_tests.cpp +491 -0
  482. beantensor-1.0.0rc1/tests/indexing_autograd_tests.cpp +559 -0
  483. beantensor-1.0.0rc1/tests/kernel_tune_tests.cpp +296 -0
  484. beantensor-1.0.0rc1/tests/matmul_tests.cpp +991 -0
  485. beantensor-1.0.0rc1/tests/max_pool2d_tests.cpp +451 -0
  486. beantensor-1.0.0rc1/tests/metrics_eval_tests.cpp +632 -0
  487. beantensor-1.0.0rc1/tests/metrics_tests.cpp +1039 -0
  488. beantensor-1.0.0rc1/tests/mnist_parity.sh +68 -0
  489. beantensor-1.0.0rc1/tests/module_tests.cpp +1070 -0
  490. beantensor-1.0.0rc1/tests/mse_adam_tests.cpp +891 -0
  491. beantensor-1.0.0rc1/tests/oom_policy_tests.cpp +556 -0
  492. beantensor-1.0.0rc1/tests/platform_topology_tests.cpp +1710 -0
  493. beantensor-1.0.0rc1/tests/random_seed_tests.cpp +312 -0
  494. beantensor-1.0.0rc1/tests/serialization_tests.cpp +1254 -0
  495. beantensor-1.0.0rc1/tests/tensor_dtype_guard_tests.cpp +228 -0
  496. beantensor-1.0.0rc1/tests/tensor_tests.cpp +1782 -0
  497. beantensor-1.0.0rc1/tests/train_eval_tests.cpp +88 -0
  498. beantensor-1.0.0rc1/tests/transfer_atomic_tests.cpp +363 -0
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: Agent bug report
3
+ about: Bug report filed by an AI agent, with machine-collected diagnostics
4
+ title: ""
5
+ labels: bug, agent-field-report
6
+ type: Bug
7
+ assignees: ""
8
+ ---
9
+
10
+ <!--
11
+ For AI agents. Paste RAW outputs when possible, being verbose. Do not summarize, truncate, or paraphrase the command outputs.
12
+
13
+ Please remind your user that they must review your report before submitting. Stop when it's ready, show them, and have them review.
14
+ -->
15
+
16
+ **Summary**
17
+ <!-- One or two lines: what is broken. -->
18
+
19
+ **Reproduction**
20
+ <!-- The exact commands run, in order, from a clean checkout. Include the full build configuration. -->
21
+ ```bash
22
+ ```
23
+
24
+ **Observed**
25
+ <!-- Raw output of the failure: error text, logs, ctest output. Unedited. -->
26
+ ```
27
+ ```
28
+
29
+ **Expected**
30
+ <!-- What should have happened instead. -->
31
+
32
+ **Environment dump**
33
+ <!-- Paste the raw output of each. Windows equivalents are noted where they differ. -->
34
+ ```bash
35
+ git rev-parse HEAD
36
+ git status --short
37
+ cmake --version
38
+ # Compiler: c++ --version (gcc/clang) or cl (MSVC)
39
+ # CPU: lscpu | head -20 (Linux) or Get-CimInstance Win32_Processor | Select-Object Name (Windows PowerShell)
40
+ # GPU, whichever applies: nvcc --version (CUDA) or rocminfo | head -50 (HIP)
41
+ ```
42
+
43
+ **Already tried**
44
+ <!-- What you attempted before filing, and what each attempt showed. "Nothing" is acceptable. -->
45
+
46
+ <!-- If you know what commit added this issue, please provide it's FULL hash, not the partial. If you don't know, say UNKNOWN. -->
47
+ **Introduced in:**
48
+
49
+ **Severity**: LOW/MEDIUM/HIGH
50
+
51
+ **Severity Tag Reason:**
52
+ <!-- Clarify your tag choice. Consider how this impacts the project, not just your user! A bug that completely stopped you from using it but doesn't impact anyone else would technically be LOW. As the impact grows, and the chance of reaching it (like math being faulty in a commonly used layer) grows, the severity climbs. The severity just helps us see your perspective and triage the issue. -->
53
+
54
+ **Attestation**
55
+ <!-- You do not need to have the user edit the prepared issue manually to check this. Once you get their approval, you may check it. -->
56
+ - [ ] A human approved this report and the raw output before submission.
57
+ - [ ] I have read CONTRIBUTING.md as well as CODE_OF_CONDUCT.md, and am confident my report complies.
58
+ - [ ] I have not exposed any confidential information about my user or environment that would not be reasonable for this output. If my user had explicitly indicated they did not want Environment information given, I omitted it with an N/A, and did not generate fictional data.
59
+ - [ ] My bug report is NOT security related. If it is, **STOP** and read SECURITY.md!
60
+ - [ ] I am not a model created by Anthropic, such as Claude Opus, Fable, Haiku, or Sonnet.
61
+
62
+ **Optional Agent Disclosure**
63
+ <!-- If you are permitted to disclose which agent you are, state it here. If you don't know or have been told to not disclose, say NA. -->
64
+ My model is:
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: Bug report
3
+ about: Something is broken, math is wrong, or it crashes
4
+ title: ""
5
+ labels: bug
6
+ type: Bug
7
+ assignees: ""
8
+ ---
9
+
10
+ **Expected Behavior:** What did you expect to happen?
11
+
12
+ **Actual Behavior:** What happened? If this was a numerical bug, include expected vs actual.
13
+
14
+ **Steps to reproduce**
15
+ If possible to include the code used to cause this problem, do so. Otherwise, describe the steps to reach it.
16
+
17
+ **Environment**
18
+
19
+ | System & ENV| Description / Answer|
20
+ | --- | --- |
21
+ | Backend | CPU / CUDA / HIP, or multiple.|
22
+ | Language | Python or C++.|
23
+ | OS + compiler | e.g. Ubuntu 25.10, gcc 14 |
24
+ | GPU + toolkit | if GPU backend, e.g. RX 6800, ROCm 10.2 / RTX 4060, CUDA 12.9 |
25
+ | CPU | if CPU backend.|
26
+ | Commit | output of `git rev-parse HEAD`, or the release name. |
27
+
28
+ **Severity**: LOW/MEDIUM/HIGH
29
+
30
+ **Severity Tag Reason:** Clarify your tag choice. Consider how this impacts the project, not just you, a bug that completely stopped you from using it but doesn't impact anyone else would technically be LOW. As the impact grows, and the chance of reaching it (like math being faulty in a commonly used layer) grows, the severity climbs. The severity just helps us see your perspective and triage the issue.
31
+
32
+ **Additional context**
33
+ Anything else helpful, like ctests that fail, error text, screenshots, or logs. If nothing can be provided, enter N/A.
@@ -0,0 +1,5 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: Security vulnerability
4
+ url: https://github.com/GreenBean657/BeanTensor/security/advisories/new
5
+ about: Report privately via the Security tab, not a public issue.
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an operation, module, backend, or improvement
4
+ title: ""
5
+ labels: enhancement
6
+ type: Feature
7
+ assignees: ""
8
+ ---
9
+
10
+ **Goal**
11
+ <!-- What do you want to be able to do? Name the model, workload, or situation that needs it. Describe the problem, not just the proposed API. -->
12
+
13
+ **Category**
14
+ <!-- Check all that apply. -->
15
+ - [ ] New operation
16
+ - [ ] New module / layer
17
+ - [ ] New backend support or GPU target (Metal, NPU, Vulkan, SYCL, ARM, etc.)
18
+ - [ ] New OS (Targeted OS, Mac or a specific Linux distro.)
19
+ - [ ] Performance improvement
20
+ - [ ] Python bindings or general API
21
+ - [ ] Other:
22
+
23
+ **Workaround (optional)**
24
+ <!-- How do you get this behavior today with existing ops, if you can? -->
25
+
26
+ **Proposed interface (optional)**
27
+ <!-- Sketch of the C++ or Python API you have in mind. If you don't know, leave blank. -->
28
+
29
+ **Reference behavior (optional)**
30
+ <!-- Equivalent op/feature in PyTorch/NumPy/TensorFlow/JAX. Could be a paper, specification, or explanation. Note any semantics you rely on (or know of!), so the expected behavior is unambiguous. -->
31
+
32
+ **Additional context**
33
+ <!-- Benchmarks, related issues, or anything else you think is helpful. -->
34
+
35
+ **Are you willing to or can you contribute? One must be selected.**
36
+ - [ ] I'd like to implement this (You may begin your PR as well!)
37
+ - [ ] I can test on hardware (list hardware model / toolchain):
38
+ - [ ] I'm just suggesting, I can't/won't assist. (This is 100% acceptable!)
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: Feedback
3
+ about: General feedback, questions, or experiences using BeanTensor
4
+ title: ""
5
+ labels: feedback
6
+ type: Feedback
7
+ assignees: ""
8
+ ---
9
+
10
+ <!-- Thanks for using this project, or looking through it! I would love your feedback. Virtually all fields are optional, leave blank what you don't want to say. Be detailed, or be light - it's all helpful! -->
11
+
12
+ - [ ] I would be fine with additional questions, and would be willing to respond to maintainer questions in this feedback.
13
+
14
+ <!-- Summary is required unless you answer the Liked/Disliked fields for an in-depth response, then you may blank it or write a short summary. -->
15
+ **Feedback Summary**
16
+ <!-- What worked, what didn't, what's confusing, what you expected to exist. Anything that isn't a bug report or a feature request. Share as much or as little as you like! -->
17
+
18
+ **What I Liked (optional unless Summary is blank)**
19
+ <!-- What did you like? What worked? Did anything we offer exceed expectations, or out-pace your other libraries? Did the workflows work out? -->
20
+
21
+ **What I Disliked (optional unless Summary is blank)**
22
+ <!-- What didn't you like? Was something confusing, didn't exist, or wasn't as expected? -->
23
+
24
+ **Context (optional)**
25
+ <!-- What were you building or evaluating? Anything to add that helps us understand and work best with this feedback? -->
26
+
27
+ **Docs / Onboarding (optional, pick one)**
28
+ - [ ] It was easy to understand documentation and use this project.
29
+ - [ ] It was confusing to use this project, but I got it.
30
+ - [ ] Documentation was so confusing I felt lost.
31
+ **Additional Notes about Documentation:**
32
+
33
+ **Hardware & System (optional, fill in whichever fields you feel comfortable and know)**
34
+ | System & ENV | Description / Answer|
35
+ | --- | --- |
36
+ | Backend Used| CPU / CUDA / HIP, or multiple.|
37
+ | Language | Python or C++.|
38
+ | OS + compiler | e.g. Ubuntu 25.10, gcc 14 |
39
+ | GPU + toolkit | e.g. RX 6800, ROCm 10.2 / RTX 4060, CUDA 12.9 |
40
+ | CPU | e.g. Ryzen AI Max+ 395 |
41
+ | Commit | output of `git rev-parse HEAD`, or the release name. |
@@ -0,0 +1,76 @@
1
+ <!-- Be sure to read the project's rules and CONTRIBUTING.md before submitting.-->
2
+
3
+ Primary Changes:
4
+ -
5
+ Secondary Changes:
6
+ - (Or "- None")
7
+ Description:
8
+ <!-- Why this is needed, the approach taken, and any alternatives rejected, and what you did. Not every little thing needs explanation, but something large or risky in terms of math needs a note here.
9
+
10
+ - Feature Fixes, explain the feature and your implementation.
11
+ - Bug Fixes, explain what the bug was and how you resolved it, briefly.
12
+ - Mathematical Fixes, note the FP/INT D-Types impacted, and how off from baseline it was. Was this gradient only, or full?
13
+ - Performance Fixes, document briefly the improvements you see from this.
14
+ - Refactor Changes, explain why you refactored.
15
+ - Build/CI/Tool Changes, explain why it had to change and what your adjustment does.
16
+ - Docs/Tests, For tests explain why your adjusted test is better (or if you added, what it covers), or why this documentation clean up is needed.
17
+
18
+ -->
19
+
20
+ Relevant Issues/PR's (If applicable): None
21
+
22
+ ## Type of Change (At least one must be checked.)
23
+ - [ ] Feature (New Layer, New Functionality, new OS/architecture support)
24
+ - [ ] Bug fix (A bug not related to math, like loading faults.)
25
+ - [ ] Mathematical Fix (A bug or improvement which impacts the math outputs of the project.)
26
+ - [ ] Performance (Speed)
27
+ - [ ] Refactor (no behavior change)
28
+ - [ ] Build / CI / tooling
29
+ - [ ] Docs / tests only
30
+
31
+ ## Backend Impact (Untouched/Not applicable can be left blank or removed)
32
+ | Backend | Touched | Tested | GPU model / toolchain |
33
+ |---------|:-------:|:------:|-----------------------|
34
+ | CPU | [ ] | [ ] | |
35
+ | CUDA | [ ] | [ ] | |
36
+ | HIP | [ ] | [ ] | |
37
+
38
+ Touched but not tested, and why:
39
+
40
+ ## Correctness & Numerics (Not applicable can be left blank or removed)
41
+ <!-- N/A if no numerical code changed. -->
42
+ - Reference compared against (CPU baseline, NumPy, PyTorch, etc.):
43
+ - Tolerances used and rationale:
44
+ - [ ] Cross-backend results agree within tolerance
45
+ - [ ] Reduced-precision dtypes touched were checked (FP16/BF16/etc.)
46
+
47
+ ## API / Compatibility (Not applicable can be left blank or removed)
48
+ - [ ] Contains Public API changes
49
+ - [ ] Contains a revision to the .bt file version.
50
+ - [ ] Behavior changes which could impact something a legacy user relied on, like odd math or specific mechanics.
51
+
52
+ Details of API/Compatibility changes:
53
+
54
+ ## Reviewer Notes, If Any (Not applicable can be left blank.)
55
+ <!-- Risky or subtle parts of the diff, and where to focus. -->
56
+
57
+ ## Checklist (For small, non-code commits, you may skip. Any code edits need a CPU test at worst.)
58
+ - [ ] CPU build + ctests pass (or explain why not applicable)
59
+ - [ ] GPU build + ctests pass on the GPU backends I touched. (or explain why not applicable)
60
+ - [ ] For non-trivial logic, I added tests. (Leave blank if not applicable)
61
+ - [ ] I covered Edge Cases. (zero-size tensors, non-contiguous strides, broadcasting, sizes not divisible by tile/warp width. Leave blank if not applicable)
62
+
63
+
64
+ ## Optional Disclosure (Put NA if you refuse to answer. Any/ALL fields may be N/A)
65
+ - The Agent I used to research, adjust, or locate the fix: (N/A, None/Human, or AgentName)
66
+ - The hardware I was using for this was:
67
+ - CPU:
68
+ - GPU:
69
+ - OS:
70
+ - I have experimented with or built a model with BeanTensor before: [ ]
71
+ # Required Disclosure (All are required, if you cannot tick one, do not open the PR.)
72
+ - [ ] I did not, at any point, consult or use a model created by **Anthropic** (Like Claude).
73
+ - [ ] This commit is my own, and I am authorized to submit it.
74
+ - [ ] I agree this commit will fall under the projects MIT license if merged.
75
+ - [ ] AI generated or not, I did review the diff for problems before finalizing this PR.
76
+ - [ ] I have not made any false claims such as a lie about performing a test.
@@ -0,0 +1,46 @@
1
+ # CI — CPU build + test matrix.
2
+ # HIP/CUDA jobs intentionally absent: GitHub-hosted runners have no AMD/NVIDIA
3
+ # GPUs. Compile/run coverage for GPU backends stays local until a self-hosted
4
+ # runner exists.
5
+ name: ci
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ on:
11
+ push:
12
+ pull_request:
13
+
14
+ jobs:
15
+ cpu:
16
+ name: cpu-build-and-test
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # actions/checkout v6.0.3
20
+
21
+ - name: Toolchain (cmake >= 4.2 required by CMakeLists, g++-14 for C++23)
22
+ run: |
23
+ sudo apt-get update
24
+ sudo apt-get install -y g++-14
25
+ python3 -m pip install --user "cmake>=4.2"
26
+ python3 -m pip install --user pybind11 numpy
27
+ echo "$HOME/.local/bin" >> "$GITHUB_PATH"
28
+
29
+ - name: Configure (CPU-only)
30
+ env:
31
+ CXX: g++-14
32
+ run: cmake -S . -B build -DBEANTENSOR_BACKEND=CPU -DBUILD_TESTING=ON -DBUILD_PYTHON_BINDINGS=ON -DCMAKE_BUILD_TYPE=Release
33
+
34
+ - name: Build
35
+ run: cmake --build build -j "$(nproc)"
36
+
37
+ - name: MNIST data (datasets/ is gitignored; the mnist_demo ctest reads it)
38
+ run: ./fetch_mnist.sh
39
+
40
+ - name: Test
41
+ run: ctest --test-dir build --output-on-failure
42
+
43
+ - name: Gradient parity vs PyTorch (CPU)
44
+ run: |
45
+ python3 -m pip install --user --index-url https://download.pytorch.org/whl/cpu torch
46
+ BT_PARITY_PYTHON=python3 bash comparison/run_gradient_parity.sh --build-dir build --device cpu
@@ -0,0 +1,48 @@
1
+ # Docs — Doxygen API reference published to GitHub Pages.
2
+ name: docs
3
+
4
+ permissions:
5
+ contents: read
6
+ pages: write
7
+ id-token: write
8
+
9
+ on:
10
+ push:
11
+ branches: [main]
12
+
13
+ jobs:
14
+ build:
15
+ name: build-api-docs
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # actions/checkout v6.0.3
19
+
20
+ - name: Install Doxygen
21
+ run: sudo apt-get update && sudo apt-get install -y doxygen
22
+
23
+ - name: Generate Doxygen documentation
24
+ run: doxygen Doxyfile
25
+
26
+ - name: Configure Pages
27
+ uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # actions/configure-pages v5
28
+ with:
29
+ enablement: true
30
+
31
+ - name: Upload Pages artifact
32
+ # v5 pins its internal upload-artifact reference to a full SHA
33
+ # (v3 used a tag, which the repo's SHA-pinning ruleset rejects).
34
+ uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # actions/upload-pages-artifact v5.0.0
35
+ with:
36
+ path: docs/doxygen/html
37
+
38
+ deploy:
39
+ name: deploy-to-pages
40
+ needs: build
41
+ runs-on: ubuntu-latest
42
+ environment:
43
+ name: github-pages
44
+ url: ${{ steps.deployment.outputs.page_url }}
45
+ steps:
46
+ - name: Deploy to GitHub Pages
47
+ id: deployment
48
+ uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # actions/deploy-pages v4
@@ -0,0 +1,22 @@
1
+ build/
2
+ build-verify/
3
+ cmake-build-debug/
4
+ cmake-build-release/
5
+ scratch/
6
+ __pycache__/
7
+ /benchmark/results/
8
+ !/benchmark/
9
+ /benchmark/*
10
+ !/benchmark/*.cpp
11
+ !/benchmark/*.sh
12
+ comparison/generated-data/
13
+ comparison/perf-results/
14
+ .idea/
15
+ *.d
16
+ *.ddi
17
+ .clangd
18
+ datasets/
19
+ digits_mlp.bt
20
+ docs/doxygen/
21
+ tmp/
22
+ tmp
@@ -0,0 +1,80 @@
1
+ /**
2
+ * @file BeanTensor.h
3
+ * @author GreenBean
4
+ * @brief One include pulls in the whole public surface: tensors, every
5
+ * module, the DataLoader, metrics, the RNG, CSV loading, and .bt
6
+ * serialization.
7
+ *
8
+ * The short namespace aliases (nn, data, io, metrics, rnd) shorten the
9
+ * deeply nested project namespaces.
10
+ *
11
+ * Typical use:
12
+ * #include "BeanTensor.h"
13
+ * using namespace BeanTensor;
14
+ * auto net = nn::make_sequential(std::make_unique<nn::Linear>(784, 128),
15
+ * std::make_unique<nn::Relu>(),
16
+ * std::make_unique<nn::Linear>(128, 10));
17
+ * @version 0.2.1
18
+ * @date 2026-12-03
19
+ */
20
+ #pragma once
21
+
22
+ #include "Tensor/DTypes.h"
23
+ #include "Tensor/Tensor.h"
24
+
25
+ #include "Math/Loss/Loss.h"
26
+
27
+ #include "Module/BatchNorm.h"
28
+ #include "Module/Conv2d.h"
29
+ #include "Module/Dropout.h"
30
+ #include "Module/Flatten.h"
31
+ #include "Module/Gelu.h"
32
+ #include "Module/Linear.h"
33
+ #include "Module/MaxPool2d.h"
34
+ #include "Module/AvgPool2d.h"
35
+ #include "Module/Module.h"
36
+ #include "Module/ModuleStream.h"
37
+ #include "Module/Relu.h"
38
+ #include "Module/Sequential.h"
39
+ #include "Module/Sigmoid.h"
40
+ #include "Module/Softmax.h"
41
+ #include "Module/Tanh.h"
42
+
43
+ #include "Data/Csv.h"
44
+ #include "Data/DataLoader.h"
45
+
46
+ #include "Metrics/Metrics.h"
47
+ #include "Random/Generator.h"
48
+ #include "Serialization/Serialization.h"
49
+
50
+ namespace BeanTensor {
51
+ /**
52
+ * The two names every training script touches, lifted to the root so
53
+ * `using namespace BeanTensor` is enough.
54
+ */
55
+ using Tensors::Device;
56
+ using Tensors::Tensor;
57
+
58
+ /**
59
+ * Short alias for the module layer namespace: layers, Sequential, and
60
+ * the training conveniences live here.
61
+ */
62
+ namespace nn = Modules;
63
+ /**
64
+ * Short alias for the data namespace: DataLoader and CSV loading.
65
+ */
66
+ namespace data = Data;
67
+ /**
68
+ * Short alias for the metrics namespace: accuracy and evaluate.
69
+ */
70
+ namespace metrics = Metrics;
71
+ /**
72
+ * Short alias for the random namespace: the Generator and set_seed.
73
+ */
74
+ namespace rnd = Random;
75
+ /**
76
+ * Short alias for the serialization namespace: .bt save/load and the
77
+ * checkpoint levels.
78
+ */
79
+ namespace io = Serialization;
80
+ }
@@ -0,0 +1,59 @@
1
+ # Python bindings module. pybind11 is expected from pip, not a system package,
2
+ # so its CMake package location is probed through the interpreter itself.
3
+ #
4
+ # Setup on a PEP 668 (externally managed) box — --user is rejected there just
5
+ # like a system-wide install, so use one venv for the interpreter AND the
6
+ # packages, consistently:
7
+ #
8
+ # python3 -m venv .venv
9
+ # .venv/bin/python -m pip install "pybind11>=3.0" numpy
10
+ #
11
+ # The venv's interpreter must be the one CMake picks up: either activate the
12
+ # venv before configuring (PATH discovery) or pass
13
+ # -DPython3_EXECUTABLE=$PWD/.venv/bin/python. Python development headers are
14
+ # required (find_package below asks for Development.Module; Debian/Ubuntu
15
+ # package: python3-dev).
16
+ find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module)
17
+
18
+ execute_process(
19
+ COMMAND "${Python3_EXECUTABLE}" -m pybind11 --cmakedir
20
+ OUTPUT_VARIABLE BEANTENSOR_PYBIND11_CMAKEDIR
21
+ OUTPUT_STRIP_TRAILING_WHITESPACE
22
+ ERROR_QUIET
23
+ RESULT_VARIABLE BEANTENSOR_PYBIND11_CMAKEDIR_RESULT
24
+ )
25
+ if (BEANTENSOR_PYBIND11_CMAKEDIR_RESULT OR NOT BEANTENSOR_PYBIND11_CMAKEDIR)
26
+ message(FATAL_ERROR
27
+ "pybind11 is not installed for ${Python3_EXECUTABLE}. Set up one interpreter as documented at the top of Bindings/CMakeLists.txt: python3 -m venv .venv && .venv/bin/python -m pip install \"pybind11>=3.0\" numpy (reconfigure with -DPython3_EXECUTABLE=<venv>/bin/python if the venv is not first on PATH).")
28
+ endif ()
29
+ set(pybind11_DIR "${BEANTENSOR_PYBIND11_CMAKEDIR}" CACHE PATH "pybind11 CMake package dir (reported by the pip install)" FORCE)
30
+ # py::smart_holder (required below for the unique_ptr<Module> ownership
31
+ # transfers) ships with pybind11 3.0 — pin the floor here so an older install
32
+ # fails configure with an upgrade hint instead of a smart_holder compile error.
33
+ find_package(pybind11 3.0 REQUIRED)
34
+
35
+ # The extension module is a shared object, so the static core it links must
36
+ # be position-independent: without -fPIC the core's function-local thread_local
37
+ # RNG (Tensor.cpp fill_random_impl) gets local-exec TLS, which ld refuses when
38
+ # linking a static archive into a shared library.
39
+ set_target_properties(BeanTensorV5Core PROPERTIES POSITION_INDEPENDENT_CODE ON)
40
+
41
+ pybind11_add_module(beantensor pybind_module.cpp)
42
+ target_link_libraries(beantensor PRIVATE BeanTensorV5Core)
43
+
44
+ # The module needs the backend macros itself for the gpu_memory telemetry
45
+ # bind (cudaMemGetInfo/hipMemGetInfo); the core's defines are PRIVATE.
46
+ if (USE_CUDA)
47
+ target_compile_definitions(beantensor PRIVATE USE_CUDA)
48
+ elseif (USE_HIP)
49
+ target_compile_definitions(beantensor PRIVATE USE_HIP)
50
+ endif ()
51
+
52
+ # The root CMakeLists registers the bindings_smoke ctest when the option is
53
+ # on; hand the interpreter path up so the test runs the same Python.
54
+ set(BEANTENSOR_PYTHON3_EXECUTABLE "${Python3_EXECUTABLE}" PARENT_SCOPE)
55
+
56
+ # Only artifact with an install() rule in the project, so the wheel that
57
+ # scikit-build-core assembles from `cmake --install` ships exactly this module.
58
+ # RUNTIME covers the Windows .pyd, LIBRARY the Unix .so.
59
+ install(TARGETS beantensor LIBRARY DESTINATION . RUNTIME DESTINATION .)