ttnn.arange
- ttnn.arange = Operation(python_fully_qualified_name='ttnn.arange', function=<ttnn._ttnn.operations.creation.arange_t object>, preprocess_golden_function_inputs=<function default_preprocess_golden_function_inputs>, golden_function=<function _golden_function>, postprocess_golden_function_outputs=<function default_postprocess_golden_function_outputs>, is_cpp_operation=True, is_experimental=False)
-
Creates a tensor with values ranging from start (inclusive) to end (exclusive) with a specified step size. The data type, device, and memory configuration of the resulting tensor can be specified.
- Parameters:
-
start (int, optional) – The start of the range. Defaults to 0.
end (int) – The end of the range (exclusive).
step (int, optional) – The step size between consecutive values. Defaults to 1.
dtype (ttnn.DataType, optional) – The data type of the tensor. Defaults to ttnn.bfloat16.
device (ttnn.Device, optional) – The device where the tensor will be allocated. Defaults to None.
memory_config (ttnn.MemoryConfig, optional) – The memory configuration for the tensor. Defaults to ttnn.DRAM_MEMORY_CONFIG.
- Returns:
-
ttnn.Tensor – A tensor containing evenly spaced values within the specified range.
Example
>>> tensor = ttnn.arange(start=0, end=10, step=2, dtype=ttnn.float32) >>> print(tensor) ttnn.Tensor([ 0.00000, 2.00000, ..., 6.00000, 8.00000], shape=Shape([5]), dtype=DataType::FLOAT32, layout=Layout::ROW_MAJOR)