ClikaRT::ops::linspace
function
linspace()
Tensor linspace(
ScalarOrTensor start,
ScalarOrTensor end,
ScalarOrTensor steps,
DataType dtype = DataType::Float32,
StreamOrDevice s = {}
)
steps evenly spaced values from start to end, ENDPOINTS INCLUDED.
out[i] = start + i * (end - start) / (steps - 1); the last element is exactly end; steps = 1 yields just start. Contrast arange, whose upper bound is exclusive. Bounds and count are literals or 0-D Tensors (trace symbolically).
Parameters
start: first value.end: last value (inclusive).steps: number of samples.dtype: element type. DefaultDataType::Float32.s: stream or device. Default: the default device.
Throws
ClikaRT::Error: (INVALID_ARGUMENT) whenstepsis negative or not a scalar count (code_name()carries the reason).
Returns: a new 1-D tensor of steps elements.
auto grid = ClikaRT::ops::linspace(0.0, 1.0, 33); // 0, 1/32, .., 1
Declared in ClikaRT/compute/ops.h, line 2348