Tensorflow

IndexedSlices in Tensorflow

Run in Google Colab View source on GitHub Download notebook In this post, we will discuss about IndexedSlices class of Tensorflow. We will try to answer the following questions in this blog: What are IndexedSlices? Where do we get it? How to convert from IndexedSlices to tensors? What are IndexedSlices? According to Tensorflow documentation, IndexedSlices are sparse representation of a set of tensor slices at a given index.

Tensorflow 2 code for Attention Mechanisms chapter of Dive into Deep Learning (D2L) book

View GitHub Page ----- View source on GitHub Download code (.zip) This code has been merged with D2L book. See PR: 1756, 1768 This post contains Tensorflow 2 code for Attention Mechanisms chapter of Dive into Deep Learning (D2L) book. The chapter has 7 sections and code for each section can be found at the following links.

Reading multiple files in Tensorflow 2 using Sequence

Run in Google Colab View source on GitHub Download notebook In this post, we will read multiple csv files using Tensroflow Sequence. In an earlier post we had demonstrated the procedure for reading multiple csv files using a custom generator. Though generators are convenient for handling chunks of data from a large dataset, they have limited portability and scalability (see the caution here).

Efficiently reading multiple files in Tensorflow 2

Note: Whether this method is efficient or not is contestable. Efficiency of a data input pipeline depends on many factors. How efficiently data are loaded? What is the computer architecture on which computations are being done? Is GPU available? And the list goes on. So readers might get different performance results when they use this method in their own problems. For the simple (and small) problem considered in this post, we got no perceivable performance improvement.

Doing Linear Algebra using Tensorflow 2

Run in Google Colab View source on GitHub Download notebook In this post, we will explore ways of doing linear algebra only using tensorflow. We will only import tensorflow and nothing else. As we will see, we can do all the common linear algebra operations without using any other library. This post is very long as it covers almost all the functions that are there in the linear algebra library tf.

Reading multiple files in Tensorflow 2

Run in Google Colab View source on GitHub Download notebook In this post, we will read multiple .csv files into Tensorflow using generators. But the method we will discuss is general enough to work for other file formats as well. We will demonstrate the procedure using 500 .csv files. These files have been created using random numbers. Each file contains only 1024 numbers in one column.

Using Python Generators

Run in Google Colab View source on GitHub Download notebook In this post, we will discuss about generators in python. In this age of big data it is not unlikely to encounter a large dataset that can’t be loaded into RAM. In such scenarios, it is natural to extract workable chunks of data and work on it. Generators help us do just that.