Skip to content

Add an addition to the spec to support 1-indexed memory #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions spec/latest/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ with a value as a *stored value*. Stored values have associated with them a
or more *indices*, which describe the location where the stored value is located
in the array. Some or all of these indices may be stored explicitly, or they may
be implicitly derived, depending on storage format. When stored explicitly,
indices are 0-based positive integers.

indices are 0-based positive integers.

Binsparse JSON Descriptors {#descriptor}
========================================
Expand Down Expand Up @@ -117,6 +116,14 @@ boolean value. If the value is true, it signifies the presence of a `fill_value`
array, whose single element defines the value at indices not specified
by the sparse tensor structure.

Index Base {#key_base}
----------------------

The `index_base` key allows the programmer to specify whether the indices are
base 0 or base 1. If not present, this key defaults to 0. When `index_base` is
1, all `indices_*` and `pointers_to_*` should have values one greater than
currently defined in this spec.

Format {#key_format}
--------------------

Expand Down Expand Up @@ -378,7 +385,13 @@ present:
:: Array of size `number_of_positions + 1` whose 1st element is equal to `0` and whose `p + 1`th element is equal to the sum of `pointers_to_(N - n)[p]` and the number of explicitly represented slices in the `p`th position.

: indices_(N - n), ..., indices(N - n + r - 1)
:: There are `r` such arrays. When `A[i_0, ..., i_(r - 1), :, ..., :]` is explicitly represented by the subarray in position `q`, `indices_(N-n+s)[q] = i_s`. The arrays must be ordered such that the tuples `(indices_(N-n)[q], ..., indices_(N-n+r-1)[q])` are unique and appear in lexicographic order for all `q` in each range `pointers_to_(N-n)[p] <= q < pointers_to_(N-n)[p + 1]`. This array must contain no other elements.
:: There are `r` such arrays. When `A[i_0, ..., i_(r - 1), :, ..., :]` is explicitly represented by the subarray in position `q`, `indices_(N-n+s)[q] = i_s`. The tuples `(indices_(N-n)[q], ..., indices_(N-n+r-1)[q])` must be unique for all `q` in each range `pointers_to_(N-n)[p] <= q < pointers_to_(N-n)[p + 1]`. This array must contain no other elements.

If the `sorted` key is present, it's Boolean value may be used to indicate
whether the tuples `(indices_(N-n)[q], ..., indices_(N-n+r-1)[q])` appear in
lexicographic order for all `q` in each range `pointers_to_(N-n)[p] <= q <
pointers_to_(N-n)[p + 1]`. If the `sorted` key is not present, the tuples are
assumed to be sorted.

Special note: If the sparse level is the root level, the `pointers` array should
be ommitted, as its first value will be `0` and its last value will be the
Expand Down