Calculates the scalar multiplication of a tensor.