Dead kernel error on tensorflow notebook

everytime on the tensorflow notebook i am getting dead kernel issue

What is the name of the notebook ipynb file?

Programming Assignment: TensorFlow Introduction

1 Like

One thing to check for is infinite loops. How far have you gotten in terms of implementing all the functions in this assignment? If you do the following sequence:

Kernel -> Restart and Clear Output
Save
Cell -> Run All

And then page through and check which tests passed. How far does it complete before you get the “Dead Kernel”?

stuck at exercise 5 forward propagation

tried the instructions still same
{moderator edit - solution code removed}
here the notebook at exercise 5

The problem is that you are using numpy functions. The instructions are quite clear that we’re using TensorFlow operations here, right? Please have another look at the instructions. It’s not clear why that would cause the “dead kernel” problem, but it’s clear why the code is incorrect. The point is that you can’t mix TensorFlow and Numpy operations in most cases: the datatypes are different (numpy arrays versus TF tensors).

Here’s what the instructions say:

Note Use only the TF API.

  • tf.math.add
  • tf.linalg.matmul
  • tf.keras.activations.relu

You just copied what it showed in the comments that are given there, but here’s the first line of that comment block:

# Numpy Equivalents (NumPy not to be used. Use TF API):

1 Like

Ok, the problem is that the test cell for forward_propagation actually does gradient descent using tf.GradientTape(), which is how this works in TF. With numpy functions, you don’t get any TF gradients. I would have expected this to throw an error saying that the compute graph is not connected or that there are no gradients, but instead it appears to go into an infinite loop because it’s getting no gradients at all and things don’t change.

There is an assert checking for “None” in gradients, but it doesn’t appear to get that far for some reason.

2 Likes

That’s some very clever back-end programming by TensorFlow.

1 Like