# AI News, Calculate Max Of A TensorFlow Tensor

- On Monday, June 4, 2018
- By Read More

## Calculate Max Of A TensorFlow Tensor

Next, we are going to create a TensorFlow tensor that’s going to hold random numbers.

We’re going to initialize it with the tf.random_uniform operation and we’re going to have it be a 2x3x4 tensor with a minimum value of 0, a max value of 20, and the data type is int32, and we’re going to assign this to the Python variable random_int_var.

Next, we create the TensorFlow operation that initializes all the global variables in the graph.

To calculate the maximum value of an element in all of our TensorFlow tensor, we’re going to use the tf.reduce_max operation.

Looking at it, we see that it is a 2x3x4 tensor and visually, it looks like we have a couple of 19s, so the max value should be 19.

So we can manually figure out what the max value of the whole tensor is visually.

So to calculate the max of the random_int_var tensor, we use the tf.reduce_max operation and we pass our tensor to it and we run it within a session and then we print the result.

The value that we get is 19 which is indeed what we figured out would be the max of the tensor.

One thing to note about the tf.reduce_max operation is that it also lets you specify which tensor dimension you want to get the max of.

So we know it’s a 2x3x4 tensor so we know this tensor has a rank of 3 so we can have three possible dimensions.

Next, we are going to create a TensorFlow tensor that’s going to hold random numbers.

We’re going to initialize it with the tf.random_uniform operation and we’re going to have it be a 2x3x4 tensor with a minimum value of 0, a max value of 20, and the data type is int32, and we’re going to assign this to the Python variable random_int_var.

To calculate the maximum value of an element in all of our TensorFlow tensor, we’re going to use the tf.reduce_max operation.

Looking at it, we see that it is a 2x3x4 tensor and visually, it looks like we have a couple of 19s, so the max value should be 19.

So we can manually figure out what the max value of the whole tensor is visually.

So to calculate the max of the random_int_var tensor, we use the tf.reduce_max operation and we pass our tensor to it and we run it within a session and then we print the result.

One thing to note about the tf.reduce_max operation is that it also lets you specify which tensor dimension you want to get the max of.

So we know it’s a 2x3x4 tensor so we know this tensor has a rank of 3 so we can have three possible dimensions.

- On Saturday, April 4, 2020

**Convolutional Neural Networks - The Math of Intelligence (Week 4)**

Convolutional Networks allow us to classify images, generate them, and can even be applied to other types of data. We're going to build one in numpy that can ...

**Max Pooling in Convolutional Neural Networks explained**

In this video, we start out by explaining what max pooling is, and we show how it's calculated by looking at some examples. We then discuss the motivation for ...

**How to Generate Video - Intro to Deep Learning #15**

Generative Adversarial Networks. It's time. We're going to use a Deep Convolutional GAN to generate images of the alien language from the movie arrival that ...

**How to Make an Image Classifier - Intro to Deep Learning #6**

We're going to make our own Image Classifier for cats & dogs in 40 lines of Python! First we'll go over the history of image classification, then we'll dive into the ...

**How to Simulate a Self-Driving Car**

We're going to use Udacity's car simulator app as an environment to create our own autonomous agent! We'll use Keras to train a convolutional neural network ...

**Multiprocessing - Intermediate Python Programming p.10**

Welcome to part 10 of the intermediate Python programming tutorial series. In this part, we're going to talk about the built-in library: multiprocessing. Let us take a ...

**Genetic Algorithm in Artificial Intelligence - The Math of Intelligence (Week 9)**

Evolutionary/genetic algorithms are somewhat of a mystery to many in the machine learning discipline. You don't see papers regularly published using them but ...

**Rocking Out With Convolutions | Two Minute Papers #73**

A lot of university students tend to have a lot of problems understanding convolutions. Today, we're going to talk about both many cool useful applications of ...

**Lecture 18: Tackling the Limits of Deep Learning for NLP**

Lecture 18 looks at tackling the limits of deep learning for NLP followed by a few presentations.

**Supercharge performance using GPUs in the cloud (Google Cloud Next '17)**

GPUs have thousands of compute cores and when coupled with lightning fast memory access they accelerate machine learning, gaming, database queries, ...