DoubleDataLayout
Stay organized with collections
Save and categorize content based on your preferences.
A DataLayout
that converts data stored in a buffer to doubles.
Public Methods
abstract
DoubleDataBuffer
|
applyTo(S buffer)
Apply this layout to the provided buffer.
|
abstract
double
|
readDouble(S buffer, long index)
Reads n = scale() buffer values at the given index and return them as a double.
|
abstract
Double
|
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
|
writeDouble(S buffer, double value, long index)
Writes a double 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<Double>
|
applyTo(S buffer)
Apply this layout to the provided buffer.
|
abstract
Double
|
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, Double 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
DoubleDataBuffer
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
double
readDouble
(S buffer, long index)
Reads n = scale()
buffer values at the given index and return them as a double.
Parameters
buffer |
the buffer to read from |
index |
position of the buffer to read in the buffer |
public
abstract
Double
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
writeDouble
(S buffer, double value, long index)
Writes a double into the buffer at the given index after converting it to the buffer type.
Parameters
buffer |
the buffer to write to |
value |
the double to convert and write |
index |
index in the buffer where the converted value should be written |
public
abstract
void
writeObject
(S buffer, Double 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,["# DoubleDataLayout\n\npublic interface **DoubleDataLayout** \nA [DataLayout](/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/DataLayout) that converts data stored in a buffer to doubles. \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 [DoubleDataBuffer](/jvm/api_docs/java/org/tensorflow/ndarray/buffer/DoubleDataBuffer) | [applyTo](/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/DoubleDataLayout#applyTo(S))(S buffer) Apply this layout to the provided buffer. |\n| abstract double | [readDouble](/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/DoubleDataLayout#readDouble(S, long))(S buffer, long index) Reads `n = scale()` buffer values at the given index and return them as a double. |\n| abstract Double | [readObject](/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/DoubleDataLayout#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 | [writeDouble](/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/DoubleDataLayout#writeDouble(S, double, long))(S buffer, double value, long index) Writes a double 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/DoubleDataLayout#writeObject(S, java.lang.Double, long))(S buffer, Double 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)\\\u003cDouble\\\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 Double | [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, Double 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 [DoubleDataBuffer](/jvm/api_docs/java/org/tensorflow/ndarray/buffer/DoubleDataBuffer)\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 double\n**readDouble**\n(S buffer, long index)\n\nReads `n = scale()` buffer values at the given index and return them as a double. \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 double value \n\n##### See Also\n\n- [readObject(DataBuffer, long)](/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/DoubleDataLayout#readObject(S, long)) \n\n#### public abstract Double\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**writeDouble**\n(S buffer, double value, long index)\n\nWrites a double 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 double 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, Double, long)](/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/DoubleDataLayout#writeObject(S, java.lang.Double, long)) \n\n#### public abstract void\n**writeObject**\n(S buffer, Double value, long index)\n\n\u003cbr /\u003e"]]