import tensorflow as tf

def zeros(shape, dtype=K.floatx()):
    """Return all-zeros tensor of given shape and type."""
    # As of Keras version 1.1.0, Keras zeros() requires integer values
    # in shape (e.g. calling np.zeros() with the Theano backend) and
    # thus can't be called with tensor values. This version avoids the
    # issue by using the backend zeros() instead.
    if K.backend() == 'theano':
        from theano import tensor as T
        return T.zeros(shape, dtype)
    else:
        assert K.backend() == 'tensorflow'
        import tensorflow as tf
        return tf.zeros(shape, dtype)


def values(value, shape, dtype=K.floatx()):
    """Return tensor of given shape and type filled with given value."""
    return value * ones(shape, dtype)    # or zeros() + ?


def meshgrid(i, j, indexing='ij'):
    """Return matrices broadcasting indices on a 2d grid.

    This is a partial backend-independent version of TensorFlow meshgrid()
