微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Python chainer.utils.type_check 模块-prod() 实例源码

Python chainer.utils.type_check 模块,prod() 实例源码

我们从Python开源项目中,提取了以下13代码示例,用于说明如何使用chainer.utils.type_check.prod()

项目:static-define-by-run    作者:bkvogel    | 项目源码 | 文件源码
def check_type_forward(self, in_types):
        n_in = in_types.size()
        type_check.expect(2 <= n_in, n_in <= 3)
        x_type, w_type = in_types[:2]

        type_check.expect(
            x_type.dtype.kind == 'f',
            w_type.dtype.kind == 'f',
            x_type.ndim >= 2,
            w_type.ndim == 2,
            type_check.prod(x_type.shape[1:]) == w_type.shape[1],
        )
        if n_in.eval() == 3:
            b_type = in_types[2]
            type_check.expect(
                b_type.dtype == x_type.dtype,
                b_type.ndim == 1,
                b_type.shape[0] == w_type.shape[0],
            )
项目:binary_net    作者:hillbig    | 项目源码 | 文件源码
def check_type_forward(self, w_type = in_types[:2]

        type_check.expect(
            x_type.dtype == numpy.float32,
            w_type.dtype == numpy.float32,
        )
        if n_in.eval() == 3:
            b_type = in_types[2]
            type_check.expect(
                b_type.dtype == numpy.float32,
            )
项目:chainer-deconv    作者:germanRos    | 项目源码 | 文件源码
def check_type_forward(self, in_types):
        type_check.expect(
            in_types.size() == 1,
        )

        x_type, = in_types

        cnt = _count_unkNown_dims(self.shape)
        if cnt == 0:
            type_check.expect(
                type_check.prod(x_type.shape) == type_check.prod(self.shape))
        else:
            kNown_size = 1
            for s in self.shape:
                if s > 0:
                    kNown_size *= s
            size_var = type_check.Variable(kNown_size,
                                           'kNown_size(=%d)' % kNown_size)
            type_check.expect(
                type_check.prod(x_type.shape) % size_var == 0)
项目:chainer-deconv    作者:germanRos    | 项目源码 | 文件源码
def check_type_forward(self,
            )
项目:Xnor-Net    作者:rarilurelo    | 项目源码 | 文件源码
def check_type_forward(self,
            )
项目:GUINnesS    作者:HirokiNakahara    | 项目源码 | 文件源码
def check_type_forward(self,
            )
项目:ddnn    作者:kunglab    | 项目源码 | 文件源码
def check_type_forward(self, in_types):
        n_in = in_types.size()
        type_check.expect(3 <= n_in, n_in <= 4)
        x_type, w_type, g_type = in_types[:3]

        type_check.expect(
            x_type.dtype.kind == "f",
            w_type.dtype.kind == "f",
            g_type.dtype.kind == "f",
            g_type.ndim == 2,
        )

        if n_in.eval() == 4:
            b_type = in_types[3]
            type_check.expect(
                b_type.dtype == x_type.dtype,
            )
项目:ddnn    作者:kunglab    | 项目源码 | 文件源码
def check_type_forward(self,
            )
项目:BinaryNetConvolution    作者:rarilurelo    | 项目源码 | 文件源码
def check_type_forward(self,
            )
项目:unrolled-gan    作者:musyoku    | 项目源码 | 文件源码
def check_type_forward(self,
            )
项目:LSGAN    作者:musyoku    | 项目源码 | 文件源码
def check_type_forward(self,
            )
项目:reinforcement-learning    作者:musyoku    | 项目源码 | 文件源码
def check_type_forward(self, w_type = in_types[:2]

        type_check.expect(
            x_type.dtype == np.float32,
            w_type.dtype == np.float32,
        )
        if n_in.eval() == 3:
            b_type = in_types[2]
            type_check.expect(
                b_type.dtype == np.float32,
            )
项目:adgm    作者:musyoku    | 项目源码 | 文件源码
def check_type_forward(self,
            )

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐