Elementwise calcola lo spostamento a destra bit a bit di "x" e "y".
Esegue uno spostamento logico per i tipi interi senza segno e uno spostamento aritmetico per i tipi interi con segno.
Se "y" è negativo oppure maggiore o uguale alla larghezza di "x" in bit, il risultato è definito dall'implementazione.
Esempio:
import tensorflow as tf
from tensorflow.python.ops import bitwise_ops
import numpy as np
dtype_list = [tf.int8, tf.int16, tf.int32, tf.int64]
for dtype in dtype_list:
lhs = tf.constant([-1, -5, -3, -14], dtype=dtype)
rhs = tf.constant([5, 0, 7, 11], dtype=dtype)
right_shift_result = bitwise_ops.right_shift(lhs, rhs)
print(right_shift_result)
# This will print:
# tf.Tensor([-1 -5 -1 -1], shape=(4,), dtype=int8)
# tf.Tensor([-1 -5 -1 -1], shape=(4,), dtype=int16)
# tf.Tensor([-1 -5 -1 -1], shape=(4,), dtype=int32)
# tf.Tensor([-1 -5 -1 -1], shape=(4,), dtype=int64)
lhs = np.array([-2, 64, 101, 32], dtype=np.int8)
rhs = np.array([-1, -5, -3, -14], dtype=np.int8)
bitwise_ops.right_shift(lhs, rhs)
# <tf.Tensor: shape=(4,), dtype=int8, numpy=array([ -2, 64, 101, 32], dtype=int8)>
Costanti
Corda | OP_NAME | Il nome di questa operazione, come noto al motore principale di TensorFlow |
Metodi pubblici
Uscita <T> | comeuscita () Restituisce l'handle simbolico del tensore. |
statico <T estende TNumero > RightShift <T> | |
Uscita <T> | z () |
Metodi ereditati
booleano finale | è uguale a (Oggetto oggetto) |
finale int | codicehash () |
Operazione | |
stringa finale | aStringa () |
booleano | è uguale a (Oggetto arg0) |
Classe finale<?> | getClass () |
int | codicehash () |
vuoto finale | avvisare () |
vuoto finale | notificaTutti () |
Corda | aStringa () |
vuoto finale | attendere (lungo arg0, int arg1) |
vuoto finale | aspetta (lungo arg0) |
vuoto finale | Aspettare () |
ambiente di esecuzione astratto | ambiente () Restituisce l'ambiente di esecuzione in cui è stata creata questa operazione. |
Operazione astratta |
risultato astratto <T> | comeuscita () Restituisce l'handle simbolico del tensore. |
astratto T | come tensore () Restituisce il tensore in questo operando. |
forma astratta | |
Classe astratta<T> | tipo () Restituisce il tipo tensore di questo operando |
Costanti
Stringa finale statica pubblica OP_NAME
Il nome di questa operazione, come noto al motore principale di TensorFlow
Metodi pubblici
Uscita pubblica <T> asOutput ()
Restituisce l'handle simbolico del tensore.
Gli input per le operazioni TensorFlow sono output di un'altra operazione TensorFlow. Questo metodo viene utilizzato per ottenere un handle simbolico che rappresenta il calcolo dell'input.
public static RightShift <T> create ( ambito ambito , operando <T> x, operando <T> y)
Metodo factory per creare una classe che racchiude una nuova operazione RightShift.
Parametri
portata | ambito attuale |
---|
Ritorni
- una nuova istanza di RightShift