k_batch_dot: Batchwise dot product.

View source: R/backend.R

k_batch_dotR Documentation

Batchwise dot product.

Description

batch_dot is used to compute dot product of x and y when x and y are data in batch, i.e. in a shape of (batch_size). batch_dot results in a tensor or variable with less dimensions than the input. If the number of dimensions is reduced to 1, we use expand_dims to make sure that ndim is at least 2.

Usage

k_batch_dot(x, y, axes)

Arguments

x

Keras tensor or variable with 2 more more axes.

y

Keras tensor or variable with 2 or more axes

axes

List of (or single) integer with target dimensions (axis indexes are 1-based). The lengths of axes[[1]] and axes[[2]] should be the same.

Value

A tensor with shape equal to the concatenation of x's shape (less the dimension that was summed over) and y's shape (less the batch dimension and the dimension that was summed over). If the final rank is 1, we reshape it to ⁠(batch_size, 1)⁠.

Keras Backend

This function is part of a set of Keras backend functions that enable lower level access to the core operations of the backend tensor engine (e.g. TensorFlow, CNTK, Theano, etc.).

You can see a list of all available backend functions here: https://tensorflow.rstudio.com/reference/keras/index.html#backend.


keras documentation built on May 29, 2024, 3:20 a.m.