擅长:python、mysql、java
<p>根据<a href="https://numpy.org/doc/stable/reference/generated/numpy.empty.html" rel="nofollow noreferrer">documentation</a>报告:</p>
<blockquote>
<p>Return a new array of given shape and type, without initializing entries.</p>
<p><code>empty</code>, unlike <code>zeros</code>, does not set the array values to zero, and may therefore be marginally faster. On the other hand, it requires the user to manually set all the values in the array, and should be used with caution.</p>
</blockquote>
<p>如果您计划以任何方式写入所有值,那么它可能是<code>zeros</code>的替代方案</p>