Python wrappers
Public Python APIs implemented by this engine symbol.Autograd node for reshape, squeeze, and unsqueeze.
Forward reinterprets the flat element buffer under a new shape. The
backend dispatcher's reshape creates a new Storage alias over the same
physical buffer; no data movement occurs. Backward reshapes the incoming
gradient back to the original input shape recorded in input_shapes_[0];
because reshape is its own inverse on contiguous buffers (element ordering
is unchanged), the backward pass is simply another reshape call.
Math
where indices are taken in row-major flat ordering. The mapping between multi-dim indices changes, but the linear element ordering does not.
Shape
input_shapes_[0] — shape of the input tensor before the reshape.
out_shape_ — shape after the reshape (inherited from
FuncOp). Both must have identical element
counts.
See Also
reshape_op, squeeze_op, unsqueeze_op,
contiguous_op.
Parameters
grad_outStorageout_shape_).Attributes
schema_v1OpSchema"view", AmpPolicy::KeepInput, requires_grad=true, is_view=true.Notes
In graph mode apply_for_graph routes through reshape_op so the
reshape itself becomes a tracked node and the upstream gradient flow
participates in graph optimisation.
Methods
3Reshape grad_out from out_shape_ back to input_shapes_[0].
Graph-mode: reshape via reshape_op so the result is tracked.
Graph label — "reshape" — for debug printing and profiler traces. Overrides Node::node_name.