import tensorflow as tf

    for grad, var in grads_and_vars:
        if grad is not None:
            if isinstance(grad, tf.IndexedSlices):
                grad_values = grad.values
            else:
                grad_values = grad
            summaries.append(tf.histogram_summary(var.op.name + ':gradient',
                                                  grad_values))
            summaries.append(tf.histogram_summary(var.op.name + ':gradient_norm',
                                                  tf.global_norm([grad_values])))
        else:
            tf.logging.info('Var %s has no gradient', var.op.name)
    return summaries


class DeploymentConfig(object):
    """Configuration for deploying a model with `deploy()`.

    You can pass an instance of this class to `deploy()` to specify exactly
    how to deploy the model to build.  If you do not pass one, an instance built
    from the default deployment_hparams will be used.
    """
