Tensorflow.js tf.multinomial() Function
Tensorflow.js is an open-source library that is developed by Google for running machine learning models as well as deep learning neural networks in the browser or node environment.
The .multinomial() function is used to generate a tf.Tensor along with inputs that are dragged out of a multinomial distribution.
tf.multinomial(logits, numSamples, seed?, normalized?)
- logits: It is a stated 1D array along with disorganized log expectancies, or a 2D array that has a shape [batchSize, numOutcomes] and it can be of type tf.Tensor1D, tf.Tensor2D, TypedArray, or Array.
- numSamples: It is the stated number of samples that are to be dragged for every row section. It is of type number.
- seed: It is the stated seed number and is an optional parameter of type number.
- normalized: It checks if the given logits are organized true expectancies or not i.e. (sum to 1). The by default value is false and is an optional parameter of type Boolean.
Return Value: It returns tf.Tensor1D, or tf.Tensor2D.
Tensor [1, 1, 1, 1]
Tensor [5, 5, 5, 5, 5, 5]