Skip to content
DeepForgeby svx
All problems
EasyDeep Learningdl-156

Dead Neuron Fraction

Problem

Compute the fraction of dead neurons in a layer. activations is a (num_neurons, num_examples) matrix; a neuron is dead when none of its activations is strictly positive.

The signature is dead_neuron_fraction(activations).

Hint

Dead ReLU units never recover once their pre-activations stay negative.

Test cases

case 1
in: [[[0,0,0],[1,0,0],[-1,1,0]]]
expected: 0.3333333333
case 2
in: [[[0]]]
expected: 1
case 3
in: [[[1],[2]]]
expected: 0
case 4
in: [[[0,0],[0,1],[0,0],[0,-1]]]
expected: 0.75
Starter codePython
def dead_neuron_fraction(activations):
    # Your code here
    pass

4 test cases · run your code against them in the editor