Reikriam

Current spec

Jul 27th, 2020
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.69 KB | None | 0 0
  1. Kernels:
  2. - name: awkward_Identities_from_ListOffsetArray
  3. specializations:
  4. - name: awkward_Identities32_from_ListOffsetArray64
  5. args:
  6. - toptr: List[int32_t]
  7. - fromptr: List[int32_t]
  8. - fromoffsets: List[int64_t]
  9. - fromptroffset: int64_t
  10. - offsetsoffset: int64_t
  11. - tolength: int64_t
  12. - fromlength: int64_t
  13. - fromwidth: int64_t
  14. tests:
  15. - success:
  16. inparam:
  17. - fromptr: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
  18. - fromoffsets: [0, 2, 1, 1, 1, 1, 2, 0, 1, 2]
  19. - fromptroffset: 0
  20. - offsetsoffset: 1
  21. - tolength: 3
  22. - fromlength: 3
  23. - fromwidth: 3
  24. outparam:
  25. - toptr: [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
  26. - failure:
  27. inparam:
  28. - fromptr: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
  29. - fromoffsets: [0, 2, 5, 1, 1, 1, 2, 0, 1, 2]
  30. - fromptroffset: 0
  31. - offsetsoffset: 1
  32. - tolength: 3
  33. - fromlength: 3
  34. - fromwidth: 3
  35. - name: awkward_Identities32_from_ListOffsetArrayU32
  36. args:
  37. - toptr: List[int32_t]
  38. - fromptr: List[int32_t]
  39. - fromoffsets: List[uint32_t]
  40. - fromptroffset: int64_t
  41. - offsetsoffset: int64_t
  42. - tolength: int64_t
  43. - fromlength: int64_t
  44. - fromwidth: int64_t
  45. tests:
  46. - success:
  47. inparam:
  48. - fromptr: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
  49. - fromoffsets: [0, 2, 1, 1, 1, 1, 2, 0, 1, 2]
  50. - fromptroffset: 0
  51. - offsetsoffset: 1
  52. - tolength: 3
  53. - fromlength: 3
  54. - fromwidth: 3
  55. outparam:
  56. - toptr: [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
  57. - failure:
  58. inparam:
  59. - fromptr: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
  60. - fromoffsets: [0, 2, 5, 1, 1, 1, 2, 0, 1, 2]
  61. - fromptroffset: 0
  62. - offsetsoffset: 1
  63. - tolength: 3
  64. - fromlength: 3
  65. - fromwidth: 3
  66. - name: awkward_Identities64_from_ListOffsetArray32
  67. args:
  68. - toptr: List[int64_t]
  69. - fromptr: List[int64_t]
  70. - fromoffsets: List[int32_t]
  71. - fromptroffset: int64_t
  72. - offsetsoffset: int64_t
  73. - tolength: int64_t
  74. - fromlength: int64_t
  75. - fromwidth: int64_t
  76. tests:
  77. - success:
  78. inparam:
  79. - fromptr: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
  80. - fromoffsets: [0, 2, 1, 1, 1, 1, 2, 0, 1, 2]
  81. - fromptroffset: 0
  82. - offsetsoffset: 1
  83. - tolength: 3
  84. - fromlength: 3
  85. - fromwidth: 3
  86. outparam:
  87. - toptr: [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
  88. - failure:
  89. inparam:
  90. - fromptr: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
  91. - fromoffsets: [0, 2, 5, 1, 1, 1, 2, 0, 1, 2]
  92. - fromptroffset: 0
  93. - offsetsoffset: 1
  94. - tolength: 3
  95. - fromlength: 3
  96. - fromwidth: 3
  97. - name: awkward_Identities32_from_ListOffsetArray32
  98. args:
  99. - toptr: List[int32_t]
  100. - fromptr: List[int32_t]
  101. - fromoffsets: List[int32_t]
  102. - fromptroffset: int64_t
  103. - offsetsoffset: int64_t
  104. - tolength: int64_t
  105. - fromlength: int64_t
  106. - fromwidth: int64_t
  107. tests:
  108. - success:
  109. inparam:
  110. - fromptr: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
  111. - fromoffsets: [0, 2, 1, 1, 1, 1, 2, 0, 1, 2]
  112. - fromptroffset: 0
  113. - offsetsoffset: 1
  114. - tolength: 3
  115. - fromlength: 3
  116. - fromwidth: 3
  117. outparam:
  118. - toptr: [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
  119. - failure:
  120. inparam:
  121. - fromptr: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
  122. - fromoffsets: [0, 2, 5, 1, 1, 1, 2, 0, 1, 2]
  123. - fromptroffset: 0
  124. - offsetsoffset: 1
  125. - tolength: 3
  126. - fromlength: 3
  127. - fromwidth: 3
  128. - name: awkward_Identities64_from_ListOffsetArray64
  129. args:
  130. - toptr: List[int64_t]
  131. - fromptr: List[int64_t]
  132. - fromoffsets: List[int64_t]
  133. - fromptroffset: int64_t
  134. - offsetsoffset: int64_t
  135. - tolength: int64_t
  136. - fromlength: int64_t
  137. - fromwidth: int64_t
  138. tests:
  139. - success:
  140. inparam:
  141. - fromptr: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
  142. - fromoffsets: [0, 2, 1, 1, 1, 1, 2, 0, 1, 2]
  143. - fromptroffset: 0
  144. - offsetsoffset: 1
  145. - tolength: 3
  146. - fromlength: 3
  147. - fromwidth: 3
  148. outparam:
  149. - toptr: [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
  150. - failure:
  151. inparam:
  152. - fromptr: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
  153. - fromoffsets: [0, 2, 5, 1, 1, 1, 2, 0, 1, 2]
  154. - fromptroffset: 0
  155. - offsetsoffset: 1
  156. - tolength: 3
  157. - fromlength: 3
  158. - fromwidth: 3
  159. - name: awkward_Identities64_from_ListOffsetArrayU32
  160. args:
  161. - toptr: List[int64_t]
  162. - fromptr: List[int64_t]
  163. - fromoffsets: List[uint32_t]
  164. - fromptroffset: int64_t
  165. - offsetsoffset: int64_t
  166. - tolength: int64_t
  167. - fromlength: int64_t
  168. - fromwidth: int64_t
  169. tests:
  170. - success:
  171. inparam:
  172. - fromptr: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
  173. - fromoffsets: [0, 2, 1, 1, 1, 1, 2, 0, 1, 2]
  174. - fromptroffset: 0
  175. - offsetsoffset: 1
  176. - tolength: 3
  177. - fromlength: 3
  178. - fromwidth: 3
  179. outparam:
  180. - toptr: [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
  181. - failure:
  182. inparam:
  183. - fromptr: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
  184. - fromoffsets: [0, 2, 5, 1, 1, 1, 2, 0, 1, 2]
  185. - fromptroffset: 0
  186. - offsetsoffset: 1
  187. - tolength: 3
  188. - fromlength: 3
  189. - fromwidth: 3
  190. specification: |
  191. def awkward_Identities_from_ListOffsetArray(
  192. toptr,
  193. fromptr,
  194. fromoffsets,
  195. fromptroffset,
  196. offsetsoffset,
  197. tolength,
  198. fromlength,
  199. fromwidth,
  200. ):
  201. globalstart = fromoffsets[offsetsoffset]
  202. globalstop = fromoffsets[offsetsoffset + fromlength]
  203. for k in range(globalstart * (fromwidth + 1)):
  204. toptr[k] = -1
  205. k = globalstop * (fromwidth + 1)
  206. while k < (tolength * (fromwidth + 1)):
  207. toptr[k] = -1
  208. k = k + 1
  209. for i in range(fromlength):
  210. start = fromoffsets[offsetsoffset + i]
  211. stop = fromoffsets[(offsetsoffset + i) + 1]
  212. if (start != stop) and (stop > tolength):
  213. raise ValueError("max(stop) > len(content)")
  214. for j in range(start, stop):
  215. for k in range(fromwidth):
  216. toptr[(j * (fromwidth + 1)) + k] = fromptr[
  217. (fromptroffset + (i * fromwidth)) + k
  218. ]
  219. toptr[(j * (fromwidth + 1)) + fromwidth] = float(j - start)
  220.  
Advertisement
Add Comment
Please, Sign In to add comment