View source on GitHub |
Convert a NumPy array to a tensor.
tf.keras.ops.convert_to_tensor(
x, dtype=None, sparse=None
)
Returns | |
---|---|
A tensor of the specified dtype .
|
Example:
x = np.array([1, 2, 3])
y = keras.ops.convert_to_tensor(x)