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>
출력 ()
텐서의 기호 핸들을 반환합니다.
static <T는 Tnumber를 확장합니다. > 반전 <T>
생성 ( 범위 범위 , 피연산자 <T> x)
새로운 반전 작업을 래핑하는 클래스를 생성하는 팩토리 메서드입니다.
출력 <T>
와이 ()

상속된 메서드

org.tensorflow.op.RawOp 클래스에서
최종 부울
같음 (객체 객체)
최종 정수
작업
op ()
이 계산 단위를 단일 Operation 으로 반환합니다.
최종 문자열
부울
같음 (개체 arg0)
마지막 수업<?>
getClass ()
정수
해시코드 ()
최종 무효
알림 ()
최종 무효
통지모두 ()
toString ()
최종 무효
대기 (long arg0, int arg1)
최종 무효
기다리세요 (긴 arg0)
최종 무효
기다리다 ()
org.tensorflow.op.Op 에서
추상 실행환경
환경 ()
이 작업이 생성된 실행 환경을 반환합니다.
추상적인 작업
op ()
이 계산 단위를 단일 Operation 으로 반환합니다.
org.tensorflow.Operand 에서
추상 출력 <T>
출력 ()
텐서의 기호 핸들을 반환합니다.
추상 T
텐서 ()
이 피연산자의 텐서를 반환합니다.
추상 모양
모양 ()
이 피연산자의 Output 에서 ​​참조하는 텐서의 (아마도 부분적으로 알려진) 모양을 반환합니다.
추상 클래스<T>
유형 ()
이 피연산자의 텐서 유형을 반환합니다.
org.tensorflow.ndarray.Shaped 에서
추상 정수
순위 ()
추상 모양
모양 ()
추상적인 긴
사이즈 ()
이 컨테이너의 전체 크기를 값 개수로 계산하고 반환합니다.

상수

공개 정적 최종 문자열 OP_NAME

TensorFlow 코어 엔진에서 알려진 이 작업의 이름

상수 값: "반전"

공개 방법

공개 출력 <T> asOutput ()

텐서의 기호 핸들을 반환합니다.

TensorFlow 작업에 대한 입력은 다른 TensorFlow 작업의 출력입니다. 이 메서드는 입력 계산을 나타내는 기호 핸들을 얻는 데 사용됩니다.

public static Invert <T> create ( 범위 범위, 피연산자 <T> x)

새로운 반전 작업을 래핑하는 클래스를 생성하는 팩토리 메서드입니다.

매개변수
범위 현재 범위
보고
  • Invert의 새로운 인스턴스

공개 출력 <T> y ()