Module org.tensorflow.ndarray
Class DataBufferAdapterFactory
- java.lang.Object
-
- org.tensorflow.ndarray.impl.buffer.adapter.DataBufferAdapterFactory
-
public class DataBufferAdapterFactory extends Object
Factory of data buffer adapters.Data buffer adapters are used to apply a
DataLayoutto a buffer. Conceptually, they act as a proxy that intercept each I/O call and perform the required type conversions after/before delegating the task to the underlying buffer.
-
-
Constructor Summary
Constructors Constructor Description DataBufferAdapterFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <S extends DataBuffer<?>>
BooleanDataBuffercreate(S buffer, BooleanDataLayout<S> layout)Creates an adapter that applies a boolean data layout to the given buffer.static <S extends DataBuffer<?>>
ByteDataBuffercreate(S buffer, ByteDataLayout<S> layout)Creates an adapter that applies a byte data layout to the given buffer.static <S extends DataBuffer<?>,T>
DataBuffer<T>create(S buffer, DataLayout<S,T> layout)Creates an adapter that applies a data layout to the given buffer.static <S extends DataBuffer<?>>
DoubleDataBuffercreate(S buffer, DoubleDataLayout<S> layout)Creates an adapter that applies a double data layout to the given buffer.static <S extends DataBuffer<?>>
FloatDataBuffercreate(S buffer, FloatDataLayout<S> layout)Creates an adapter that applies a float data layout to the given buffer.static <S extends DataBuffer<?>>
IntDataBuffercreate(S buffer, IntDataLayout<S> layout)Creates an adapter that applies a integer data layout to the given buffer.static <S extends DataBuffer<?>>
LongDataBuffercreate(S buffer, LongDataLayout<S> layout)Creates an adapter that applies a long data layout to the given buffer.static <S extends DataBuffer<?>>
ShortDataBuffercreate(S buffer, ShortDataLayout<S> layout)Creates an adapter that applies a short data layout to the given buffer.
-
-
-
Method Detail
-
create
public static <S extends DataBuffer<?>> ByteDataBuffer create(S buffer, ByteDataLayout<S> layout)
Creates an adapter that applies a byte data layout to the given buffer.- Type Parameters:
S- the type of the buffer- Parameters:
buffer- the delegate bufferlayout- layout to apply- Returns:
- buffer adapter
-
create
public static <S extends DataBuffer<?>> BooleanDataBuffer create(S buffer, BooleanDataLayout<S> layout)
Creates an adapter that applies a boolean data layout to the given buffer.- Type Parameters:
S- the type of the buffer- Parameters:
buffer- the delegate bufferlayout- layout to apply- Returns:
- buffer adapter
-
create
public static <S extends DataBuffer<?>> DoubleDataBuffer create(S buffer, DoubleDataLayout<S> layout)
Creates an adapter that applies a double data layout to the given buffer.- Type Parameters:
S- the type of the buffer- Parameters:
buffer- the delegate bufferlayout- layout to apply- Returns:
- buffer adapter
-
create
public static <S extends DataBuffer<?>> FloatDataBuffer create(S buffer, FloatDataLayout<S> layout)
Creates an adapter that applies a float data layout to the given buffer.- Type Parameters:
S- the type of the buffer- Parameters:
buffer- the delegate bufferlayout- layout to apply- Returns:
- buffer adapter
-
create
public static <S extends DataBuffer<?>> IntDataBuffer create(S buffer, IntDataLayout<S> layout)
Creates an adapter that applies a integer data layout to the given buffer.- Type Parameters:
S- the type of the buffer- Parameters:
buffer- the delegate bufferlayout- layout to apply- Returns:
- buffer adapter
-
create
public static <S extends DataBuffer<?>> LongDataBuffer create(S buffer, LongDataLayout<S> layout)
Creates an adapter that applies a long data layout to the given buffer.- Type Parameters:
S- the type of the buffer- Parameters:
buffer- the delegate bufferlayout- layout to apply- Returns:
- buffer adapter
-
create
public static <S extends DataBuffer<?>> ShortDataBuffer create(S buffer, ShortDataLayout<S> layout)
Creates an adapter that applies a short data layout to the given buffer.- Type Parameters:
S- the type of the buffer- Parameters:
buffer- the delegate bufferlayout- layout to apply- Returns:
- buffer adapter
-
create
public static <S extends DataBuffer<?>,T> DataBuffer<T> create(S buffer, DataLayout<S,T> layout)
Creates an adapter that applies a data layout to the given buffer.- Type Parameters:
S- the type of the bufferT- the type of data returned by the layout- Parameters:
buffer- the delegate bufferlayout- layout to apply- Returns:
- buffer adapter
-
-