Skip to main content

ClikaRT::ops::diag_embed

function

diag_embed()

Tensor diag_embed(
    Tensor x,
    int64_t offset = 0,
    int64_t dim1 = -2,
    int64_t dim2 = -1
)

Embed the LAST dim along the diagonal of a fresh (dim1, dim2) plane: output rank = input rank + 1, both new dims sized last + |offset|, the inverse of diagonal. Defaults place the plane at the trailing two dims. Copies.

Throws

  • ClikaRT::Error: (INVALID_ARGUMENT) when dim1/dim2 collide or exceed the output rank (code_name() carries the reason).

Returns: a new tensor of rank + 1.

Declared in ClikaRT/compute/ops.h, line 3132