Clips gradient norm.

        The norm is computed over all gradients together, as if they were
        concatenated into a single vector. Gradients are modified in-place.
        The method is first used in
         `[ICML2013] On the difficulty of training recurrent neural networks`

        Parameters
        ----------
        max_norm : float or int
            The maximum clipping threshold of the gradient norm.

        Returns
        -------
        norm_val : float
            The computed norm of the gradients.

def _clip_by_global_norm(self, max_norm):
        """Clips gradient norm.

        The norm is computed over all gradients together, as if they were
        concatenated into a single vector. Gradients are modified in-place.
        The method is first used in
         `[ICML2013] On the difficulty of training recurrent neural networks`

        Parameters
        ----------
        max_norm : float or int
            The maximum clipping threshold of the gradient norm.

        Returns
        -------
        norm_val : float
            The computed norm of the gradients.
        """
        assert self._module.binded and self._module.params_initialized \
               and self._module.optimizer_initialized
        grad_array = []
        for grad in self._module._exec_group.grad_arrays:
            grad_array += grad
        return mx.gluon.utils.clip_global_norm(grad_array, max_norm)