Skip to content
Related Articles

Related Articles

Improve Article

Tensorflow.js tf.conv3dTranspose() Function

  • Last Updated : 01 Sep, 2021

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 .conv3dTranspose() function is used to determine the transposed 3D convolution of a volume. It is also known as a deconvolution.

Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it's lowest price ever!


tf.conv3dTranspose(x, filter, outputShape, strides, pad)


  • x: The stated input image which is either of rank 5 or else rank 4 and of shape: [batch, depth, height, width, inDepth]. Moreover, in case the rank is 4, then the batch of size 1 is presumed. It can be of type tf.Tensor4D, tf.Tensor5D, TypedArray, or Array.
  • filter: The stated filter tensor of rank 4 and shape: [depth, filterHeight, filterWidth, outDepth, inDepth]. Where, inDepth must match inDepth in input tensor. It can be of type  tf.Tensor5D, TypedArray, or Array.
  • outputShape: The stated output shape which is of rank 5 or else rank 4 and shape [batch, depth, height, width, outDepth]. In case, the rank is 3, then the batch of 1 is presumed. It can be of type [number, number, number, number, number] or [number, number, number, number].
  • strides: The stated strides of the original convolution of shape: [strideDepth, strideHeight, strideWidth]. It can be of type [number, number, number], or number.
  • pad: The stated type of algorithm for padding which is useful in the non transpose form of the op. It can be of type valid, or same.

Return Value: It returns tf.Tensor4D or tf.Tensor5D.

Example 1:


// Importing the tensorflow.js library
import * as tf from "@tensorflow/tfjs"
// Defining input tensor
const x = tf.tensor5d([1, 2, 2, 3], [2, 2, 1, 1, 1]);
// Defining filter tensor
const y = tf.tensor5d([3, 3, 3, 2], [1, 2, 2, 1, 1]);
// Calling conv3dTranspose() method
const result = tf.conv3dTranspose(x, y, [1, 1, 2, 1, 1], 2, 'same');
// Printing output


    [[[ [[3],],


Example 2:


// Importing the tensorflow.js library
import * as tf from "@tensorflow/tfjs"
// Calling conv3dTranspose() method
    [1.1, 2.1, 2.2, 3.6], [2, 2, 1, 1, 1]), 
    tf.tensor5d([3.6, 3.1, 3.2, 2.0], [1, 2, 2, 1, 1]), 
    [1, 1, 2, 1, 1], 7, 'valid').print();


    [[[ [[0],],



My Personal Notes arrow_drop_up
Recommended Articles
Page :