Skip to content
DeepForgeby svx
All problems
EasyCalculusca-375

Vanishing Gradient Check

Problem

A point is flagged as a vanishing-gradient candidate when the Euclidean norm of the gradient falls below a tolerance.

Given the gradient vector and the tolerance, return True when the norm is strictly less than the tolerance.

Hint

Compute the norm first and compare with a strict inequality.

Test cases

case 1
in: [[1e-8,1e-8],0.000001]
expected: true
case 2
in: [[1,1],0.5]
expected: false
case 3
in: [[0,0],0]
expected: false
Starter codePython
def vanishing_gradient_check(grad, tol):
    # Your code here
    pass

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