当前位置: 首页>>代码示例>>Python>>正文


Python LazyArray.evaluate方法代码示例

本文整理汇总了Python中pyNN.parameters.LazyArray.evaluate方法的典型用法代码示例。如果您正苦于以下问题:Python LazyArray.evaluate方法的具体用法?Python LazyArray.evaluate怎么用?Python LazyArray.evaluate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyNN.parameters.LazyArray的用法示例。


在下文中一共展示了LazyArray.evaluate方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_multiple_operations_with_structured_array

# 需要导入模块: from pyNN.parameters import LazyArray [as 别名]
# 或者: from pyNN.parameters.LazyArray import evaluate [as 别名]
def test_multiple_operations_with_structured_array():
    input = np.arange(12).reshape((4, 3))
    m0 = LazyArray(input, shape=(4, 3))
    m1 = (m0 + 2) < 5
    m2 = (m0 < 5) + 2
    assert_array_equal(m1.evaluate(simplify=True), (input + 2) < 5)
    assert_array_equal(m2.evaluate(simplify=True), (input < 5) + 2)
    assert_array_equal(m0.evaluate(simplify=True), input)
开发者ID:JoelChavas,项目名称:PyNN,代码行数:10,代码来源:test_parameters.py

示例2: test_evaluate_with_functional_array

# 需要导入模块: from pyNN.parameters import LazyArray [as 别名]
# 或者: from pyNN.parameters.LazyArray import evaluate [as 别名]
def test_evaluate_with_functional_array():
    input = lambda i,j: 2*i + j
    m = LazyArray(input, shape=(4,3))
    assert_array_equal(m.evaluate(),
                        np.array([[0, 1, 2],
                                     [2, 3, 4],
                                     [4, 5, 6],
                                     [6, 7, 8]]))
开发者ID:bernhardkaplan,项目名称:PyNN,代码行数:10,代码来源:test_parameters.py

示例3: test_setitem_nonexpanded_different_value

# 需要导入模块: from pyNN.parameters import LazyArray [as 别名]
# 或者: from pyNN.parameters.LazyArray import evaluate [as 别名]
def test_setitem_nonexpanded_different_value():
    A = LazyArray(3, shape=(5,))
    assert A.evaluate(simplify=True) == 3
    A[0] = 4
    A[4] = 5
    assert_array_equal(A.evaluate(simplify=True), np.array([4, 3, 3, 3, 5]))
开发者ID:JoelChavas,项目名称:PyNN,代码行数:8,代码来源:test_parameters.py

示例4: test_setitem_nonexpanded_same_value

# 需要导入模块: from pyNN.parameters import LazyArray [as 别名]
# 或者: from pyNN.parameters.LazyArray import evaluate [as 别名]
def test_setitem_nonexpanded_same_value():
    A = LazyArray(3, shape=(5,))
    assert A.evaluate(simplify=True) == 3
    A[0] = 3
    assert A.evaluate(simplify=True) == 3
开发者ID:JoelChavas,项目名称:PyNN,代码行数:7,代码来源:test_parameters.py

示例5: test_create_with_array

# 需要导入模块: from pyNN.parameters import LazyArray [as 别名]
# 或者: from pyNN.parameters.LazyArray import evaluate [as 别名]
def test_create_with_array():
    A = LazyArray(np.array([1, 2, 3]), shape=(3,))
    assert A.shape == (3,)
    assert_array_equal(A.evaluate(simplify=True), np.array([1, 2, 3]))
开发者ID:JoelChavas,项目名称:PyNN,代码行数:6,代码来源:test_parameters.py

示例6: test_create_with_float

# 需要导入模块: from pyNN.parameters import LazyArray [as 别名]
# 或者: from pyNN.parameters.LazyArray import evaluate [as 别名]
def test_create_with_float():
    A = LazyArray(3.0, shape=(5,))
    assert A.shape == (5,)
    assert A.evaluate(simplify=True) == 3.0
开发者ID:JoelChavas,项目名称:PyNN,代码行数:6,代码来源:test_parameters.py

示例7: test_lt_with_flat_array

# 需要导入模块: from pyNN.parameters import LazyArray [as 别名]
# 或者: from pyNN.parameters.LazyArray import evaluate [as 别名]
def test_lt_with_flat_array():
    m0 = LazyArray(5, shape=(4, 3))
    m1 = m0 < 10
    assert_equal(m1.evaluate(simplify=True), True)
    assert_equal(m0.evaluate(simplify=True), 5)
开发者ID:JoelChavas,项目名称:PyNN,代码行数:7,代码来源:test_parameters.py

示例8: test_iadd_with_flat_array

# 需要导入模块: from pyNN.parameters import LazyArray [as 别名]
# 或者: from pyNN.parameters.LazyArray import evaluate [as 别名]
def test_iadd_with_flat_array():
    m = LazyArray(5, shape=(4, 3))
    m += 2
    assert_array_equal(m.evaluate(), 7 * np.ones((4, 3)))
    assert_equal(m.base_value, 5)
    assert_equal(m.evaluate(simplify=True), 7)
开发者ID:JoelChavas,项目名称:PyNN,代码行数:8,代码来源:test_parameters.py

示例9: test_evaluate_with_structured_array

# 需要导入模块: from pyNN.parameters import LazyArray [as 别名]
# 或者: from pyNN.parameters.LazyArray import evaluate [as 别名]
def test_evaluate_with_structured_array():
    input = np.arange(12).reshape((4, 3))
    m = LazyArray(input, shape=(4, 3))
    assert_array_equal(m.evaluate(), input)
开发者ID:JoelChavas,项目名称:PyNN,代码行数:6,代码来源:test_parameters.py

示例10: test_evaluate_with_flat_array

# 需要导入模块: from pyNN.parameters import LazyArray [as 别名]
# 或者: from pyNN.parameters.LazyArray import evaluate [as 别名]
def test_evaluate_with_flat_array():
    m = LazyArray(5, shape=(4, 3))
    assert_array_equal(m.evaluate(), 5 * np.ones((4, 3)))
开发者ID:JoelChavas,项目名称:PyNN,代码行数:5,代码来源:test_parameters.py


注:本文中的pyNN.parameters.LazyArray.evaluate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。