Theano/libgpuarray

== and != do not work as expected

Opened this issue · 1 comments

Here is a MWE that shows the equal method is not defined properly in libgpyarray main class:

import pygpu
ctx = pygpu.init("cuda")
g1 = pygpu.zeros((2, 2), context=ctx)
g2 = pygpu.zeros((2, 2), context=ctx)
print g1 == g2

-> False

if the class is defined as pygpu._array.ndgpuarray, it works as expected:

import pygpu
ctx = pygpu.init("cuda")
g1 = pygpu.zeros((2, 2), context=ctx, cls=pygpu._array.ndgpuarray)
g2 = pygpu.zeros((2, 2), context=ctx, cls=pygpu._array.ndgpuarray)
print g1 == g2

-> [[ True True] [ True True]]

To fix this we should port the functionality of ndgpuarray to the base Cython class. This should be doable now that GpuElemewise is available in C.