Same as tf.maximum, but with helpful gradient for inputs < bound. The gradient is overwritten so that it is passed through if the input is not hitting the bound. If it is, only gradients that push `inputs` higher than the bound are passed through. No gradients are passed through to the
(inputs, bound, name=None)
| 1986 | |
| 1987 | @staticmethod |
| 1988 | def _lower_bound(inputs, bound, name=None): |
| 1989 | """Same as tf.maximum, but with helpful gradient for inputs < bound. |
| 1990 | |
| 1991 | The gradient is overwritten so that it is passed through if the input is not |
| 1992 | hitting the bound. If it is, only gradients that push `inputs` higher than |
| 1993 | the bound are passed through. No gradients are passed through to the bound. |
| 1994 | |
| 1995 | Args: |
| 1996 | inputs: input tensor |
| 1997 | bound: lower bound for the input tensor |
| 1998 | name: name for this op |
| 1999 | |
| 2000 | Returns: |
| 2001 | tf.maximum(inputs, bound) |
| 2002 | """ |
| 2003 | with ops.name_scope(name, 'GDNLowerBound', [inputs, bound]) as scope: |
| 2004 | inputs = ops.convert_to_tensor(inputs, name='inputs') |
| 2005 | bound = ops.convert_to_tensor(bound, name='bound') |
| 2006 | with ops.get_default_graph().gradient_override_map( |
| 2007 | {'Maximum': 'GDNLowerBound'}): |
| 2008 | return math_ops.maximum(inputs, bound, name=scope) |
| 2009 | |
| 2010 | @staticmethod |
| 2011 | def _lower_bound_grad(op, grad): |
no test coverage detected