def testCplxNotEqualGPU(self):
shapes1 = [(5,4,3), (5,4), (1,), (5,)]
shapes2 = [(5,4,3), (1,), (5,4), (5,)]
for [sh0, sh1] in zip(shapes1, shapes2):
x = (np.random.randn(np.prod(sh0)) +
1j*np.random.randn(np.prod(sh0))).astype(np.complex64)
y = (np.random.randn(np.prod(sh1)) +
1j*np.random.randn(np.prod(sh1))).astype(np.complex64)
if len(sh0) == 1:
ix = np.random.permutation(
np.arange(np.prod(sh1)))[:np.prod(sh1)//2]
y[ix] = x[0]
elif len(sh1) == 1:
ix = np.random.permutation(
np.arange(np.prod(sh0)))[:np.prod(sh0)//2]
x[ix] = y[0]
else:
ix = np.random.permutation(
np.arange(np.prod(sh0)))[:np.prod(sh0)//2]
x[ix] = y[ix]
x = np.reshape(x, sh0)
y = np.reshape(y, sh1)
self._compareGpu(x, y, np.not_equal, tf.not_equal)
评论列表
文章目录