Reputation: 14521
In many Machine Learning use cases, you need to create an array filled with zeros, with specific dimensions. In Python, I would use np.zeros((2, 1))
to create a 2x1 array. What is the analog version of this in Julia?
Upvotes: 6
Views: 22968
Reputation: 14521
In Julia, many of the operations from packages like numpy
are built into the standard library. In the case of creating an array of zeros, you can do the following:
julia> zeros(2, 1)
2×1 Matrix{Float64}:
0.0
0.0
You can read more about the zeros
function in the Julia docs.
Upvotes: 12