BatchMatMul
tensorflow C++ API
Multiplies slices of two tensors in batches.
Summary
Multiplies all slices ofTensor
x
andy
(each slice can be viewed as an element of a batch), and arranges the individual results in a single output tensor of the same batch size. Each of the individual slices can optionally be adjointed (to adjoint a matrix means to transpose and conjugate it) before multiplication by setting theadj_x
oradj_y
flag toTrue
, which are by defaultFalse
.
The input tensorsx
andy
are 2-D or higher with shape[..., r_x, c_x]
and[..., r_y, c_y]
.
The output tensor is 2-D or higher with shape[..., r_o, c_o]
, where:
r_o = c_x if adj_x else r_x
c_o = r_y if adj_y else c_y
It is computed as:
output
[...,:,:]= matrix(x[...,:,:])* matrix(y[...,:,:])
Arguments:
scope: A Scope object
x: 2-D or higher with shape
[..., r_x, c_x]
.y: 2-D or higher with shape
[..., r_y, c_y]
Optional attributes (seeAttrs
):
- adj_x: If
True
, adjoint the slices ofx
. Defaults toFalse
. - adj_y: If
True
, adjoint the slices ofy
. Defaults toFalse
.
Returns:
Output
: 3-D or higher with shape[..., r_o, c_o]
Constructor
- BatchMatMul(const ::tensorflow::Scope & scope, ::tensorflow::Input y, ::tensorflow::Input x,const BatchMatMul::Attrs & attrs).
Public attributes
- tensorflow::Output z.
BatchMatMul block
Source link : https://github.com/EXPNUNI/enuSpaceTensorflow/blob/master/enuSpaceTensorflow/tf_math.cpp
Argument:
- Scope scope : A Scope object (A scope is generated automatically each page. A scope is not connected.)
- Input y :connect Input node.
- Input x :connect Input node.
- BatchMatMul::Attrs attrs : Input attrs value. ex) adj_x_=false;adj_y_=false;
Return:
- Output z : Output object of BatchMatMul class object.
Result:
- std::vector(Tensor) product_result : Returned object of executed result by calling session.
Using Method
adj_x_ = false;adj_y_ = false;