Bitcast
tensorflow C++ API
Bitcasts a tensor from one type to another without copying data.
Summary
Given a tensorinput, this operation returns a tensor that has the same buffer data asinputwith datatypetype. If the input datatypeTis larger than the output datatypetypethen the shape changes from [...] to [..., sizeof(T)/sizeof(type)]. IfTis smaller thantype, 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.
Arguments:
- scope: A Scope object
Returns:
Output: The output tensor.
Bitcast block
Source link :https://github.com/EXPNUNI/enuSpaceTensorflow/blob/master/enuSpaceTensorflow/tf_array_ops.cpp

Argument:
- Scope
scope: A Scope object (A scope is generated automatically each page. A scope is not connected.) - Input
input: connect Input or const shape node. (tensor object) - DataType
type: input string type name (DT_INT32, DT_UINT8, DT_UINT16, DT_INT16, DT_INT8, DT_COMPLEX64, DT_QINT8, DT_QUINT8, DT_QINT32, DT_HALF .etc)
Return:
- Output output : Output object of Bitcast class object.
Result:
- std::vector(Tensor) result_output : A
Tensorof typetype(If the input type andtypeare the same, it will have the value ofinput)
Using Method


※ input tensor의 타입을 변경해주는 역할을 한다. 다만 다른 타입으로 변경할 때 데이터는 복사 되지 않는다. 같은 타입일 경우는 데이터까지 복사된다(이럴경우 이기능이 의미가없다.).