tensorflow::ops::Bitcast

#include <array_ops.h>

Bir tensörü, verileri kopyalamadan bir türden diğerine dönüştürür.

Özet

Verilen bir tensör input , bu işlem, input aynı arabellek verilerine sahip ve veri type belirtilen bir tensör döndürür.

Giriş veri tipi T , çıkış veri type type'tan büyükse, şekil [...]'den [..., sizeof( T )/sizeof( type )]'a değişir.

Eğer T , type küçükse, operatör en sağdaki boyutun sizeof( type )/sizeof( T ) değerine eşit olmasını gerektirir. Şekil daha sonra [..., sizeof( type )/sizeof( T )] aralığından [...] aralığına gider.

`tf.bitcast()` ve `tf.cast()` fonksiyonları, gerçek veri türü karmaşık bir veri türüne (örneğin `tf.complex64` veya `tf.complex128`) dönüştürüldüğünde farklı çalışır; `tf.cast()` sanal kısmı 0 yaparken, `tf.bitcast()` modül hatası verir. Örneğin,

Örnek 1:

>>> a = [1., 2., 3.]
>>> equality_bitcast = tf.bitcast(a,tf.complex128)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot bitcast from float to complex128: shape [3] [Op:Bitcast]
>>> equality_cast = tf.cast(a,tf.complex128)
>>> print(equality_cast)
tf.Tensor([1.+0.j 2.+0.j 3.+0.j], shape=(3,), dtype=complex128)
Örnek 2:
>>> tf.bitcast(tf.constant(0xffffffff, dtype=tf.uint32), tf.uint8)
<tf.Tensor: ... shape=(4,), dtype=uint8, numpy=array([255, 255, 255, 255], dtype=uint8)>
Örnek 3:
>>> x = [1., 2., 3.]
>>> y = [0., 2., 3.]
>>> equality= tf.equal(x,y)
>>> equality_cast = tf.cast(equality,tf.float32)
>>> equality_bitcast = tf.bitcast(equality_cast,tf.uint8)
>>> print(equality)
tf.Tensor([False True True], shape=(3,), dtype=bool)
>>> print(equality_cast)
tf.Tensor([0. 1. 1.], shape=(3,), dtype=float32)
>>> print(equality_bitcast)
tf.Tensor(
[[ 0 0 0 0]
 [ 0 0 128 63]
 [ 0 0 128 63]], shape=(3, 4), dtype=uint8)

NOT : Bitcast düşük seviyeli bir dönüştürme olarak uygulandığından, farklı endian sıralamasına sahip makineler farklı sonuçlar verecektir.

Argümanlar:

İadeler:

  • Output : Çıktı tensörü.

Yapıcılar ve Yıkıcılar

Bitcast (const :: tensorflow::Scope & scope, :: tensorflow::Input input, DataType type)

Genel özellikler

operation
output

Kamusal işlevler

node () const
::tensorflow::Node *
operator::tensorflow::Input () const
operator::tensorflow::Output () const

Genel özellikler

operasyon

Operation operation

çıktı

::tensorflow::Output output

Kamusal işlevler

Bitcast

 Bitcast(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input input,
  DataType type
)

düğüm

::tensorflow::Node * node() const 

operatör::tensorflow::Giriş

 operator::tensorflow::Input() const 

operatör::tensorflow::Çıktı

 operator::tensorflow::Output() const