- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

Tensorflow is a machine learning framework that is provided by Google. It is an open-source framework used in conjunction with Python to implement algorithms, deep learning applications, and much more. It is used in research and for production purposes.

It has optimization techniques that help in performing complicated mathematical operations quickly.

This is because it uses NumPy and multi-dimensional arrays. These multi-dimensional arrays are also known as ‘tensors’. The framework supports working with deep neural networks. It is highly scalable and comes with many popular datasets. It uses GPU computation and automates the management of resources. It comes with multitude of machine learning libraries, and is well-supported and documented. The framework has the ability to run deep neural network models, train them, and create applications that predict relevant characteristics of the respective datasets.

The ‘tensorflow’ package can be installed on Windows using the below line of code −

pip install tensorflow

Tensor is a data structure used in TensorFlow. It helps connect edges in a flow diagram. This flow diagram is known as the ‘Data flow graph’. Tensors are nothing but a multidimensional array or a list.

We are using Google Colaboratory to run the below code. Google Colab or Colaboratory helps run Python code over the browser and requires zero configuration and free access to GPUs (Graphical Processing Units). Colaboratory has been built on top of Jupyter Notebook.

Following is the code snippet −

print("Defining the function to build a one dimensional convolutional network") def create_model(vocab_size, num_labels): model = tf.keras.Sequential([ layers.Embedding(vocab_size, 64, mask_zero=True), layers.Conv1D(64, 5, padding="valid", activation="relu", strides=2), layers.GlobalMaxPooling1D(), layers.Dense(num_labels) ]) return model

Code credit − https://www.tensorflow.org/tutorials/load_data/text

Defining the function to build a one dimensional convolutional network

The ‘init’ vectorized model is used to build the one dimensional convolutional neural network.

This is also done using the ‘Sequential’ API.

- Related Questions & Answers
- How can a Convolutional Neural Network be used to build learning model?
- How can Tensorflow be used to create a convolutional base using Python?
- How can Tensorflow be used to build normalization layer using Python?
- How can Tensorflow be used to compare the linear model and the Convolutional model using Python?
- How can Tensorflow be used to build vocabulary from tokenized words for Illiad dataset using Python?
- How can Tensorflow be used with abalone dataset to build a sequential model?
- How can Tensorflow be used to reduce overfitting using a dropout in the network?
- How can Tensorflow be used to compose layers using Python?
- How can Tensorflow be used to build a normalization layer for the abalone dataset?
- How can Tensorflow be used to evaluate a CNN model using Python?
- How can Tensorflow be used to create a sequential model using Python?
- How can Tensorflow be used to create a feature extractor using Python?
- How can Tensorflow be used to attach a classification head using Python?
- How can TensorFlow be used to build the model for Fashion MNIST dataset in Python?
- How can Tensorflow and Python be used to build ragged tensor from list of words?

Advertisements