Invert

パブリック最終クラスの反転

サポートされているタイプの各ビットを反転 (反転) します。たとえば、「uint8」型の値 01010101 は 10101010 になります。

サポートされている型の各ビットを反転します。たとえば、型 `int8` (10 進数 2) バイナリ 00000010 は、(10 進数 -3) バイナリ 11111101 になります。この演算は、テンソル引数 `x` の各要素に対して実行されます。

例:

import tensorflow as tf
 from tensorflow.python.ops import bitwise_ops
 
 # flip 2 (00000010) to -3 (11111101)
 tf.assert_equal(-3, bitwise_ops.invert(2))
 
 dtype_list = [dtypes.int8, dtypes.int16, dtypes.int32, dtypes.int64,
               dtypes.uint8, dtypes.uint16, dtypes.uint32, dtypes.uint64]
 
 inputs = [0, 5, 3, 14]
 for dtype in dtype_list:
   # Because of issues with negative numbers, let's test this indirectly.
   # 1. invert(a) and a = 0
   # 2. invert(a) or a = invert(0)
   input_tensor = tf.constant([0, 5, 3, 14], dtype=dtype)
   not_a_and_a, not_a_or_a, not_0 = [bitwise_ops.bitwise_and(
                                       input_tensor, bitwise_ops.invert(input_tensor)),
                                     bitwise_ops.bitwise_or(
                                       input_tensor, bitwise_ops.invert(input_tensor)),
                                     bitwise_ops.invert(
                                       tf.constant(0, dtype=dtype))]
 
   expected = tf.constant([0, 0, 0, 0], dtype=tf.float32)
   tf.assert_equal(tf.cast(not_a_and_a, tf.float32), expected)
 
   expected = tf.cast([not_0] * 4, tf.float32)
   tf.assert_equal(tf.cast(not_a_or_a, tf.float32), expected)
 
   # For unsigned dtypes let's also check the result directly.
   if dtype.is_unsigned:
     inverted = bitwise_ops.invert(input_tensor)
     expected = tf.constant([dtype.max - x for x in inputs], dtype=tf.float32)
     tf.assert_equal(tf.cast(inverted, tf.float32), tf.cast(expected, tf.float32))
 

定数

OP_NAME TensorFlow コア エンジンによって認識される、この演算の名前

パブリックメソッド

出力<T>
asOutput ()
テンソルのシンボリック ハンドルを返します。
static <T extends TNumber >反転<T>
create (スコープscope,オペランド<T> x)
新しい Invert 操作をラップするクラスを作成するファクトリ メソッド。
出力<T>
y ()

継承されたメソッド

定数

パブリック静的最終文字列OP_NAME

TensorFlow コア エンジンによって認識される、この演算の名前

定数値: 「反転」

パブリックメソッド

public Output <T> asOutput ()

テンソルのシンボリック ハンドルを返します。

TensorFlow オペレーションへの入力は、別の TensorFlow オペレーションの出力です。このメソッドは、入力の計算を表すシンボリック ハンドルを取得するために使用されます。

public static Invert <T> create (スコープscope、オペランド<T> x)

新しい Invert 操作をラップするクラスを作成するファクトリ メソッド。

パラメーター
範囲現在のスコープ
戻り値
  • Invert の新しいインスタンス

public出力<T> y ()