diff options
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/numeric.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 3e9b6c414..2c5265709 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -364,7 +364,7 @@ def full_like(a, fill_value, dtype=None, order='K', subok=True, shape=None): a : array_like The shape and data-type of `a` define these same attributes of the returned array. - fill_value : scalar + fill_value : array_like Fill value. dtype : data-type, optional Overrides the data type of the result. @@ -412,6 +412,12 @@ def full_like(a, fill_value, dtype=None, order='K', subok=True, shape=None): >>> np.full_like(y, 0.1) array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) + >>> y = np.zeros([2, 2, 3], dtype=int) + >>> np.full_like(y, [0, 0, 255]) + array([[[ 0, 0, 255], + [ 0, 0, 255]], + [[ 0, 0, 255], + [ 0, 0, 255]]]) """ res = empty_like(a, dtype=dtype, order=order, subok=subok, shape=shape) multiarray.copyto(res, fill_value, casting='unsafe') |