Tensorflow.js tf.conv1d() Function
Introduction: 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 .conv1d() function is used to determine a 1D convolution upon the stated input tensor.
tf.conv1d(x, filter, stride, pad, dataFormat?, dilation?, dimRoundingMode?)
- x: The stated input tensor which is either of rank 3 or else rank 2 and of shape: [batch, height, width, inChannels]. Moreover, in case the rank is 2, then the batch of size 1 is presumed. It can be of type tf.Tensor2D, tf.Tensor3D, TypedArray, or Array.
- filter: The stated filter tensor of rank 3 and shape: [filterHeight, filterWidth, depth]. It can be of type tf.Tensor3D, TypedArray, or Array.
- strides: The stated number of intakes with the help of which the stated filter is shifted right at each step. It is of type number.
- pad: The stated type of algorithm for padding. It can be of type valid, same, number, or conv_util.ExplicitPadding.
- Here, for same and stride 1, the output would have identical size as input, irrespective of the filter size.
- For, ‘valid’ the output shall be smaller than the input in case, the filter size is larger than 1*1×1.
- dataFormat: The stated elective string out of “NWC”, or “NCW”. The by default value is “NWC”, the information is kept in the sequence of [batch, in_width, in_channels]. Moreover, just “NWC” is currently favored. It is optional and is of type ‘NWC’, or ‘NCW’.
- dilations: The stated dilation rates where input values are sampled in atrous convolution. The by default value is 1. And in case its greater than 1, then the stride should be 1. It is optional and is of type number.
- dimRoundingMode: A stated string out of ‘ceil’, ’round’, or ‘floor’. In case, no value is provided, then the by default value is truncate. It is optional and is of type ceil, round or floor.
Return Value: It returns tf.Tensor2D or tf.Tensor3D.
Tensor [ [[1, 1, 0, 4 ],], [[3, 3, 0, 12],]]
Tensor [[[1.4299999, 1.3200001, 0, -4.4000001 ], [0 , 0 , 0, 0 ]], [[4.29 , 3.96 , 0, -13.1999998], [0 , 0 , 0, 0 ]]]
My Personal Notes arrow_drop_up
Please Login to comment...