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


Python Composite.make_node方法代码示例

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


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

示例1: test_straightforward

# 需要导入模块: from theano.scalar.basic import Composite [as 别名]
# 或者: from theano.scalar.basic.Composite import make_node [as 别名]
 def test_straightforward(self):
     x, y, z = inputs()
     e = mul(add(x, y), div_proxy(x, y))
     C = Composite([x, y], [e])
     c = C.make_node(x, y)
     # print c.c_code(['x', 'y'], ['z'], dict(id = 0))
     g = FunctionGraph([x, y], [c.out])
     fn = gof.DualLinker().accept(g).make_function()
     assert fn(1.0, 2.0) == 1.5
开发者ID:DeepLearningIndia,项目名称:Theano,代码行数:11,代码来源:test_basic.py

示例2: test_with_constants

# 需要导入模块: from theano.scalar.basic import Composite [as 别名]
# 或者: from theano.scalar.basic.Composite import make_node [as 别名]
 def test_with_constants(self):
     x, y, z = inputs()
     e = mul(add(70.0, y), div_proxy(x, y))
     C = Composite([x, y], [e])
     c = C.make_node(x, y)
     assert "70.0" in c.op.c_code(c, 'dummy', ['x', 'y'], ['z'], dict(id = 0))
     # print c.c_code(['x', 'y'], ['z'], dict(id = 0))
     g = FunctionGraph([x, y], [c.out])
     fn = gof.DualLinker().accept(g).make_function()
     assert fn(1.0, 2.0) == 36.0
开发者ID:DeepLearningIndia,项目名称:Theano,代码行数:12,代码来源:test_basic.py

示例3: test_many_outputs

# 需要导入模块: from theano.scalar.basic import Composite [as 别名]
# 或者: from theano.scalar.basic.Composite import make_node [as 别名]
 def test_many_outputs(self):
     x, y, z = inputs()
     e0 = x + y + z
     e1 = x + y * z
     e2 = x / y
     C = Composite([x, y, z], [e0, e1, e2])
     c = C.make_node(x, y, z)
     # print c.c_code(['x', 'y', 'z'], ['out0', 'out1', 'out2'], dict(id = 0))
     g = FunctionGraph([x, y, z], c.outputs)
     fn = gof.DualLinker().accept(g).make_function()
     assert fn(1.0, 2.0, 3.0) == [6.0, 7.0, 0.5]
开发者ID:DeepLearningIndia,项目名称:Theano,代码行数:13,代码来源:test_basic.py

示例4: test_composite_printing

# 需要导入模块: from theano.scalar.basic import Composite [as 别名]
# 或者: from theano.scalar.basic.Composite import make_node [as 别名]
    def test_composite_printing(self):
        x, y, z = floats('xyz')
        e0 = x + y + z
        e1 = x + y * z
        e2 = x / y
        e3 = x // 5
        e4 = -x
        e5 = x - y
        e6 = x ** y + (-z)
        e7 = x % 3
        C = Composite([x, y, z], [e0, e1, e2, e3, e4, e5, e6, e7])
        c = C.make_node(x, y, z)
        g = FunctionGraph([x, y, z], c.outputs)
        fn = gof.DualLinker().accept(g).make_function()

        assert str(g) == ('[*1 -> Composite{((i0 + i1) + i2),'
                          ' (i0 + (i1 * i2)), (i0 / i1), '
                          '(i0 // Constant{5}), '
                          '(-i0), (i0 - i1), ((i0 ** i1) + (-i2)),'
                          ' (i0 % Constant{3})}(x, y, z), '
                          '*1::1, *1::2, *1::3, *1::4, *1::5, *1::6, *1::7]')
开发者ID:Abioy,项目名称:Theano,代码行数:23,代码来源:test_basic.py


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