batched_grad#
- scio.scores.utils.batched_grad(outputs, inputs, *, retain_graph=False)[source]#
Compute gradients for batched inputs/outputs.
- Parameters:
outputs (
Tensor) – Shape(n_samples,).inputs (
Tensor) – Shape(n_samples, *sample_shape).retain_graph (
bool) – Passed totorch.autograd.grad, defaults toFalse.
- Returns:
out (
Tensor) – Batched gradients, relative to batched inputs. Same shape asinputs.