Tensors

What is a tensor? A tensor is a generalization of vectors and matrices and is easily understood as a multidimensional array. A tensor can be a number, a vector, a matrix, or any n-dimensional array. Examples 0-d tensor: scalar 1-d tensor: vector 2-d tensor: matrix 3-d tensor: cube n-d tensor: n-d array Rank The rank of a tensor is the number of dimensions present within the tensor. For example, the tensor [1, 2, 3] is a rank 1 tensor, while the tensor [[1, 2, 3], [4, 5, 6], [7, 8, 9]] is a rank 2 tensor.

Negative look-behind assertions

Regular expressions are very powerful. Here are some typical use cases: Email validation Password validation Searching for a pattern in a string Searching and capturing matches in a string In my current project, I needed to parse a CSV file and a particular field had a float value. This value could appear as any of the following: 0.678 0.003782 2e-08 1.456e-06 So it could either be a literal float or it could be in scientific notation.

I am like a dog barking

I am like a dog barking, and you are the one who is interpreting the spaces between the sounds and giving meaning to it. – UG Krishnamurti A few days ago there was a poll in Mumbai Mirror about how we should treat stray dogs. As you are aware, in Mumbai there are plenty of stray dogs everywhere. Some people love dogs and regularly give them food. Others are scared or disgusted and then blame it on the folks who give them food.

Mental Models

Three flaws We should avoid the following flaws in order to update our view on reality. In addition we also tend to undervalue the elementary ideas and overvalue the complicated ones. Simple ideas are of great value because they can help us prevent complex problems. Perspective It’s diffcult to get a perspective of the situation we are in. We have a hard time seeing any system that we are in. An outside world view is required, as well as understanding the perspective of others.