Fix off-by-one error in the documentation of the string tensor representation:

the offset for the length of the whole char buffer is N+1 ints, not N+2.

Also a small change to the docs to clarify that the per-string part is repeated,
and that i ranges from 0 to N-1 (not from 1 to N).

PiperOrigin-RevId: 327831873
Change-Id: I01e325f616980770e3c9ed9318e1da34f52d3344
This commit is contained in:
Fergus Henderson 2020-08-21 10:26:59 -07:00 committed by TensorFlower Gardener
parent 5add3089e8
commit 23ddb02643

View File

@ -16,8 +16,9 @@ limitations under the License.
// Util methods to read and write String tensors.
// String tensors are considered to be char tensor with protocol.
// [0, 3] 4 bytes: N, num of strings in the tensor in little endian.
// [(i+1)*4, (i+1)*4+3] 4 bytes: offset of i-th string in little endian.
// [(N+2)*4, (N+2)*4+3] 4 bytes: length of the whole char buffer.
// [(i+1)*4, (i+1)*4+3] 4 bytes: offset of i-th string in little endian,
// for i from 0 to N-1.
// [(N+1)*4, (N+1)*4+3] 4 bytes: length of the whole char buffer.
// [offset(i), offset(i+1) - 1] : content of i-th string.
// Example of a string tensor:
// [