RawTensor
Stay organized with collections
Save and categorize content based on your preferences.
A tensor which memory has not been mapped to a data space directly accessible from the JVM.
A raw tensor is a minimalist representation of a tensor allocated in native memory by the
TensorFlow runtime library and it controls its lifetime within the current process. The data
is represented by a flat buffer of bytes
, until it is mapped in a
n-dimensional typed space by a typed tensor
.
Instances of a RawTensor are not thread-safe and their resource must be released
by calling close()
explicitly or implicitly via try-with-resources.
Public Methods
RawTensor
|
asRawTensor()
Returns a raw (untyped) representation of this tensor
|
void
|
close()
Release resources associated with the Tensor.
|
ByteDataBuffer
|
data()
Returns the raw data of this tensor as a buffer of bytes.
|
DataType
|
|
long
|
numBytes()
Returns the size, in bytes, of the tensor data.
|
Shape
|
shape()
Returns the shape of the tensor.
|
String
|
toString()
Returns a string describing the type and shape of the tensor.
|
Inherited Methods
From class
java.lang.Object
boolean
|
equals(Object arg0)
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
From interface
org.tensorflow.Tensor
abstract
RawTensor
|
asRawTensor()
Returns a raw (untyped) representation of this tensor
|
abstract
void
|
close()
Release resources associated with the Tensor.
|
abstract
DataType
|
|
abstract
long
|
numBytes()
Returns the size, in bytes, of the tensor data.
|
abstract
static
<T extends TType>
T
|
of(Class<T> type, Shape shape, long size, Consumer<T> dataInitializer)
Allocates a tensor of a given datatype, shape and size.
|
abstract
static
<T extends TType>
T
|
of(Class<T> type, Shape shape)
Allocates a tensor of a given datatype and shape.
|
abstract
static
<T extends TType>
T
|
of(Class<T> type, Shape shape, long size)
Allocates a tensor of a given datatype, shape and size.
|
abstract
static
<T extends TType>
T
|
of(Class<T> type, Shape shape, Consumer<T> dataInitializer)
Allocates and initialize a tensor of a given datatype and shape.
|
abstract
static
<T extends TType>
T
|
of(Class<T> type, Shape shape, ByteDataBuffer rawData)
Creates a Tensor of any type from the raw data provided by the given buffer.
|
abstract
Shape
|
shape()
Returns the shape of the tensor.
|
From interface
java.lang.AutoCloseable
Public Methods
public
RawTensor
asRawTensor
()
Returns a raw (untyped) representation of this tensor
public
void
close
()
Release resources associated with the Tensor.
WARNING:This must be invoked for all tensors that were not been produced by an eager
operation or memory will be leaked.
The Tensor object is no longer usable after close
returns.
Returns the raw data of this tensor as a buffer of bytes.
Throws
IllegalStateException |
if the tensor has been closed
|
public
DataType
dataType
()
Returns the DataType
of elements stored in the tensor.
public
long
numBytes
()
Returns the size, in bytes, of the tensor data.
public
Shape
shape
()
Returns the shape of the tensor.
public
String
toString
()
Returns a string describing the type and shape of the tensor.
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."],[],[]]