# tensorplay.testing.make_tensor Source: https://www.tensorplay.cn/docs/generated/tensorplay.testing.make_tensor.html ```python tensorplay.testing.make_tensor(*shape: int | Size | list[int] | tuple[int, ...], dtype: dtype, device: str | device, low: float | None = None, high: float | None = None, requires_grad: bool = False, noncontiguous: bool = False, exclude_zero: bool = False) → Tensor ``` Creates a tensor with the given shape, device, and dtype, filled with values drawn uniformly from [low, high). If low or high are outside the range of the dtype’s representable finite values, they are clamped to the lowest or highest representable finite value, respectively. If None, they default to -9 and 9 respectively (0 and 2 for bool). Parameters: - shape (Tuple[[int](https://docs.python.org/3/builtins/functions.html#int), ...]) – Single integer or a collection of integers defining the shape of the output tensor. - dtype ([tensorplay.dtype](/docs/generated/tensorplay.DType.html#tensorplay.DType)) – The data type of the returned tensor. - device (Union[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [tensorplay.device](/docs/generated/tensorplay.Device.html#tensorplay.Device)]) – The device of the returned tensor. - low (Optional[Number]) – Sets the lower limit of the range of the values in the returned tensor. - high (Optional[Number]) – Sets the upper limit of the range of the values in the returned tensor. - requires_grad ([bool](https://docs.python.org/3/builtins/functions.html#bool)) – If True, the returned tensor is set to require gradient. - noncontiguous ([bool](https://docs.python.org/3/builtins/functions.html#bool)) – If True, the returned tensor is non-contiguous. - exclude_zero ([bool](https://docs.python.org/3/builtins/functions.html#bool)) – If True, zeros in the returned tensor are replaced by the smallest normal value of the dtype (1 for boolean and integral dtypes). Raises: - [ValueError](https://docs.python.org/3/builtins/exceptions.html#ValueError) – If low >= high, or if the interval [low, high) does not intersect the dtype’s representable range. - [TypeError](https://docs.python.org/3/builtins/exceptions.html#TypeError) – For unsupported dtypes.