parameters: (shape, dtype)
return_statement: return cached
docstring: Helper to return (possibly cached) zero tensors in eager mode.
docstring_summary: Helper to return (possibly cached) zero tensors in eager mode.
docstring_tokens: Helper to return ( possibly cached ) zero tensors in eager mode .
function: def _zeros(shape, dtype):
    """Helper to return (possibly cached) zero tensors in eager mode."""
    # Note: variants will use _zeros_like
    if dtype == dtypes.string or dtype == dtypes.resource:
      return None
  
    ctx = context.context()
    if not ctx.executing_eagerly():
      return array_ops.zeros(shape, dtype)
  
    device = ctx.device_name
  
    if tensor_util.is_tf_type(shape):
      shape_key = shape.ref()
    else:
      shape_key = shape
    cache_key = shape_key, dtype, device
    cached = ctx.zeros_cache().get(cache_key)
    if cached is None:
      if dtypes.as_dtype(dtype).is_bool:
        value = False
      else:
        value = 0
      cached = _fast_fill(value, shape, dtype)
      ctx.zeros_cache().put(cache_key, cached)
    return cached
function_tokens: def _zeros ( shape , dtype ) : # Note: variants will use _zeros_like if dtype == dtypes . string or dtype == dtypes . resource : return None ctx = context . context ( ) if not ctx . executing_eagerly ( ) : return array_ops . zeros ( shape , dtype ) device = ctx . device_name if tensor_util . is_tf_type ( shape ) : shape_key = shape . ref ( ) else : shape_key = shape cache_key = shape_key , dtype , device cached = ctx . zeros_cache ( ) . get ( cache_key ) if cached is None : if dtypes . as_dtype ( dtype ) . is_bool : value = False else : value = 0 cached = _fast_fill ( value , shape , dtype ) ctx . zeros_cache ( ) . put ( cache_key , cached ) return cached