Creates a Tensor with the given shape by copying elements from the buffer (starting from its
current position) into the tensor. For example, if shape = {2,3} (which represents a
2x3 matrix) then the buffer must have 6 elements remaining, which will be consumed by this
method.

Parameters

shape

the tensor shape.

data

a buffer containing the tensor data.

Throws

Creates a Tensor with the given shape by copying elements from the buffer (starting from its
current position) into the tensor. For example, if shape = {2,3} (which represents a
2x3 matrix) then the buffer must have 6 elements remaining, which will be consumed by this
method.

Parameters

shape

the tensor shape.

data

a buffer containing the tensor data.

Throws

Creates a Tensor with the given shape by copying elements from the buffer (starting from its
current position) into the tensor. For example, if shape = {2,3} (which represents a
2x3 matrix) then the buffer must have 6 elements remaining, which will be consumed by this
method.

Parameters

shape

the tensor shape.

data

a buffer containing the tensor data.

Throws

Creates a Tensor with the given shape by copying elements from the buffer (starting from its
current position) into the tensor. For example, if shape = {2,3} (which represents a
2x3 matrix) then the buffer must have 6 elements remaining, which will be consumed by this
method.

Parameters

shape

the tensor shape.

data

a buffer containing the tensor data.

Throws

A Tensor is a multi-dimensional array of elements of a limited set of types. Not all
Java objects can be converted to a Tensor. In particular, the argument obj must
be either a primitive (float, double, int, long, boolean, byte) or a multi-dimensional array of
one of those primitives. The argument type specifies how to interpret the first
argument as a TensorFlow type. For example: