def update_multi_precision(self, index, weight, grad, state):
use_multi_precision = self.multi_precision and weight.dtype == np.float16<EOL>lr = self._get_lr(index)<EOL>wd = self._get_wd(index)<EOL>self._update_count(index)<EOL>if use_multi_precision:<EOL><INDENT>mean, variance = state[<NUM_LIT:0>]<EOL>weight32 = state[<NUM_LIT:1>]<EOL><DEDENT>else:<EOL><INDENT>mean, variance = state<EOL>weight32 = weight.copy()<EOL><DEDENT>grad = grad.astype('<STR_LIT>') * self.rescale_grad<EOL>if self.clip_gradient is not None:<EOL><INDENT>mx.nd.clip(grad, -self.clip_gradient, self.clip_gradient, out=grad)<EOL><DEDENT>mean[:] = self.beta1 * mean + (<NUM_LIT:1.> - self.beta1) * grad<EOL>variance[:] = self.beta2 * variance + (<NUM_LIT:1> - self.beta2) * grad.square()<EOL>update = mean / (mx.nd.sqrt(variance) + self.epsilon) + wd * weight32<EOL>if use_multi_precision:<EOL><INDENT>weight32 -= lr * update<EOL>weight[:] = weight32.astype(weight.dtype)<EOL><DEDENT>else:<EOL><INDENT>weight -= lr * update<EOL><DEDENT>
Update the parameters.

        Parameters
        ----------
        index : int
        An unique integer key used to index the parameters
        weight : NDArray
        weight ndarray
        grad : NDArray
        grad ndarray
        state : NDArray or other objects returned by init_state
        The auxiliary state used in optimization.