code: def test_norm_constraint_norm_axes():
      import numpy as np
      import theano
      from lasagne.updates import norm_constraint
      from lasagne.utils import compute_norms
  
      max_norm = 0.01
      norm_axes = (0, 2)
  
      param = theano.shared(
          np.random.randn(10, 20, 30, 40).astype(theano.config.floatX)
      )
  
      update = norm_constraint(param, max_norm, norm_axes=norm_axes)
  
      apply_update = theano.function([], [], updates=[(param, update)])
      apply_update()
  
      assert param.dtype == update.dtype
      assert np.max(
          compute_norms(param.get_value(), norm_axes=norm_axes)
      ) <= max_norm * (1 + PCT_TOLERANCE)
  
file_path: Lasagne/lasagne/tests/test_updates.py
imports: import pytest
  import numpy
  import theano
  import theano.tensor
  import lasagne
label_desc: Use image node_id 3 for calling a global function with example usage: test_norm_constraint_norm_axes() without return types