tensorflow :: ops :: Bitcast

#include <array_ops.h>

Bit, verileri kopyalamadan bir türden diğerine bir tensör yayınlar.

Özet

Bir tensör input verildiğinde, bu işlem, veri türü type input aynı arabellek verisine sahip bir tensör döndürür.

Girdi veri türü T , çıktı veri türü type daha büyükse, şekil [...] 'den [..., sizeof ( T ) / sizeof ( type )]' e değişir.

Eğer T daha küçük olan type , operatör en sağdaki boyut sizeof (eşit olmasını gerektirir type ) / sizeof ( T ). Daha sonra şekil [..., sizeof ( type ) / sizeof ( T )] 'den [...]' e gider.

tf.bitcast () ve tf.cast (), gerçek dtype karmaşık bir dtype olarak dönüştürüldüğünde (örneğin tf.complex64 veya tf.complex128) farklı çalışır, çünkü tf.cast () hayali bölümü 0 yaparken tf.bitcast () modülü verir hata. Örneğin,

Örnek 1:

a = [1., 2., 3.] equality_bitcast = tf.bitcast (a, tf.complex128) İzleme (en son çağrı): ... InvalidArgumentError: 1'den 18'e bit yayını yapılamıyor [Op: Bitcast ] equality_cast = tf.cast (a, tf.complex128) print (equality_cast) tf.Tensor ([1. + 0.j 2. + 0.j 3. + 0.j], şekil = (3,), dtype = complex128)

Örnek 2:

tf.bitcast (tf.constant (0xffffffff, dtype = tf.uint32), tf.uint8)

Örnek 3:

x = [1., 2., 3.] y = [0., 2., 3.] eşitlik = 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.], şekil = (3,), dtype = float32) baskı (eşitlik_bit yayını) tf.Tensor ([[0 0 0] [0 128 63] [0 128 63]], şekil = (3, 4), dtype = uint8)

NOT : Bitcast düşük seviyeli bir döküm olarak uygulanır, bu nedenle farklı endian sıralamalarına sahip makineler farklı sonuçlar verecektir.

Argümanlar:

  • kapsam: Bir Scope nesnesi

İadeler:

  • Output : Çıkış 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 

operator :: tensorflow :: Girdi

 operator::tensorflow::Input() const 

operator :: tensorflow :: Çıktı

 operator::tensorflow::Output() const