Elementwise calcola lo spostamento a sinistra bit per bit di "x" e "y".
Se "y" è negativo o 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)
left_shift_result = bitwise_ops.left_shift(lhs, rhs)
print(left_shift_result)
# This will print:
# tf.Tensor([ -32 -5 -128 0], shape=(4,), dtype=int8)
# tf.Tensor([ -32 -5 -384 -28672], shape=(4,), dtype=int16)
# tf.Tensor([ -32 -5 -384 -28672], shape=(4,), dtype=int32)
# tf.Tensor([ -32 -5 -384 -28672], 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.left_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
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 LeftShift <T> create ( ambito ambito , operando <T> x, operando <T> y)
Metodo factory per creare una classe che racchiude una nuova operazione LeftShift.
Parametri
ambito | ambito attuale |
---|
Ritorni
- una nuova istanza di LeftShift