Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Kernels:
- - name: awkward_Identities_from_ListOffsetArray
- specializations:
- - name: awkward_Identities32_from_ListOffsetArray64
- args:
- - toptr: List[int32_t]
- - fromptr: List[int32_t]
- - fromoffsets: List[int64_t]
- - fromptroffset: int64_t
- - offsetsoffset: int64_t
- - tolength: int64_t
- - fromlength: int64_t
- - fromwidth: int64_t
- tests:
- - success:
- inparam:
- - fromptr: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
- - fromoffsets: [0, 2, 1, 1, 1, 1, 2, 0, 1, 2]
- - fromptroffset: 0
- - offsetsoffset: 1
- - tolength: 3
- - fromlength: 3
- - fromwidth: 3
- outparam:
- - toptr: [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
- - failure:
- inparam:
- - fromptr: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
- - fromoffsets: [0, 2, 5, 1, 1, 1, 2, 0, 1, 2]
- - fromptroffset: 0
- - offsetsoffset: 1
- - tolength: 3
- - fromlength: 3
- - fromwidth: 3
- - name: awkward_Identities32_from_ListOffsetArrayU32
- args:
- - toptr: List[int32_t]
- - fromptr: List[int32_t]
- - fromoffsets: List[uint32_t]
- - fromptroffset: int64_t
- - offsetsoffset: int64_t
- - tolength: int64_t
- - fromlength: int64_t
- - fromwidth: int64_t
- tests:
- - success:
- inparam:
- - fromptr: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
- - fromoffsets: [0, 2, 1, 1, 1, 1, 2, 0, 1, 2]
- - fromptroffset: 0
- - offsetsoffset: 1
- - tolength: 3
- - fromlength: 3
- - fromwidth: 3
- outparam:
- - toptr: [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
- - failure:
- inparam:
- - fromptr: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
- - fromoffsets: [0, 2, 5, 1, 1, 1, 2, 0, 1, 2]
- - fromptroffset: 0
- - offsetsoffset: 1
- - tolength: 3
- - fromlength: 3
- - fromwidth: 3
- - name: awkward_Identities64_from_ListOffsetArray32
- args:
- - toptr: List[int64_t]
- - fromptr: List[int64_t]
- - fromoffsets: List[int32_t]
- - fromptroffset: int64_t
- - offsetsoffset: int64_t
- - tolength: int64_t
- - fromlength: int64_t
- - fromwidth: int64_t
- tests:
- - success:
- inparam:
- - fromptr: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
- - fromoffsets: [0, 2, 1, 1, 1, 1, 2, 0, 1, 2]
- - fromptroffset: 0
- - offsetsoffset: 1
- - tolength: 3
- - fromlength: 3
- - fromwidth: 3
- outparam:
- - toptr: [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
- - failure:
- inparam:
- - fromptr: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
- - fromoffsets: [0, 2, 5, 1, 1, 1, 2, 0, 1, 2]
- - fromptroffset: 0
- - offsetsoffset: 1
- - tolength: 3
- - fromlength: 3
- - fromwidth: 3
- - name: awkward_Identities32_from_ListOffsetArray32
- args:
- - toptr: List[int32_t]
- - fromptr: List[int32_t]
- - fromoffsets: List[int32_t]
- - fromptroffset: int64_t
- - offsetsoffset: int64_t
- - tolength: int64_t
- - fromlength: int64_t
- - fromwidth: int64_t
- tests:
- - success:
- inparam:
- - fromptr: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
- - fromoffsets: [0, 2, 1, 1, 1, 1, 2, 0, 1, 2]
- - fromptroffset: 0
- - offsetsoffset: 1
- - tolength: 3
- - fromlength: 3
- - fromwidth: 3
- outparam:
- - toptr: [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
- - failure:
- inparam:
- - fromptr: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
- - fromoffsets: [0, 2, 5, 1, 1, 1, 2, 0, 1, 2]
- - fromptroffset: 0
- - offsetsoffset: 1
- - tolength: 3
- - fromlength: 3
- - fromwidth: 3
- - name: awkward_Identities64_from_ListOffsetArray64
- args:
- - toptr: List[int64_t]
- - fromptr: List[int64_t]
- - fromoffsets: List[int64_t]
- - fromptroffset: int64_t
- - offsetsoffset: int64_t
- - tolength: int64_t
- - fromlength: int64_t
- - fromwidth: int64_t
- tests:
- - success:
- inparam:
- - fromptr: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
- - fromoffsets: [0, 2, 1, 1, 1, 1, 2, 0, 1, 2]
- - fromptroffset: 0
- - offsetsoffset: 1
- - tolength: 3
- - fromlength: 3
- - fromwidth: 3
- outparam:
- - toptr: [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
- - failure:
- inparam:
- - fromptr: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
- - fromoffsets: [0, 2, 5, 1, 1, 1, 2, 0, 1, 2]
- - fromptroffset: 0
- - offsetsoffset: 1
- - tolength: 3
- - fromlength: 3
- - fromwidth: 3
- - name: awkward_Identities64_from_ListOffsetArrayU32
- args:
- - toptr: List[int64_t]
- - fromptr: List[int64_t]
- - fromoffsets: List[uint32_t]
- - fromptroffset: int64_t
- - offsetsoffset: int64_t
- - tolength: int64_t
- - fromlength: int64_t
- - fromwidth: int64_t
- tests:
- - success:
- inparam:
- - fromptr: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
- - fromoffsets: [0, 2, 1, 1, 1, 1, 2, 0, 1, 2]
- - fromptroffset: 0
- - offsetsoffset: 1
- - tolength: 3
- - fromlength: 3
- - fromwidth: 3
- outparam:
- - toptr: [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
- - failure:
- inparam:
- - fromptr: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
- - fromoffsets: [0, 2, 5, 1, 1, 1, 2, 0, 1, 2]
- - fromptroffset: 0
- - offsetsoffset: 1
- - tolength: 3
- - fromlength: 3
- - fromwidth: 3
- specification: |
- def awkward_Identities_from_ListOffsetArray(
- toptr,
- fromptr,
- fromoffsets,
- fromptroffset,
- offsetsoffset,
- tolength,
- fromlength,
- fromwidth,
- ):
- globalstart = fromoffsets[offsetsoffset]
- globalstop = fromoffsets[offsetsoffset + fromlength]
- for k in range(globalstart * (fromwidth + 1)):
- toptr[k] = -1
- k = globalstop * (fromwidth + 1)
- while k < (tolength * (fromwidth + 1)):
- toptr[k] = -1
- k = k + 1
- for i in range(fromlength):
- start = fromoffsets[offsetsoffset + i]
- stop = fromoffsets[(offsetsoffset + i) + 1]
- if (start != stop) and (stop > tolength):
- raise ValueError("max(stop) > len(content)")
- for j in range(start, stop):
- for k in range(fromwidth):
- toptr[(j * (fromwidth + 1)) + k] = fromptr[
- (fromptroffset + (i * fromwidth)) + k
- ]
- toptr[(j * (fromwidth + 1)) + fromwidth] = float(j - start)
Advertisement
Add Comment
Please, Sign In to add comment