diag

diag(func, size=None)

Creates a diagonal tensor with func on its diagonal.

Parameters

Name Type Description Default
func Differentiable or scalar Symbolic object to set the diagonal to required
size size of the diagonal matrix (size x size). Defaults to the number of spatial dimensions when unspecified None
Back to top