提交 dba5c7a9 authored 作者: Frederic Bastien's avatar Frederic Bastien

merge

...@@ -67,6 +67,9 @@ class DimShuffle(Op): ...@@ -67,6 +67,9 @@ class DimShuffle(Op):
DimShuffle((False, False, False), [2, 0, 1]) -> AxBxC to CxAxB DimShuffle((False, False, False), [2, 0, 1]) -> AxBxC to CxAxB
DimShuffle((False, False), [0, 'x', 1]) -> AxB to Ax1xB DimShuffle((False, False), [0, 'x', 1]) -> AxB to Ax1xB
DimShuffle((False, False), [1, 'x', 0]) -> AxB to Bx1xA DimShuffle((False, False), [1, 'x', 0]) -> AxB to Bx1xA
The reordering of the dimensions can be done in numpy with the transpose function.
Adding, subtracting dimensions can be done with reshape.
""" """
def __init__(self, input_broadcastable, new_order, inplace = False): def __init__(self, input_broadcastable, new_order, inplace = False):
......
...@@ -1944,6 +1944,20 @@ def test_convert_to_complex(): ...@@ -1944,6 +1944,20 @@ def test_convert_to_complex():
b = value(numpy.ones(3, dtype='complex128')) b = value(numpy.ones(3, dtype='complex128'))
f = function([a],basic.convert_to_complex128(a)) f = function([a],basic.convert_to_complex128(a))
assert a.type.values_eq_approx(b.data, f(a.data)) assert a.type.values_eq_approx(b.data, f(a.data))
for t in ['int8','int16','int32','int64','float32']:
a = value(numpy.ones(3, dtype=t))
b = value(numpy.ones(3, dtype='complex64'))
f = function([a],basic.convert_to_complex64(a))
assert a.type.values_eq_approx(b.data, f(a.data))
#this work, but should we allow it? How well it is implemented?
for t in ['float64']:
a = value(numpy.ones(3, dtype=t))
b = value(numpy.ones(3, dtype='complex64'))
f = function([a],basic.convert_to_complex64(a))
assert a.type.values_eq_approx(b.data, f(a.data))
def test_bug_complext_10_august_09(): def test_bug_complext_10_august_09():
v0 = dmatrix() v0 = dmatrix()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论