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

Python basic_ops.as_gpuarray_variable函数代码示例

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

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



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

示例1: make_node

 def make_node(self, y, alpha, A, x, beta):
     res = Gemv.make_node(self, y, alpha, A, x, beta)
     A = as_gpuarray_variable(A)
     x = as_gpuarray_variable(x)
     y = as_gpuarray_variable(y)
     assert A.dtype == x.dtype == y.dtype == alpha.dtype == beta.dtype
     return Apply(self, [y, alpha, A, x, beta], [y.type()])
开发者ID:EricChanBD,项目名称:Theano,代码行数:7,代码来源:blas.py


示例2: make_node

 def make_node(self, A, alpha, x, y):
     res = Ger.make_node(self, A, alpha, x, y)
     A = as_gpuarray_variable(A)
     x = as_gpuarray_variable(x)
     y = as_gpuarray_variable(y)
     assert A.dtype == x.dtype == y.dtype
     return Apply(self, [A, alpha, x, y], [A.type()])
开发者ID:317070,项目名称:Theano,代码行数:7,代码来源:blas.py


示例3: make_node

 def make_node(self, x, y, *inputs):
     x = as_gpuarray_variable(x)
     y = as_gpuarray_variable(y)
     rval = tensor.IncSubtensor.make_node(self, x, y, *inputs)
     op = copy.copy(self)
     ret = gof.Apply(op, [x, y] + rval.inputs[2:], [x.type()])
     op.create_iadd_node(ret)
     return ret
开发者ID:Dimitris0mg,项目名称:Theano,代码行数:8,代码来源:subtensor.py


示例4: make_node

 def make_node(self, x, b, y_idx):
     # N.B. won't work when we don't cast y_idx to float anymore
     x = as_gpuarray_variable(x)
     b = as_gpuarray_variable(b)
     y_idx = as_gpuarray_variable(y_idx)
     nll = GpuArrayType(x.type.dtype, y_idx.type.broadcastable)()
     sm = x.type()
     am = y_idx.type()
     return Apply(self, [x, b, y_idx], [nll, sm, am])
开发者ID:hphp,项目名称:Theano,代码行数:9,代码来源:nnet.py


示例5: make_node

 def make_node(self, img, kern):
     if img.dtype != "float32" or kern.dtype != "float32":
         raise NotImplementedError("GpuConv currently only work"
                                   " with float32 dtype")
     if img.type.ndim != 4:
         raise TypeError('img must be 4D tensor')
     if kern.type.ndim != 4:
         raise TypeError('kern must be 4D tensor')
     img = as_gpuarray_variable(img)
     kern = as_gpuarray_variable(kern)
     broadcastable = [img.type.broadcastable[0], kern.type.broadcastable[0],
                      False, False]
     out = GpuArrayType(img.dtype, broadcastable)()
     return gof.Apply(self, [img, kern], [out])
开发者ID:317070,项目名称:Theano,代码行数:14,代码来源:conv.py


示例6: make_node

    def make_node(self, *inputs):
        res = Elemwise.make_node(self, *inputs)
        outputs = [GpuArrayType(broadcastable=o.type.broadcastable,
                                dtype=o.type.dtype)() for o in res.outputs]
        inputs = [as_gpuarray_variable(i) for i in inputs]
        node = Apply(self, inputs, outputs)

        # Try to generate the kernel to catch SupportCodeErrors
        try:
            inps = [make_argument(i, 'i%d' % (n,)) for n, i in
                    enumerate(node.inputs)]
            scal_ins = [scalar.Scalar(i.dtype) for i in node.inputs]

            outs = [make_argument(o, 'o%d' % (n,)) for n, o in
                    enumerate(node.outputs) if not n in self.inplace_pattern]
            scal_out = [scalar.Scalar(o.dtype) for o in node.outputs]

            fake_node = Apply(self.scalar_op, [i() for i in scal_ins],
                              [o() for o in scal_out])
            code = self.scalar_op.c_support_code_apply(fake_node, "test")
            if code:
                raise SupportCodeError(code)
        except MethodNotDefined:
            pass
        try:
            support_code = self.scalar_op.c_support_code()
            if (support_code.strip() != "#define THEANO_MACRO_MOD(x,y) (x % y)" and
                support_code.strip() != ""):
                # The macro is fine, the C++ struct is not.
                raise SupportCodeError(support_code)
        except MethodNotDefined:
            pass

        return node
开发者ID:Donghuan,项目名称:Theano,代码行数:34,代码来源:elemwise.py


示例7: make_node

 def make_node(self, *inputs):
     res = Elemwise.make_node(self, *inputs)
     outputs = [GpuArrayType(broadcastable=o.type.broadcastable,
                             dtype=o.type.dtype)() for o in res.outputs]
     inputs = [as_gpuarray_variable(i) for i in inputs]
     res = Apply(self, inputs, outputs)
     # Try to generate the kernel to catch SupportCodeErrors
     k = self.generate_kernel(res, 'test')
     return res
开发者ID:SamuelZeng,项目名称:Theano,代码行数:9,代码来源:elemwise.py


示例8: make_node

    def make_node(self, x, y, ilist):
        """It defer from GpuAdvancedIncSubtensor1 in that it make sure
        the index are of type long.
        """
        x_ = as_gpuarray_variable(x)
        y_ = as_gpuarray_variable(y)
        ilist_ = as_gpuarray_variable(ilist)

        assert x_.type.dtype == y_.type.dtype
        assert x_.type.ndim >= y_.type.ndim

        if ilist_.type.dtype[:3] not in ("int", "uin"):
            raise TypeError("index must be integers")
        if ilist_.type.broadcastable != (False,):
            raise TypeError("index must be vector")
        if x_.type.ndim == 0:
            raise TypeError("cannot index into a scalar")
        if x_.type.broadcastable[0]:
            # the caller should have made a copy of x len(ilist) times
            raise TypeError("cannot index into a broadcastable dimension")

        return gof.Apply(self, [x_, y_, ilist_], [x_.type()])
开发者ID:dwf,项目名称:Theano,代码行数:22,代码来源:subtensor.py


示例9: make_node

    def make_node(self, ten4, neib_shape, neib_step):
        ten4 = as_gpuarray_variable(ten4)
        neib_shape = T.as_tensor_variable(neib_shape)
        neib_step = T.as_tensor_variable(neib_step)

        assert ten4.ndim == 4
        assert neib_shape.ndim == 1
        assert neib_step.ndim == 1
        assert "int" in neib_shape.dtype
        assert "int" in neib_step.dtype

        return Apply(self, [ten4, neib_shape, neib_step],
                     [GpuArrayType(broadcastable=(False, False),
                                   dtype=ten4.type.dtype)()])
开发者ID:317070,项目名称:Theano,代码行数:14,代码来源:neighbours.py


示例10: make_node

 def make_node(self, dnll, sm, y_idx):
     dnll = as_gpuarray_variable(dnll)
     sm = as_gpuarray_variable(sm)
     y_idx = as_gpuarray_variable(y_idx)
     return Apply(self, [dnll, sm, y_idx], [sm.type()])
开发者ID:EricChanBD,项目名称:Theano,代码行数:5,代码来源:nnet.py


示例11: make_node

 def make_node(self, C, alpha, A, B, beta):
     res = Gemm.make_node(self, C, alpha, A, B, beta)
     A = as_gpuarray_variable(A)
     B = as_gpuarray_variable(B)
     C = as_gpuarray_variable(C)
     return Apply(self, [C, alpha, A, B, beta], [C.type()])
开发者ID:SamuelZeng,项目名称:Theano,代码行数:6,代码来源:blas.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python basic_ops.gpu_from_host函数代码示例发布时间:2022-05-27
下一篇:
Python gpuarray.array函数代码示例发布时间: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