IntDataLayout
Stay organized with collections
Save and categorize content based on your preferences.
A DataLayout
that converts data stored in a buffer to ints.
Public Methods
abstract
IntDataBuffer
|
applyTo(S buffer)
Apply this layout to the provided buffer.
|
abstract
int
|
readInt(S buffer, long index)
Reads n = scale() values from the buffer at the given index and return them as an int.
|
abstract
Integer
|
readObject(S buffer, long index)
Reads n = scale() values from the buffer at the given index and return them as a single
value in the user type.
|
abstract
void
|
writeInt(S buffer, int value, long index)
Writes a int into the buffer at the given index after converting it to the buffer type.
|
abstract
void
|
|
Inherited Methods
From interface
org.tensorflow.ndarray.buffer.layout.DataLayout
abstract
DataBuffer<Integer>
|
applyTo(S buffer)
Apply this layout to the provided buffer.
|
abstract
Integer
|
readObject(S buffer, long index)
Reads n = scale() values from the buffer at the given index and return them as a single
value in the user type.
|
abstract
int
|
scale()
Indicates the number of buffer values are required to represent a single user value, default is 1.
|
abstract
void
|
writeObject(S buffer, Integer value, long index)
Writes a user value into the buffer at the given index after converting it to the buffer type.
|
Public Methods
public
abstract
IntDataBuffer
applyTo
(S buffer)
Apply this layout to the provided buffer.
The returned DataBuffer
instance is simply a wrapper to the original buffer and does
not have a backing storage of his own.
Parameters
buffer |
the target buffer to apply this layout to |
Returns
- a buffer with this layout
public
abstract
int
readInt
(S buffer, long index)
Reads n = scale()
values from the buffer at the given index and return them as an int.
Parameters
buffer |
the buffer to read from |
index |
position of the buffer to read in the buffer |
public
abstract
Integer
readObject
(S buffer, long index)
Reads n = scale()
values from the buffer at the given index and return them as a single
value in the user type.
It is the responsibility of the implementors of this interface to read the value to be
converted from the given buffer, using the most appropriate method. For example, for a layout
that converting a single long
to a BigInteger
,
@Override
public BigInteger readObject(LongDataBuffer buffer, long index) {
return BigInteger.valueOf(buffer.getLong(index));
}
If a single user value scales over more than one buffer values,
index
indicates the
starting position of the sequence to be read from the buffer.
Parameters
buffer |
the buffer to read from |
index |
position of the buffer to read in the buffer |
public
abstract
void
writeInt
(S buffer, int value, long index)
Writes a int into the buffer at the given index after converting it to the buffer type.
Parameters
buffer |
the buffer to write to |
value |
the int to convert and write |
index |
index in the buffer where the converted value should be written |
public
abstract
void
writeObject
(S buffer, Integer value, long index)
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2021-11-29 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2021-11-29 UTC."],[],[],null,["# IntDataLayout\n\npublic interface **IntDataLayout** \nA [DataLayout](/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/DataLayout) that converts data stored in a buffer to ints. \n\n##### See Also\n\n- [DataLayout](/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/DataLayout) \n\n### Public Methods\n\n|------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [IntDataBuffer](/jvm/api_docs/java/org/tensorflow/ndarray/buffer/IntDataBuffer) | [applyTo](/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/IntDataLayout#applyTo(S))(S buffer) Apply this layout to the provided buffer. |\n| abstract int | [readInt](/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/IntDataLayout#readInt(S, long))(S buffer, long index) Reads `n = scale()` values from the buffer at the given index and return them as an int. |\n| abstract Integer | [readObject](/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/IntDataLayout#readObject(S, long))(S buffer, long index) Reads `n = scale()` values from the buffer at the given index and return them as a single value in the user type. |\n| abstract void | [writeInt](/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/IntDataLayout#writeInt(S, int, long))(S buffer, int value, long index) Writes a int into the buffer at the given index after converting it to the buffer type. |\n| abstract void | [writeObject](/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/IntDataLayout#writeObject(S, java.lang.Integer, long))(S buffer, Integer value, long index) |\n\n### Inherited Methods\n\nFrom interface [org.tensorflow.ndarray.buffer.layout.DataLayout](/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/DataLayout) \n\n|-----------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [DataBuffer](/jvm/api_docs/java/org/tensorflow/ndarray/buffer/DataBuffer)\\\u003cInteger\\\u003e | [applyTo](/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/DataLayout#applyTo(S))(S buffer) Apply this layout to the provided buffer. |\n| abstract Integer | [readObject](/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/DataLayout#readObject(S, long))(S buffer, long index) Reads `n = scale()` values from the buffer at the given index and return them as a single value in the user type. |\n| abstract int | [scale](/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/DataLayout#scale())() Indicates the number of buffer values are required to represent a single user value, default is 1. |\n| abstract void | [writeObject](/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/DataLayout#writeObject(S, T, long))(S buffer, Integer value, long index) Writes a user value into the buffer at the given index after converting it to the buffer type. |\n\nPublic Methods\n--------------\n\n#### public abstract [IntDataBuffer](/jvm/api_docs/java/org/tensorflow/ndarray/buffer/IntDataBuffer)\n**applyTo**\n(S buffer)\n\nApply this layout to the provided buffer.\n\nThe returned [DataBuffer](/jvm/api_docs/java/org/tensorflow/ndarray/buffer/DataBuffer) instance is simply a wrapper to the original buffer and does\nnot have a backing storage of his own.\n\n\u003cbr /\u003e\n\n##### Parameters\n\n| buffer | the target buffer to apply this layout to |\n|--------|-------------------------------------------|\n\n##### Returns\n\n- a buffer with this layout \n\n#### public abstract int\n**readInt**\n(S buffer, long index)\n\nReads `n = scale()` values from the buffer at the given index and return them as an int. \n\n##### Parameters\n\n| buffer | the buffer to read from |\n| index | position of the buffer to read in the buffer |\n|--------|----------------------------------------------|\n\n##### Returns\n\n- the int value \n\n##### See Also\n\n- [readObject(DataBuffer, long)](/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/IntDataLayout#readObject(S, long)) \n\n#### public abstract Integer\n**readObject**\n(S buffer, long index)\n\nReads `n = scale()` values from the buffer at the given index and return them as a single\nvalue in the user type.\n\nIt is the responsibility of the implementors of this interface to read the value to be\nconverted from the given buffer, using the most appropriate method. For example, for a layout\nthat converting a single `long` to a `BigInteger`, \n\n```\n @Override\n public BigInteger readObject(LongDataBuffer buffer, long index) {\n return BigInteger.valueOf(buffer.getLong(index));\n }\n \n```\nIf a single user value scales over more than one buffer values, `index` indicates the starting position of the sequence to be read from the buffer.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n##### Parameters\n\n| buffer | the buffer to read from |\n| index | position of the buffer to read in the buffer |\n|--------|----------------------------------------------|\n\n##### Returns\n\n- the converted value \n\n#### public abstract void\n**writeInt**\n(S buffer, int value, long index)\n\nWrites a int into the buffer at the given index after converting it to the buffer type. \n\n##### Parameters\n\n| buffer | the buffer to write to |\n| value | the int to convert and write |\n| index | index in the buffer where the converted value should be written |\n|--------|-----------------------------------------------------------------|\n\n##### See Also\n\n- [writeObject(DataBuffer, Integer, long)](/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/IntDataLayout#writeObject(S, java.lang.Integer, long)) \n\n#### public abstract void\n**writeObject**\n(S buffer, Integer value, long index)\n\n\u003cbr /\u003e"]]