Tensorflow.js tf.layers.dot() 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.dot() function is used to apply the dot product between the two tensors provided.
Parameters: This function accepts the following parameters:
- args: It is the object with the following field:
- axes: It defined the axes to dot product to which way it is going.
- normalize: It is boolean data used to produce the answer of the dot product in cosine value form.
- inputShape: It defines the shape of the input layer of the model. It is used in the creation of the input layer.
- dtype: it is the data-type of the layer. It is used for the first layer of the model.
- name: String is the name for the input layer.
- weight: It is the tensor whose values are the initial value for the layer.
- trainable: It defined that is layer is trainable or not. It is a boolean data type.
- batchInputShape: It defined the batch’s shape for the samples in the input layer. It is used in making of the input layer.
- batchSize: It is used as supplementary of batchInputShape in the construction of the input layer. It is used in making of the input layer.
- inputDType: It is the data type for the input data in the layer.
Returns: It returns the product tensor of two tensors.
Below are some examples of this function.
Example 1: In this example, we will make simply a dot product of tensor with -2 axis rotation of values.
Tensor [[0.7034817], [0.2338114], [1.1493738]] Tensor [[0.7034817], [0.2338114], [1.1493738]]
Example 2: In this example, we will make a dot product of two tensors and see the result in cosine form.
My Personal Notes arrow_drop_up
Please Login to comment...