Updated March 13, 2023

## Introduction to TensorFlow APIs

TensorFlow is a deep learning library developed by Google using the python to work with the artificial neural networks. The library is a collection of multidimensional arrays of numbers, and those numbers flow between the tensors during operations hence the name TensorFlow. Since the library is written in python, the python APIs for TensorFlow are currently the most used and widely accepted due to their ease of use and understanding. There are numerous different APIs available in TensorFlow, which can be used to solve all the complex problems the list of the APIs.

### Different APIs in TensorFlow

Given below are the different APIs in TensorFlow:

#### 1. Packages in TensorFlow

**audio:**This module is available with public access specifier for the tf.audio package and can be used in any other function.**autograph:**This module is to convert plain python code into TensorFlow graph code.**bitwise:**This module is used for a bitwise operation to manipulate the binary representation of the integers.**compat:**This module contains various functions which help to make Python 2 code compatible with python 3 code.**config:**This module is available with public access specifier for the tf.config package and can be used in any other function.**data:**This module is available with public access specifier for the tf.config package and can be used in any other function.to work on the input pipeline for TensorFlow**debugging:**This module is available with public access specifier for the tf.audio package and can be used in any other function.**distribute:**This package is used to make the model platform independent so that it can run on multiple devices.**dtypclasses:**This module is available with public access specifier for the tf.audio package and can be used in any other function.**errors:**This module contains different exception type classes for the different scenarios in TensorFlow.**classestimator:**This Package provides multiple classes and functions which acts as a tool to work with different TensorFlow models.**experimental:**This module is available with public access specifier for the tf.experimental package and can be used in any other function.**feature_column:**This module is available with public access specifier for the tf.feature_column package and can be used in any other function.**graph_util:**This is a helper package which helps to tweak around the tensor graph using python.**image:**This package consists of classes and methods to decode and perform operations on images.**initializers:**This package is a Keras(a top-level wrapper around TensorFlow lib) initializer that helps serialise and deserialise the objects.**io:**This module is available with public access specifier for the tf.io package and can be used in any other function.**Keras:**This package is a high-level wrapper around the TensorFlow library.**linalg:**This package provides various methods for the operations of linear algebra.**lite:**This module is available with public access specifier for the tf.lite package and can be used in any other function.**lookup:**This module is available with public access specifier for the tf.lookup package and can be used in any other function.**losses:**This package contains built-in functions which can be used to calculate the loss during the computation of the module.**math:**This package contains functions for various math operations.**metrics:**This method contains functions for various metrics related operations.**nest:**This module is available with public access specifier for the tf.nest package and can be used in any other function.**nn:**This module is a wrapper around the primitive neural network operations.**optimizers:**This module provides the built-in classes which can be used to optimize the model.**quantization:**This module is available with public access specifier for the tf.quantization package and can be used in any other function.**queue:**This module is available with public access specifier for the tf.queue package and can be used in any other function.**ragged:**This module provides the functions to work with non-uniform tensors.**random:**This module is available with public access specifier for the tf.random package and can be used in any other function.**raw_ops:**This module is available with public access specifier for the tf.ops package and can be used in any other function.**saved_model:**This module is available with public access specifier for the tf.saved_model package and can be used in any other function.**sets:**This package contains different functions to perform set operations on a particular tensor.**signal:**This module is helpful to work with signal processing between the tensors.**sparse:**This package works with sparse tensors (two or three separate dense tensors) and represents it.**strings:**This package provides different functions to work with strings and string tensors.**summary:**This package is useful to write a summary of the data and create a visualization.**sysconfig:**This package contains functions through which we can configure the system.**test:**This module provides various functions to prepare the test data for the model.**tpu:**This package provides various methods to work with the tensor processing unit.**train:**This package provides various functions and classes which helps in training the model.**version:**This module is available with public access specifier for the tf.version package and can be used in any other function.**Xla:**This module is available with public access specifier for the tf.xla package and can be used in any other function.**audio:**This module is available with public access specifier for the tf.audio package and can be used in any other function.

#### 2. Classes in TensorFlow

**AggregationMethod:**This class consists of multiple methods for aggregating the matrix and combining the gradient from them.**CriticalSection:**The object for this class will act as a graph resource and help execute subgraphs in serial order.**DType:**This class is used to represent a different type of element present in the tensor.**Devicespec:**This class is used throughout TensorFlow to identify where is the state stored and where the computation occurred.**GradientTape:**This class is useful in recording the operations for automatic differentiation.**Graph:**This class is used to represent a computation as a dataflow graph.**IndexedSlices:**This class is useful in representing a subset of larger tensor dense.**IndexedSlicclassesSpec:**This class provides the type specification for the class IndexedSlices.**Module:**This class is the base for the neural network module.**Operation:**This class represents a graph node which performs operations on tensors.**OptionalSpec:**This class represents an optional value which might contain data or not.**RaggedTensor:**This class is use to represent a distorted graph and contains methods to work with them.**RaggedTensorSpec:**This class contain type specification for the RaggedTensor class.**RegisterGradient:**This class is a decorator which is used to register the gradient function for a particular operation.**SparseTensor:**This class is used to represent a sparse tensor.**SparseTensorSpec:**This class provides the specification for a Sparse Tensor.**Tensor:**This class is used to represent one of the outputs of multiple operations performed.**TensorArray:**This class is a wrapper for tensor array, which is dynamically created and written once.**TensorArraySpec:**This class shows the specification of a tensor array.

**TensorShape:**This class represents the shape of the tensor.**TensorSpec:**This class is used to describe a tensor.**Typespec:**This class is use to specify a value type in TensorFlow.**UnconnectedGradients:**This class controls how gradient calculates occurs when one element(y) is independent of another(x).**Variable:**This class is useful in viewing the variable guide.**VariableAggregation:**This class is useful in indicating when a distributed variable gets aggregated.**Variablesynchronization:**This class is useful in indicating when a distributed variable gets synced.**constant_initializer:**This is an initializer which generates tensors with constant values.**name_scope:**This class acts as a context manager when defining a python operation.**onclasses_initializer:**This class generates tensors and is initialized with 1.**random_normal_initializer:**This is a class is basically an initializer which generates multiple tensors with a normal distribution.

#### 3. Functions in TensorFlow

**assert():**This function will assert(verify) if the given condition is true.**abs():**This function is used to calculate the absolute value of a tensor (Matrix).**acos():**This function helps to computes the arc cosine of an element.**acosh():**This function helps computer inverse hyperbolic arc cosine of a variable.**add():**This function returns the sum of two variables or more variables.**add_n():**This function adds all the inputted tensors one by one.**argmax():**This function gives the index(address) of the largest value across the tensor.**argmin():**This function gives the index(address) of the smallest value across the tensor.**argsort():**This function returns the indices of the tensor and provides them in sorted order along the same axis.**as_dtype():**This function converts the given type_value of a tensor to a Dtype**as_string():**This function helps to convert each entry for a given tensor into strings.**asin():**This function calculates and returns the trigonometric inverse sine of a given element.**asinh():**This function calculates and returns the inverse hyperbolic sine of a given element.**assert_equal():**This function holds(return) true if both the elements are equal.**assert_greater():**This function holds(return) true if one(x) element is greater than other(y).**assert_less():**This function holds(return) true if one(x) element is less than other(y).**assert_rank():**This function holds(return) true of one elements(x) rank is equal to another element(y).**atan():**This function calculates the trigonometric inverse tangent of a given element.**atan2():**This function returns the computation arc tangent of two elements(x/y) by considering the sign of both the elements.**atanh():**This function computes and returns the inverse hyperbolic tangent of an element.**batch_to_space():**This function operates on the tensors and reshapes the batch dimension 0 intp M+1.**bitcast():**This function will cast a single bit at a time for a tensor without copying the data.**boolean_mask():**This function is used to mask a tensor with the boolean value.**broadcast_dynamic_shape():**This function will compute the shape of a broadcast tensor based on the symbolic shapes.**broadcast_static_shape():**This function will compute the shape of a broadcast tensor based on the known shapes.**broadcast_to():**This function will return an array for a compatible shape of a graph.**case():**This function is used to create a case operation.**cast():**This function is used to type cast a tensor from one type to another.**clip_by_global_norm():**This function is use to clip the value of multiple tensors based on the ratio of the sum of their norms.**clip_by_norm():**This function is use to clip the value of multiple tensors based on the values from the maximum L2 norm.**clip_by_value():**This function trims a tensor-based on the specified min and max value.**complex():**This function takes two real numbers as input and convert them to complex numbers.**concat():**This function helps concatenates multiple tensors along one particular dimension.**cond():**This function will return True (true_fn()) if the predicated value is true else will return false(false_fn()).**constant():**This function helps create a constant tensor.**control_dependencies():**This method is a wrapper created around the function Graph.control_dependencies() using the default graph.**convert_to_tensor():**This function helps to convert a given value into a tensor.**cos():**This function will calculate and return the cosine of an element.**cosh():**This function helps calculate the hyperbolic cosine of an element.**cumsum():**This function is used to compute the cumulative sum of a tensor on a given axis.**custom_gradient():**This is a python decorator which is used to define a function with custom gradient.

### Conclusion

This is a brief introduction and overview of the TensorFlow library for machine learning/deep learning. The scope of the article is only limited to python APIs, but TensorFlow has the support for other languages as well. Such as JavaScript, C++, Java, Go, Swift.

### Recommended Articles

This is a guide to TensorFlow APIs. Here we discuss the introduction and different APIs in TensorFlow for better understanding. You may also have a look at the following articles to learn more –