tf.bitcast(input, type, name=None)
See the guide: Tensor Transformations > Casting
Bitcasts a tensor from one type to another without copying data.
Given a tensor input
, this operation returns a tensor that has the same buffer data as input
with datatype type
.
If the input datatype T
is larger than the output datatype type
then the shape changes from [...] to [..., sizeof(T
)/sizeof(type
)].
If T
is smaller than type
, the operator requires that the rightmost dimension be equal to sizeof(type
)/sizeof(T
). The shape then goes from [..., sizeof(type
)/sizeof(T
)] to [...].
NOTE: Bitcast is implemented as a low-level cast, so machines with different endian orderings will give different results.
input
: A Tensor
. Must be one of the following types: float32
, float64
, int64
, int32
, uint8
, uint16
, int16
, int8
, complex64
, complex128
, qint8
, quint8
, qint32
, half
.type
: A tf.DType
from: tf.float32, tf.float64, tf.int64, tf.int32, tf.uint8, tf.uint16, tf.int16, tf.int8, tf.complex64, tf.complex128, tf.qint8, tf.quint8, tf.qint32, tf.half
.name
: A name for the operation (optional).A Tensor
of type type
.
Defined in tensorflow/python/ops/gen_array_ops.py
.
© 2017 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/bitcast