Embed the last dimension of x as the diagonal of a new matrix.
Inverse of lucid.diagonal. For a 1-D input of length n
the result is shape (n+|offset|, n+|offset|). For batch
inputs the last axis is treated as the diagonal vector and
dim1 / dim2 pick which two axes of the output carry the
matrix.
Parameters
Diagonal values. Any shape; the last axis becomes the
diagonal of each output matrix.
offsetint= 0Diagonal offset.
0 (default) = main diagonal,
positive = above main, negative = below main. Output size
grows by |offset| along each matrix dimension.dim1int= -2First axis of the output matrix dimensions. Default
-2.dim2int= -1Second axis of the output matrix dimensions. Default
-1.Returns
TensorShape (*x.shape[:-1], n+|offset|, n+|offset|) (modulo the
dim1 / dim2 rotation). Non-diagonal positions are zero.