

def batch_dot(x, y, axes=None):
    'Batchwise dot product.\n\n    batch_dot results in a tensor with less dimensions than the input.\n    If the number of dimensions is reduced to 1, we use `expand_dims` to\n    make sure that ndim is at least 2.\n\n    # Example\n        Assume x = [[1, 2]   and y = [[5, 6]\n                    [3, 4]]           [7, 8]]\n        batch_dot(x, y, axes=1) = [[17, 53]] which is the main diagonal\n        of x.dot(y.T), although we never have to calculate the off-diagonal\n        elements.\n\n\n    # Arguments\n        x, y: tensors with ndim >= 2\n        axes: list (or single) int with target dimensions\n\n    # Returns\n        Tensor with ndim >= 2\n    '
    if (type(axes) == int):
        axes = (y, axes)
    if (axes is not None):
        adj_x = (None if (axes[0] == (ndim(x) - 1)) else True)
        adj_y = (True if (axes[1] == (ndim(y) - 1)) else None)
    else:
        adj_x = None
        adj_y = None
    out = tf.batch_matmul(x, y, adj_x=adj_x, adj_y=adj_y)
    if (ndim(out) == 1):
        out = expand_dims(out, 1)
    return out

dataset/ETHPy150Open fchollet/keras/keras/backend/tensorflow_backend.py batch_dot/VarMisuse@33/322 `axes`->`y`