Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • TypeScript
  • Vue.js
  • D3.js
  • Collect.js
  • Underscore.js
  • Moment.js
  • Ember.js
  • Tensorflow.js
  • Fabric.js
  • JS Formatter
  • JavaScript
  • Web Technology
Open In App
Next Article:
Tensorflow.js tf.layers.add() Function
Next article icon

Tensorflow.js tf.layers.conv3d() Function

Last Updated : 25 Apr, 2022
Comments
Improve
Suggest changes
Like Article
Like
Report

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.

The tf.layers.conv3d() function is used to apply the 3D convolution operation on data.

Syntax:

tf.layers.conv3d(args)

Parameters: It accepts the args object which can have the following properties:

  • filters (number): The output space's dimensionality (i.e. the number of filters in the convolution).
  • kernelSize (number|number[]): The convolution window's dimensions. The convolutional window will be square if kernelSize is a number.
  • strides (number|number[]): The convolutional strides in each dimension. Strides in both dimensions are equal if strides are a number.
  • padding: The padding mode.
  • dataFormat: The data format. This specifies the order in which the dimensions in the inputs are ordered. channelsLast is the default value.
  • dilationRate: In each dimension, the dilation rate to utilize for the dilated convolution. It should be an integer or a two- or three-int array.
  • activation: The layer's activation function.
  • useBias (boolean): If the layer has a bias vector or not. True is the default value.
  • kernelInitializer: The convolutional kernel weights matrix's initializer.
  • biasInitializer: The bias vector's initializer.
  • kernelConstraint: The constraint for the convolutional kernel weights.
  • biasConstraint: The constraint for the bias vector.
  • kernelRegularizer: The regularizer function applied to the kernel weights matrix.
  • biasRegularizer: The regularizer function applied to the bias vector.
  • activityRegularizer: The regularizer function applied to the activation.
  • inputShape: If this property is set, it will be utilized to construct an input layer that will be inserted before this layer. 
  • batchInputShape: If this property is set, an input layer will be created and inserted before this layer. 
  • batchSize: If batchInputShape isn't supplied and inputShape is, batchSize is utilized to build the batchInputShape.
  • dtype: It is the kind of data type for this layer. float32 is the default value. This parameter applies exclusively to input layers.
  • name: This is the layer's name and is of string type.
  • trainable: If the weights of this layer may be changed by fit. True is the default value.
  • weights: The layer's initial weight values.

Returns: It returns an object (Conv3D).

Example 1:

JavaScript
import * as tf from "@tensorflow/tfjs";  const input = tf.input({ shape: [4, 4, 4, 4] }); const conv3DLayer = tf.layers.conv3d({      filters: 2,      kernelSize: 2 }); const output = conv3DLayer.apply(input);  const model = tf.model({ inputs: input, outputs: output }); model.predict(tf.ones([1, 4, 4, 4, 4])).print(); 

Output:

Tensor     [[[[[0.8289496, 0.3677104],         [0.8289496, 0.3677104],         [0.8289496, 0.3677104]],        [[0.8289496, 0.3677104],         [0.8289496, 0.3677104],         [0.8289496, 0.3677104]],        [[0.8289496, 0.3677104],         [0.8289496, 0.3677104],         [0.8289496, 0.3677104]]],         [[[0.8289496, 0.3677104],         [0.8289496, 0.3677104],         [0.8289496, 0.3677104]],        [[0.8289496, 0.3677104],         [0.8289496, 0.3677104],         [0.8289496, 0.3677104]],        [[0.8289496, 0.3677104],         [0.8289496, 0.3677104],         [0.8289496, 0.3677104]]],         [[[0.8289496, 0.3677104],         [0.8289496, 0.3677104],         [0.8289496, 0.3677104]],        [[0.8289496, 0.3677104],         [0.8289496, 0.3677104],         [0.8289496, 0.3677104]],        [[0.8289496, 0.3677104],         [0.8289496, 0.3677104],         [0.8289496, 0.3677104]]]]]

Example 2:

JavaScript
import * as tf from "@tensorflow/tfjs";  const input = tf.input({ shape: [2, 4, 4, 1] });  const conv3DLayer = tf.layers.conv3d({      filters: 2,      kernelSize: 2 });      const output = conv3DLayer.apply(input);  const model = tf.model({      inputs: input,      outputs: output  });  const x = tf.tensor5d([1, 2, 3, 4, 5, 6, 7, 8,      9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,      20, 21, 22, 23, 24, 25, 26, 27, 28, 29,      30, 31, 32], [1, 2, 4, 4, 1] );  model.predict(x).print(); 

Output:

Tensor     [[[[[-13.2970839, -1.055295 ],         [-13.623745 , -1.1944677],         [-13.950407 , -1.3336394]],        [[-14.6037302, -1.6119833],         [-14.9303923, -1.7511561],         [-15.2570543, -1.8903288]],        [[-15.9103785, -2.1686723],         [-16.2370396, -2.3078454],         [-16.5637016, -2.4470177]]]]]

Reference: https://js.tensorflow.org/api/latest/#layers.conv3d


Next Article
Tensorflow.js tf.layers.add() Function

A

aayushmohansinha
Improve
Article Tags :
  • JavaScript
  • Web Technologies
  • Tensorflow.js
  • Tensorflow.js-Convolutional
  • TensorFlow.js-layers

Similar Reads

  • Tensorflow.js tf.layers.conv2d() 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.
    3 min read
  • Tensorflow.js tf.layers.conv1d() Function
    Tensorflow.js is a javascript library developed by Google to run and train machine learning models in the browser or in Node.js. Tensorflow.js tf.layers.conv1d() function is used to create convolution layer. It is used to applied 1d convolution to the input data. The convolutional layer is used to m
    4 min read
  • Tensorflow.js tf.layers.convLstm2d() 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.convLstm2d() function is used for creating a ConvRNN2D layer which consists of one ConvLSTM2DCell a
    5 min read
  • 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. Syntax:  tf.layers.dot(args)
    3 min read
  • Tensorflow.js tf.layers.add() 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 Node.js. The tf.lay
    2 min read
  • Tensorflow.js tf.conv3d() Function
    Tensorflow.js is javascript library developed by google to run and train machine learning model in the browser or in Node.js. The tf.conv3d() function is used to compute 3d convolutions over given inputs. The inputs are mainly 3D image data like CT or MRI imaging or any video. To extract features fr
    4 min read
  • Tensorflow.js tf.layers.cropping2D() 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.elu() 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 Node.js. The tf.lay
    2 min read
  • Tensorflow.js tf.layers.dense() Function
    The tf.layers.dense() is an inbuilt function of Tensorflow.js library. This function is used to create fully connected layers, in which every output depends on every input. Syntax: tf.layers.dense(args)Parameters: This function takes the args object as a parameter which can have the following proper
    3 min read
  • Tensorflow.js tf.layers.convLstm2dCell() 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.convLstm2dCell() is used to create ConvLSTM2DCell which is different from the ConvRNN2D subclass Co
    4 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences