# tensorplay.functional.sub Source: https://www.tensorplay.cn/docs/generated/tensorplay.functional.sub.html ```python tensorplay.functional.sub(input, other, *, alpha=1, out=None) → Tensor ``` Subtracts other, scaled by alpha, from input. $$\text{{out}}_i = \text{{input}}_i - \text{{alpha}} \times \text{{other}}_i$$ Supports [broadcasting to a common shape](/docs/notes/broadcasting.html#broadcasting-semantics), type promotion, and integer, float, and complex inputs. Parameters: - input ([Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor)) – the input tensor. - other ([Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor) or Number) – the tensor or number to subtract from input. Keyword Arguments: - alpha (Number) – the multiplier for other. - out ([Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor), optional) – the output tensor. Example: ``` >>> a = tensorplay.tensor((1, 2)) >>> b = tensorplay.tensor((0, 1)) >>> tensorplay.sub(a, b, alpha=2) tensor([1, 0]) ```