def seeds

bendtorch-core@0.1.0.0 · src/autograd/tensor_chain_LAWS.bend:147

import bendtorch-core@0.1.0.0/src/autograd/tensor_chain_LAWS.bend as TensorChainLAWS
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
import bendtorch-core@0.1.0.0/src/autograd/gradient.bend as Gradient
import bendtorch-core@0.1.0.0/src/autograd/tensor_backward.bend as Backward

147# The starting working gradients of a backward from the entry with older
148# entries below it and newer entries above it: no gradient for the newer
149# entries, ones of the output's shape at the output, as PyTorch's
150# backward(torch.ones_like(output)), and no gradient below.
151def seeds(+newer: Nat, +shape: Shape.Shape, ones: Core.Tensor<shape>, +older: Nat) -> List<&1, Gradient.Slot>:
152  List.append(&1, Gradient.Slot, Backward.unsets(newer), Gradient.Held{Core.Packed{shape, ones}} <> Backward.unsets(older))

Uses (8)

Used by (2)