def relabeled

bendtorch-core@0.1.0.0 · src/autograd/tensor_backward.bend:288

import bendtorch-core@0.1.0.0/src/autograd/tensor_backward.bend as TensorBackward
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core

288# g with the dimensions of `shape`, which has as many elements: a reshape,
289# which moves no word. A g with another element count keeps its own.
290def relabeled(+shape: Shape.Shape, gradient: Core.Dynamic) -> Core.Dynamic:
291  Core.Packed{+held, tensor} = gradient
292  relabel_decided(held, shape, tensor, Shape.bool_case(Nat.is_eq(Shape.elements(held), Shape.elements(shape))))

Uses (6)

Used by (1)