- Hands-On Artificial Intelligence for Beginners
- Patrick D. Smith
- 51字
- 2021-06-10 19:33:44
Scalar operations
Scalar operations involve a vector (or matrix) and a scalar. To perform an operation with a scalar on a matrix, simply apply to the scalar to every item in the matrix:

In Python, we would simply do the following:
vector = np.array([[1,2], [1,2]])
new_vector = vector + 2