Tensorflow.js tf.layers.repeatVector() Function Last Updated : 31 May, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report Tensorflow.js is an open-source library developed by Google for running machine learning models and deep learning neural networks in the browser or node environment. The tf.layers.repeatVector() function is used to repeat the input n number of times in a new specified dimension. It is an inbuilt function of TensorFlow's.js library. Syntax: tf.layers.repeatVector(n) Parameters: n: Integer, specifying the number of times the input will be repeated. Return value: It returns the tf.layers.Layer Example 1: JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" // Create a new model const model = tf.sequential(); // Add repeatVector layer to the model model.add(tf.layers.repeatVector({ n: 5, inputShape: [2]} )); const x = tf.tensor2d([[10, 15]]); console.log(model.predict(x).shape) Output: 1, 5, 2 Example 2: JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" // Create a new model const model = tf.sequential(); // Add repeatVector layer to the model model.add(tf.layers.repeatVector( {n: 8, inputShape: [2]} )); const x = tf.tensor2d([[0,1]]); model.predict(x).print(); Output: Tensor [[[0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1]]] Reference: https://js.tensorflow.org/api/latest/#layers.repeatVector Comment More infoAdvertise with us Next Article Tensorflow.js tf.layers.repeatVector() Function S sahilkumar101 Follow Improve Article Tags : JavaScript Web Technologies Tensorflow.js Similar Reads Tensorflow.js tf.layers.reshape() Function Tensorflow.js is an open-source library that is being developed by Google for running machine learning models as well as deep learning neural networks in the browser or node environment. The tf.layers.reshape() function is used to Reshape an input to a certain shape. Syntax: tf.layers.reshape(args) 2 min read Tensorflow.js tf.layers.reLU() Function Tensorflow.js is a Google-developed open-source toolkit for executing machine learning models and deep learning neural networks in the browser or on the node platform. It also enables developers to create machine learning models in JavaScript and utilize them directly in the browser or with Node.js. 2 min read Tensorflow.js tf.layers.separableConv2d() Function Tensorflow.js is an open-source library developed by Google for running machine learning models and deep learning neural networks in the browser or node environment. It also helps the developers to develop ML models in JavaScript language and can use ML directly in the browser or in Node.js. The tf. 4 min read Tensorflow.js tf.layers.multiply() Function Tensorflow.js is an open-source library developed by Google for running machine learning models and deep learning neural networks in the browser or node environment. The tf.layers.multiply() function is used to perform element-wise multiplication of an array of inputs. Syntax: tf.layers.multiply() P 2 min read Tensorflow.js tf.layers.gru() Function Tensorflow.js is an open-source library developed by Google for running machine learning models and deep learning neural networks in the browser or node environment. Tensorflow.js tf.layers.gru() function is used to create a RNN layer which consists of only one GRUCell and the apply method of this l 2 min read Like