• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python tools.np_equal函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tools.np_equal函数的典型用法代码示例。如果您正苦于以下问题:Python np_equal函数的具体用法?Python np_equal怎么用?Python np_equal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: test_5

 def test_5(self):
     n = 10
     Z = np.random.random(n)
     K = np.random.random(n)
     Z1 = DenseConnection(Z,Z,K,toric=True).output()
     Z2 = SharedConnection(Z,Z,K,toric=True,fft=False).output()
     Z3 = SharedConnection(Z,Z,K,toric=True,fft=True).output()
     Z4 = convolve(Z, K[::-1], mode='wrap')
     assert np_equal(Z1,Z4)
     assert np_equal(Z2,Z4)
     assert np_equal(Z3,Z4)
开发者ID:B-Rich,项目名称:dana,代码行数:11,代码来源:connection.py


示例2: test_7

 def test_7(self):
     n = 9
     Z = np.random.random(n)
     K = np.random.random(n//2)
     Z1 = DenseConnection(Z,Z,K,toric=False).output()
     Z2 = SharedConnection(Z,Z,K,toric=False,fft=False).output()
     Z3 = SharedConnection(Z,Z,K,toric=False,fft=True).output()
     Z4 = convolve(Z, K[::-1], mode='constant')
     assert np_equal(Z1,Z4)
     assert np_equal(Z2,Z4)
     assert np_equal(Z3,Z4)
开发者ID:B-Rich,项目名称:dana,代码行数:11,代码来源:connection.py


示例3: test_12

 def test_12(self):
     n = 10
     Z = np.random.random((n,n))
     K = np.random.random((2*n,2*n))
     Z1 = DenseConnection(Z,Z,K,toric=False).output()
     Z2 = SparseConnection(Z,Z,K,toric=False).output()
     Z3 = SharedConnection(Z,Z,K,toric=False,fft=False).output()
     Z4 = SharedConnection(Z,Z,K,toric=False,fft=True).output()
     Z5 = convolve(Z, K[::-1,::-1], mode='constant')
     assert np_equal(Z1,Z5)
     assert np_equal(Z2,Z5)
     assert np_equal(Z3,Z5)
     assert np_equal(Z4,Z5)
开发者ID:B-Rich,项目名称:dana,代码行数:13,代码来源:connection.py


示例4: test_1

 def test_1(self):
     n = 9
     Z = np.random.random((n,n))
     K = np.random.random((n//2,n//2))
     Z1 = DenseConnection(Z,Z,K,toric=True).output()
     Z2 = SparseConnection(Z,Z,K,toric=True).output()
     Z3 = SharedConnection(Z,Z,K,toric=True,fft=False).output()
     Z4 = SharedConnection(Z,Z,K,toric=True,fft=True).output()
     Z5 = convolve(Z, K[::-1,::-1], mode='wrap')
     assert np_equal(Z1,Z5)
     assert np_equal(Z2,Z5)
     assert np_equal(Z3,Z5)
     assert np_equal(Z4,Z5)
开发者ID:B-Rich,项目名称:dana,代码行数:13,代码来源:connection.py


示例5: test_6

 def test_6(self):
     n = 10
     Z = np.random.random((n,n))
     K = np.random.random((2*n,2*n))
     Z1 = DenseConnection(Z,Z,K,toric=True).output()
     Z2 = SparseConnection(Z,Z,K,toric=True).output()
     Z3 = SharedConnection(Z,Z,K,toric=True,fft=False).output()
     Z4 = SharedConnection(Z,Z,K,toric=True,fft=True).output()
     K_ = K[5:15,5:15]
     Z5 = convolve(Z, K_[::-1,::-1], mode='wrap')
     assert np_equal(Z1,Z5)
     assert np_equal(Z2,Z5)
     assert np_equal(Z3,Z5)
     assert np_equal(Z4,Z5)
开发者ID:B-Rich,项目名称:dana,代码行数:14,代码来源:connection.py


示例6: test_7

 def test_7(self):
     assert np_equal( Connection(ones((3,3)), ones((3,3)), array([[1, 1, 1],
                                                                  [1,NaN,1],
                                                                  [1, 1, 1]])).output(),
                      array([[3,5,3],
                             [5,8,5],
                             [3,5,3]]))
开发者ID:B-Rich,项目名称:dana,代码行数:7,代码来源:sparse_connection.py


示例7: test_5

 def test_5(self):
     assert np_equal( Connection(ones((3,3)), ones((5,5)), ones((3,3))).output(),
                      array([[4,4,6,4,4],
                             [4,4,6,4,4],
                             [6,6,9,6,6],
                             [4,4,6,4,4],
                             [4,4,6,4,4]]))
开发者ID:B-Rich,项目名称:dana,代码行数:7,代码来源:sparse_connection.py


示例8: test_1

 def test_1(self):
     G = Group(5, 'V = I; I')
     Z = np.ones(5)
     DenseConnection(Z, G('I'), 1)
     DenseConnection(Z, G('I'), 2)
     G.run()
     assert np_equal(3*np.ones(5),G('V'))
开发者ID:B-Rich,项目名称:dana,代码行数:7,代码来源:group.py


示例9: test_mask_shape_2

 def test_mask_shape_2(self):
     mask = np.ones((3,3))
     mask[1,1] = 0
     self.Z.mask = mask
     self.Z[...] = 1
     self.Z.setup()
     assert np_equal(self.Z.f0,mask)
开发者ID:B-Rich,项目名称:dana,代码行数:7,代码来源:group.py


示例10: test_4

 def test_4(self):
     src = np.ones((3,))
     dst = zeros((3,) , 'V=I; I')
     kernel = np.ones(1)
     C = DenseConnection(src, dst('I'), kernel,
                          equation = 'dW/dt = post.I')
     dst.run(dt=0.1)
     assert np_equal(C.weights, np.identity(3)*1.1)
开发者ID:B-Rich,项目名称:dana,代码行数:8,代码来源:learning.py


示例11: test_3

 def test_3(self):
     kernel = np.ones(3)
     kernel[1] = np.NaN
     C = SparseConnection(np.ones(3), np.ones(3), kernel,
                          equation = 'dW/dt = 1')
     C.evaluate(dt=0.1)
     assert np_equal(C.weights, np.array([[0,1,0],
                                          [1,0,1],
                                          [0,1,0]])*1.1)
开发者ID:B-Rich,项目名称:dana,代码行数:9,代码来源:learning.py


示例12: test_12

 def test_12(self):
     Z = ones((5,5))
     K = arange(5*5).reshape((5,5))
     C = Connection(Z,Z,K)
     assert np_equal(C[0,0],
                     array([[12, 13, 14,NaN,NaN],
                            [17, 18, 19,NaN,NaN],
                            [22, 23, 24,NaN,NaN],
                            [NaN,NaN,NaN,NaN,NaN],
                            [NaN,NaN,NaN,NaN,NaN]]))
开发者ID:B-Rich,项目名称:dana,代码行数:10,代码来源:sparse_connection.py


示例13: test_13

 def test_13(self):
     Z = ones((5,5))
     K = arange(5*5).reshape((5,5))
     C = Connection(Z,Z,K)
     assert np_equal(C[0,4],
                     array([[NaN,NaN,10, 11, 12],
                            [NaN,NaN,15, 16, 17],
                            [NaN,NaN,20, 21, 22],
                            [NaN,NaN,NaN,NaN,NaN],
                            [NaN,NaN,NaN,NaN,NaN]]))
开发者ID:B-Rich,项目名称:dana,代码行数:10,代码来源:sparse_connection.py


示例14: test_14

 def test_14(self):
     Z = ones((5,5))
     K = arange(5*5).reshape((5,5))
     C = Connection(Z,Z,K)
     assert np_equal(C[4,0],
                     array([[NaN,NaN,NaN,NaN,NaN],
                            [NaN,NaN,NaN,NaN,NaN],
                            [  2,  3,  4,NaN,NaN],
                            [  7,  8,  9,NaN,NaN],
                            [ 12, 13, 14,NaN,NaN]]))
开发者ID:B-Rich,项目名称:dana,代码行数:10,代码来源:sparse_connection.py


示例15: test_15

 def test_15(self):
     Z = ones((5,5))
     K = arange(5*5).reshape((5,5))
     C = Connection(Z,Z,K)
     assert np_equal(C[4,4],
                     array([[NaN,NaN,NaN,NaN,NaN],
                            [NaN,NaN,NaN,NaN,NaN],
                            [NaN,NaN,  0,  1,  2],
                            [NaN,NaN,  5,  6,  7],
                            [NaN,NaN, 10, 11, 12]]))
开发者ID:B-Rich,项目名称:dana,代码行数:10,代码来源:sparse_connection.py


示例16: test_3

 def test_3(self):
     net = Network(Clock(0.0, 1.0, 0.001))
     src = Group((1,), 'dV/dt=1')
     src[...] = 1
     dst = Group((1,) , 'I')
     dst[...] = 0
     kernel = np.ones(1)
     C = DenseConnection(src('V'), dst('I'), kernel)
     net.append(src)
     net.append(dst)
     V,I=[],[]
     @net.clock.every(0.1,order=-1)
     def do(t):
         V.append(src['V'][0])
         I.append(dst['I'][0])
     net.run(time=1.0, dt=0.1)
     assert np_equal(np.array(V),
                     [1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0])
     assert np_equal(np.array(I),
                     [0.0,1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9])
开发者ID:B-Rich,项目名称:dana,代码行数:20,代码来源:network.py


示例17: test_6

 def test_6(self):
     assert np_equal( Connection(ones(5), ones(3), ones(3)).output(),
                      array([2,3,2]))
开发者ID:B-Rich,项目名称:dana,代码行数:3,代码来源:sparse_connection.py


示例18: test_16

 def test_16(self):
     Z = ones((5,5))
     K = arange(5*5).reshape((5,5))
     C = Connection(Z,Z,K)
     assert np_equal(C[2,2],K)
开发者ID:B-Rich,项目名称:dana,代码行数:5,代码来源:sparse_connection.py


示例19: test_3

 def test_3(self):
     assert np_equal( Connection(ones(5), ones(3), ones(1)).output(),
                      ones(3))
开发者ID:B-Rich,项目名称:dana,代码行数:3,代码来源:sparse_connection.py


示例20: test_9

 def test_9(self):
     assert np_equal( Connection(ones(3), ones(3), ones((3,3))).output(),
                      3*ones(3))
开发者ID:B-Rich,项目名称:dana,代码行数:3,代码来源:sparse_connection.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python tools.package函数代码示例发布时间:2022-05-27
下一篇:
Python tools.new_node函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap