pub struct BroadcastOperation<'c> { /* private fields */ }
Expand description
A broadcast
operation. Returns the broadcasted output shape of two or more inputs.
Returns the broadcasted shape for input shapes or extent tensors. The rest
of this description is simplified for the 2 input case but can be extended
to more inputs. Both operands can be of type shape.shape
or
tensor<?xindex>
. The result is of type shape.shape
and, if both
operands are tensors, may be of type tensor<?xindex>
.
If the two operand shapes are of different rank the smaller one is padded with 1’s from the left. The resulting broadcasted shape is then defined as
result[i] = lhs[i] if lhs[i] == rhs[i]
= lhs[i] if rhs[i] == 1
= rhs[i] if lhs[i] == 1.
In case the resulting shape is undefined, i.e. if corresponding extents are different from each other but none is 1, the result is an error shape. Likewise error values are propagated if any of the operands holds an error value. If the result type is an extent tensor (and can therefore not hold the error value) the behavior may be undefined. The optional string attribute can be used to describe the error case.
Implementations§
source§impl<'c> BroadcastOperation<'c>
impl<'c> BroadcastOperation<'c>
sourcepub fn as_operation(&self) -> &Operation<'c>
pub fn as_operation(&self) -> &Operation<'c>
Returns a generic operation.
sourcepub fn builder(
context: &'c Context,
location: Location<'c>
) -> BroadcastOperationBuilder<'c, Unset, Unset>
pub fn builder( context: &'c Context, location: Location<'c> ) -> BroadcastOperationBuilder<'c, Unset, Unset>
Creates a builder.