本文整理汇总了Python中numpy.core._umath_tests.test_signature方法的典型用法代码示例。如果您正苦于以下问题:Python _umath_tests.test_signature方法的具体用法?Python _umath_tests.test_signature怎么用?Python _umath_tests.test_signature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类numpy.core._umath_tests
的用法示例。
在下文中一共展示了_umath_tests.test_signature方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_signature0
# 需要导入模块: from numpy.core import _umath_tests [as 别名]
# 或者: from numpy.core._umath_tests import test_signature [as 别名]
def test_signature0(self):
# the arguments to test_signature are: nin, nout, core_signature
enabled, num_dims, ixs, flags, sizes = umt.test_signature(
2, 1, "(i),(i)->()")
assert_equal(enabled, 1)
assert_equal(num_dims, (1, 1, 0))
assert_equal(ixs, (0, 0))
assert_equal(flags, (self.size_inferred,))
assert_equal(sizes, (-1,))
示例2: test_signature1
# 需要导入模块: from numpy.core import _umath_tests [as 别名]
# 或者: from numpy.core._umath_tests import test_signature [as 别名]
def test_signature1(self):
# empty core signature; treat as plain ufunc (with trivial core)
enabled, num_dims, ixs, flags, sizes = umt.test_signature(
2, 1, "(),()->()")
assert_equal(enabled, 0)
assert_equal(num_dims, (0, 0, 0))
assert_equal(ixs, ())
assert_equal(flags, ())
assert_equal(sizes, ())
示例3: test_signature2
# 需要导入模块: from numpy.core import _umath_tests [as 别名]
# 或者: from numpy.core._umath_tests import test_signature [as 别名]
def test_signature2(self):
# more complicated names for variables
enabled, num_dims, ixs, flags, sizes = umt.test_signature(
2, 1, "(i1,i2),(J_1)->(_kAB)")
assert_equal(enabled, 1)
assert_equal(num_dims, (2, 1, 1))
assert_equal(ixs, (0, 1, 2, 3))
assert_equal(flags, (self.size_inferred,)*4)
assert_equal(sizes, (-1, -1, -1, -1))
示例4: test_signature3
# 需要导入模块: from numpy.core import _umath_tests [as 别名]
# 或者: from numpy.core._umath_tests import test_signature [as 别名]
def test_signature3(self):
enabled, num_dims, ixs, flags, sizes = umt.test_signature(
2, 1, u"(i1, i12), (J_1)->(i12, i2)")
assert_equal(enabled, 1)
assert_equal(num_dims, (2, 1, 2))
assert_equal(ixs, (0, 1, 2, 1, 3))
assert_equal(flags, (self.size_inferred,)*4)
assert_equal(sizes, (-1, -1, -1, -1))
示例5: test_signature4
# 需要导入模块: from numpy.core import _umath_tests [as 别名]
# 或者: from numpy.core._umath_tests import test_signature [as 别名]
def test_signature4(self):
# matrix_multiply signature from _umath_tests
enabled, num_dims, ixs, flags, sizes = umt.test_signature(
2, 1, "(n,k),(k,m)->(n,m)")
assert_equal(enabled, 1)
assert_equal(num_dims, (2, 2, 2))
assert_equal(ixs, (0, 1, 1, 2, 0, 2))
assert_equal(flags, (self.size_inferred,)*3)
assert_equal(sizes, (-1, -1, -1))
示例6: test_signature6
# 需要导入模块: from numpy.core import _umath_tests [as 别名]
# 或者: from numpy.core._umath_tests import test_signature [as 别名]
def test_signature6(self):
enabled, num_dims, ixs, flags, sizes = umt.test_signature(
1, 1, "(3)->()")
assert_equal(enabled, 1)
assert_equal(num_dims, (1, 0))
assert_equal(ixs, (0,))
assert_equal(flags, (0,))
assert_equal(sizes, (3,))
示例7: test_signature7
# 需要导入模块: from numpy.core import _umath_tests [as 别名]
# 或者: from numpy.core._umath_tests import test_signature [as 别名]
def test_signature7(self):
enabled, num_dims, ixs, flags, sizes = umt.test_signature(
3, 1, "(3),(03,3),(n)->(9)")
assert_equal(enabled, 1)
assert_equal(num_dims, (1, 2, 1, 1))
assert_equal(ixs, (0, 0, 0, 1, 2))
assert_equal(flags, (0, self.size_inferred, 0))
assert_equal(sizes, (3, -1, 9))
示例8: test_signature8
# 需要导入模块: from numpy.core import _umath_tests [as 别名]
# 或者: from numpy.core._umath_tests import test_signature [as 别名]
def test_signature8(self):
enabled, num_dims, ixs, flags, sizes = umt.test_signature(
3, 1, "(3?),(3?,3?),(n)->(9)")
assert_equal(enabled, 1)
assert_equal(num_dims, (1, 2, 1, 1))
assert_equal(ixs, (0, 0, 0, 1, 2))
assert_equal(flags, (self.can_ignore, self.size_inferred, 0))
assert_equal(sizes, (3, -1, 9))
示例9: test_signature_failure0
# 需要导入模块: from numpy.core import _umath_tests [as 别名]
# 或者: from numpy.core._umath_tests import test_signature [as 别名]
def test_signature_failure0(self):
# in the following calls, a ValueError should be raised because
# of error in core signature
# FIXME These should be using assert_raises
# error: extra parenthesis
msg = "core_sig: extra parenthesis"
try:
ret = umt.test_signature(2, 1, "((i)),(i)->()")
assert_equal(ret, None, err_msg=msg)
except ValueError:
pass
示例10: test_signature_failure1
# 需要导入模块: from numpy.core import _umath_tests [as 别名]
# 或者: from numpy.core._umath_tests import test_signature [as 别名]
def test_signature_failure1(self):
# error: parenthesis matching
msg = "core_sig: parenthesis matching"
try:
ret = umt.test_signature(2, 1, "(i),)i(->()")
assert_equal(ret, None, err_msg=msg)
except ValueError:
pass
示例11: test_signature_failure3
# 需要导入模块: from numpy.core import _umath_tests [as 别名]
# 或者: from numpy.core._umath_tests import test_signature [as 别名]
def test_signature_failure3(self):
# error: incomplete signature. 2 output arguments are specified
msg = "core_sig: incomplete signature"
try:
ret = umt.test_signature(2, 2, "(i),(i)->()")
assert_equal(ret, None, err_msg=msg)
except ValueError:
pass