[Numpy-discussion] Flag for np.tile to use as_strided to reduce memory

Sebastian Berg sebastian at sipsolutions.net
Fri Jun 19 13:39:49 EDT 2015


On Fr, 2015-06-19 at 10:06 +0200, Freddy Rietdijk wrote:
> Hi,
> 
> 
> Having read that it is possible to basically 'copy' elements along an
> axis without actually copying the values by making use of the strides,
> I wonder whether it is possible to add this as an option to np.tile.
> 

No, what tile does cannot be represented that way. If it was possible
you can achieve the same using `np.broadcast_to` basically, which was
just added though. There are some other things you can do, like rolling
window (adding dimensions), maybe some day we should add that (or you
want to take a shot ;)).

- Sebastian

> 
> It would be easier than having to use as_strided or broadcast_arrays
> to repeat data without actually replicating it.
> 
> 
> http://stackoverflow.com/questions/23695851/python-repeating-numpy-array-without-replicating-data
> 
> https://scipy-lectures.github.io/advanced/advanced_numpy/#example-fake-dimensions-with-strides
> 
> 
> 
> Frederik
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20150619/8791cf18/attachment.sig>


More information about the NumPy-Discussion mailing list