On Fri, Sep 6, 2013 at 6:50 PM, James Bergstra
wrote:
>
> Thanks, this is exactly what I was looking for. I'll look into what this
Diophantine equation is.
Let's say we have two arrays with shape tuples `shape0` and `shape1`,
stride tuples `stride0` and `stride1` and memory offsets `offset0` and
I'm stumped. I can't figure out how to extract from e.g.
view = A[:, 3]
that the view starts at element 3 of A. I was planning to make a
may_share_memory implementation based on the idea of swapping in a buffer
of 0s, and using the shapes, strides, itemsize etc. to increment just the
parts of the
Thanks, this is exactly what I was looking for. I'll look into what this
Diophantine equation is. Also, relatedly, a few months ago Julian Taylor at
least wrote what was there in C, which made it faster, if not better.
- James
On Fri, Sep 6, 2013 at 1:27 PM, Robert Kern wrote:
> On Fri, Sep 6,
Hi, could someone help me understand why this assertion fails?
def test_is(self):
a = np.empty(1)
b = np.empty(1)
if a.data is not b.data:
assert id(a.data) != id(b.data) # <-- fail
I'm trying to write an alternate may_share_memory function.
Thanks,
- James
_
Thanks for the tips! FWIW my guess is that since '.data' is dynamically
generated property rather than an attribute, it is being freed and
re-allocated in the loop, and once for each of my id() expressions.
On Fri, Sep 6, 2013 at 12:32 PM, Charles R Harris wrote:
>
>
>
> On Fri, Sep 6, 2013 at
On Fri, Sep 6, 2013 at 5:58 PM, James Bergstra
wrote:
>
> I'm stumped. I can't figure out how to extract from e.g.
>
> view = A[:, 3]
>
> that the view starts at element 3 of A. I was planning to make a
may_share_memory implementation based on the idea of swapping in a buffer
of 0s, and using the
On Fri, Sep 6, 2013 at 10:19 AM, James Bergstra
wrote:
> Hi, could someone help me understand why this assertion fails?
>
> def test_is(self):
> a = np.empty(1)
> b = np.empty(1)
> if a.data is not b.data:
> assert id(a.data) != id(b.data) # <-- fail
>
> I'm trying to write an
On Fri, Sep 6, 2013 at 9:19 AM, James Bergstra wrote:
> def test_is(self):
> a = np.empty(1)
> b = np.empty(1)
> if a.data is not b.data:
> assert id(a.data) != id(b.data) # <-- fail
>
>
I'm not familiar with the internals, but:
In [27]: a = np.empty(1)
In [28]: a.data
Out[28
The .data attribute is generated on the fly when accessed. So it returns an
anonymous temporary that's deallocated as soon as it's no longer needed.
a.data is b.data needs both objects, so both get allocated and then
compared. In the second one though, each object gets allocated one at a
time and