Python - Tensorflow bitwise.left_shift() method Last Updated : 04 Jun, 2020 Comments Improve Suggest changes Like Article Like Report Tensorflow bitwise.left_shift() method performs the left_shift operation on input a defined by input b and return the new constant. The operation is done on the representation of a and b. This method belongs to bitwise module. Syntax: tf.bitwise.left_shift( a, b, name=None) Arguments a: This must be a Tensor.It should be from the one of the following types: int8, int16, int32, int64, uint8, uint16, uint32, uint64. b: This should also be a Tensor, Type same as a. name: This is optional parameter and this is the name of the operation. Return: It returns a Tensor having the same type as a and b. Let's see this concept with the help of few examples: Example 1: Python3 import tensorflow as tf # A constant a and b a = tf.constant(8, dtype = tf.int32) b = tf.constant(2, dtype = tf.int32) # Applying the left_shift() function # storing the result in 'c' c = tf.bitwise.left_shift(a, b) # Initiating a Tensorflow session with tf.Session() as sess: print("Input 1", a) print(sess.run(a)) print("Input 2", b) print(sess.run(b)) print("Output: ", c) print(sess.run(c)) Output: Input 1 Tensor("Const_49:0", shape=(), dtype=int32) 8 Input 2 Tensor("Const_50:0", shape=(), dtype=int32) 2 Output: Tensor("LeftShift_1:0", shape=(), dtype=int32) 32 Example 2: Python3 import tensorflow as tf # A constant a and b a = tf.constant([8, 16, 32], dtype = tf.int32) b = tf.constant([2, 2, 3], dtype = tf.int32) # Applying the left_shift() function # storing the result in 'c' c = tf.bitwise.left_shift(a, b) # Initiating a Tensorflow session with tf.Session() as sess: print("Input 1", a) print(sess.run(a)) print("Input 2", b) print(sess.run(b)) print("Output: ", c) print(sess.run(c)) Output: Input 1 Tensor("Const_51:0", shape=(3, ), dtype=int32) [ 8 16 32] Input 2 Tensor("Const_52:0", shape=(3, ), dtype=int32) [2 2 3] Output: Tensor("LeftShift_2:0", shape=(3, ), dtype=int32) [ 32 64 256] Comment More infoAdvertise with us Next Article Must Do Coding Questions - Topic-wise P PranchalKatiyar Follow Improve Article Tags : Python Tensorflow Python-Tensorflow Practice Tags : python Similar Reads Interview PreparationInterview Preparation For Software DevelopersMust Coding Questions - Company-wise Must Do Coding Questions - Topic-wiseCompany-wise Practice ProblemsCompany PreparationCompetitive ProgrammingSoftware Design-PatternsCompany-wise Interview ExperienceExperienced - Interview ExperiencesInternship - Interview ExperiencesPractice @GeeksforgeeksProblem of the DayTopic-wise PracticeDifficulty Level - SchoolDifficulty Level - BasicDifficulty Level - EasyDifficulty Level - MediumDifficulty Level - HardLeaderboard !!Explore More...Data StructuresArraysLinked ListStackQueueBinary TreeBinary Search TreeHeapHashingGraphAdvance Data StructuresMatrixStringAll Data StructuresAlgorithmsAnalysis of AlgorithmsSearching AlgorithmsSorting AlgorithmsPattern SearchingGeometric AlgorithmsMathematical AlgorithmsRandomized AlgorithmsGreedy AlgorithmsDynamic ProgrammingDivide & ConquerBacktrackingBranch & BoundAll AlgorithmsProgramming LanguagesCC++JavaPythonC#Go LangSQLPHPScalaPerlKotlinWeb TechnologiesHTMLCSSJavaScriptBootstrapTailwind CSSAngularJSReactJSjQueryNodeJSPHPWeb DesignWeb BrowserFile FormatsComputer Science SubjectsOperating SystemsDBMSComputer NetworkComputer Organization & ArchitectureTOCCompiler DesignDigital Elec. & Logic DesignSoftware EngineeringEngineering MathematicsData Science & MLComplete Data Science CourseData Science TutorialMachine Learning TutorialDeep Learning TutorialNLP TutorialMachine Learning ProjectsData Analysis TutorialTutorial LibraryPython TutorialDjango TutorialPandas TutorialKivy TutorialTkinter TutorialOpenCV TutorialSelenium TutorialGATE CSGATE CS NotesGate CornerPrevious Year GATE PapersLast Minute Notes (LMNs)Important Topic For GATE CSGATE CoursePrevious Year Paper: CS exams Like