Today we would want you to know something about TensorFlow. It is one of the most useful software libraries today. We are here to share my knowledge about what TensorFlow is. Also, I’ll make you understand the architecture of this software library with some examples of it.
We have made this article for the absolute beginners, who don’t have any knowledge about this. So, let’s proceed.
Also Read: Top 5 Python Libraries for Machine Learning
What is TensorFlow?
So the very first question comes in your mind that, what is TensorFlow. Let me tell you in simple languages. It is an open-source software library owned by Google, famous for deep learning.
Google’s researches and developers working on machine intelligence developed this software library. TensorFlow was first made for public use in 2015, and the first stable version was released in 2017.
Now let’s understand what deep learning is. You can notice that if you start to type something in the search box, Google provides a recommendation about the next words. This is possible due to artificial intelligence and deep learning.
TensorFlow is used in deep learning for numerical computation using data flow graphs. The nodes in the graph represent mathematical operations. And the edges in the graph represent the multidimensional data arrays or known as tensors. Tensor is the central unit of data in TensorFlow.
Google has imported TensorFlow in Gmail, Google photo, Google search engine, which has makes this software user-friendly.
Architecture of the TensorFlow
TensorFlow is a flexible, high-performance serving system. It is designed for machine learning modules to create production environments. It provides unique integrations with TensorFlow models.
To understand architecture, you should know some key concepts.
These are the central abstraction of the TensorFlow service. Servable refers to underlying objects used by the clients to perform computation. The size of a servable is flexible. It can be of any type and interface, which enables flexibility and future movements such as:
- Streaming results
- Experimental APIs
- Asynchronous modes of operation
Serves cannot manage their own lifecycle. A typical servable includes the following:
- A TensorFlow savedModeBundle
- A lookup table for embedding or vocabulary lookups.
2. Servable Versions
TensorFlow Serving can handle one or more versions of a servable. It enables fresh algorithmic configuration, weights, and other data loaded over time. It supports gradual rollout and experimentation. TensorFlow allows the client to request either the latest version or a particular version id for a particular model at serving time.
3. Servable Streams
A servable stream is the sequence of versions of a servable, sorted by increasing version numbers.
TensorFlow serving represents a model as one or more servables. It may include one or more algorithms, including learned weights. It also has lookup or embedding tables.
User can represent a composite model as either of the following:
- Multiple independent servable
- Single composite servable.
A servable may also relate to a fraction of a model. For example, a large lookup table could be shaded across many TensorFlow serving instances.
It manages a servable’s life cycle. The API enables common infrastructure. It is independent of specific learning algorithms, data, or involvement of product use-cases.
Sources are plugin modules that are used to locate and provide servables. Each of the sources provides some servable streams. For each servable stream, a source supplies one loader instance for each version.
TensorFlow serving interface for sources can find servables which are in an arbitrary storage system. Servings include the implementation of common reference sources.
The source can maintain a state which can be shared across many versions or servables. This is necessary for the servables which use delta updates between versions.
Managers could be described as the handlers of the servables life cycles. It includes:
- Loading servables
- Serving servables
- Unloading servables
Managers track all the versions of the sources. It tries to provide sources’ requests. But it also refuses to load an aspired version if required sources remain unavailable. Managers may also make a delay in unloading.
It waits for the unloading process until a newer version finishes loading. It provides a simple narrow interface for the clients to make access to loaded service interfaces.
TensorFlow serving core manages the following aspects of servables. It uses standard TensorFlow serving APIs.
It treats servables and loaders as opaque objects.
Life of a Servable in TensorFlow
If we try to describe the whole process in only two sentences, then we can say,
- Sources create loaders for servable versions.
- Loaders are sent to the manager as aspired versions. Here, they are loaded and served to the client as requested.
This is the whole process. Now let’s try to understand this in details:
- A source plugin creates a loader for a specific version. It contains the metadata it requires.
- The sources use the call back to change the manager of the aspired version.
- The manager applies the configured version policy to decide its next action. That action may unload a previous-loaded version or to load a new version.
- If the manager determines it as safe, it gives the loader the required recourses. And it also tells the loader to load a new version.
- When clients ask the manager for the servable, either specific version or latest version, the manager returns a handle for this service.
Example of TensorFlow
Import numpy as np
Import tensorflow as tf
This is a small example of TensorFlow where we have imported TensorFlow as tf. In python, we use a short name for the library.
It gives advantages over typing the full name of the library. For quick processing, we can import TensorFlow as tf. And call it tf whenever we want to use a TensorFlow function.
We have given brief information here about TensorFlow. Also, We have stated its architecture and tried to make you understand this topic. Hope this will definitely help you.