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

Python test_utils.check_consistency函数代码示例

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

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



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

示例1: test_elementwisesum_with_type

def test_elementwisesum_with_type():
    sym = mx.sym.ElementWiseSum(name="ews", num_args=2)
    ctx_list = [
        {
            "ctx": mx.gpu(0),
            "ews_arg1": (2, 10),
            "ews_arg0": (2, 10),
            "type_dict": {"ews_arg0": np.float64, "ews_arg1": np.float64},
        },
        {
            "ctx": mx.gpu(0),
            "ews_arg1": (2, 10),
            "ews_arg0": (2, 10),
            "type_dict": {"ews_arg0": np.float32, "ews_arg1": np.float32},
        },
        {
            "ctx": mx.gpu(0),
            "ews_arg1": (2, 10),
            "ews_arg0": (2, 10),
            "type_dict": {"ews_arg0": np.float16, "ews_arg1": np.float16},
        },
        {
            "ctx": mx.cpu(0),
            "ews_arg1": (2, 10),
            "ews_arg0": (2, 10),
            "type_dict": {"ews_arg0": np.float64, "ews_arg1": np.float64},
        },
        {
            "ctx": mx.cpu(0),
            "ews_arg1": (2, 10),
            "ews_arg0": (2, 10),
            "type_dict": {"ews_arg0": np.float32, "ews_arg1": np.float32},
        },
    ]
    check_consistency(sym, ctx_list)
开发者ID:alextnewman,项目名称:mxnet,代码行数:35,代码来源:test_operator_gpu.py


示例2: test_convolution_with_type

def test_convolution_with_type():
    np.random.seed(1234)
    sym1 = mx.sym.Convolution(num_filter=3, kernel=(3,3), name='conv')

    data = mx.sym.Variable('conv_data')
    w = mx.sym.Variable('conv_weight')
    b = mx.sym.Variable('conv_bias')
    w = mx.sym.transpose(w, axes=(0,2,3,1))
    sym2 = mx.sym.transpose(data, axes=(0,2,3,1))
    sym2 = mx.sym.Convolution(sym2, w, b, layout='NHWC', num_filter=3, kernel=(3,3))
    sym2 = mx.sym.transpose(sym2, axes=(0,3,1,2), name='conv')

    sym = [sym1, sym1, sym1, sym1, sym1, sym2, sym2]
    ctx_list = [{'ctx': mx.gpu(0), 'conv_data': (2, 2, 10, 10), 'type_dict': {'conv_data': np.float64}},
                {'ctx': mx.gpu(0), 'conv_data': (2, 2, 10, 10), 'type_dict': {'conv_data': np.float32}},
                {'ctx': mx.gpu(0), 'conv_data': (2, 2, 10, 10), 'type_dict': {'conv_data': np.float16}},
                {'ctx': mx.cpu(0), 'conv_data': (2, 2, 10, 10), 'type_dict': {'conv_data': np.float64}},
                {'ctx': mx.cpu(0), 'conv_data': (2, 2, 10, 10), 'type_dict': {'conv_data': np.float32}},
                # NHWC
                {'ctx': mx.gpu(0), 'conv_data': (2, 2, 10, 10), 'conv_weight': (3, 2, 3, 3),
                 'type_dict': {'conv_data': np.float32, 'conv_weight': np.float32}},
                {'ctx': mx.gpu(0), 'conv_data': (2, 2, 10, 10), 'conv_weight': (3, 2, 3, 3),
                 'type_dict': {'conv_data': np.float16, 'conv_weight': np.float16}}
                ]
    # wider tolerance needed for true-fp16 NCHW test above
    tol = {np.dtype(np.float16): 0.5,
               np.dtype(np.float32): 1e-3,
               np.dtype(np.float64): 1e-5,
               np.dtype(np.uint8): 0,
               np.dtype(np.int32): 0}
    check_consistency(sym, ctx_list, tol=tol)
    # test ability to turn off training on bias
    check_consistency(sym, ctx_list, grad_req={'conv_data': 'write', 'conv_weight': 'write', 'conv_bias': 'null'}, tol=tol)
开发者ID:moveforever,项目名称:mxnet,代码行数:33,代码来源:test_operator_gpu.py


示例3: test_concat_with_type

def test_concat_with_type():
    sym = mx.sym.Concat(name="concat", num_args=2)
    ctx_list = [
        {
            "ctx": mx.gpu(0),
            "concat_arg1": (2, 10),
            "concat_arg0": (2, 10),
            "type_dict": {"concat_arg0": np.float64, "concat_arg1": np.float64},
        },
        {
            "ctx": mx.gpu(0),
            "concat_arg1": (2, 10),
            "concat_arg0": (2, 10),
            "type_dict": {"concat_arg0": np.float32, "concat_arg1": np.float32},
        },
        {
            "ctx": mx.gpu(0),
            "concat_arg1": (2, 10),
            "concat_arg0": (2, 10),
            "type_dict": {"concat_arg0": np.float16, "concat_arg1": np.float16},
        },
        {
            "ctx": mx.cpu(0),
            "concat_arg1": (2, 10),
            "concat_arg0": (2, 10),
            "type_dict": {"concat_arg0": np.float64, "concat_arg1": np.float64},
        },
        {
            "ctx": mx.cpu(0),
            "concat_arg1": (2, 10),
            "concat_arg0": (2, 10),
            "type_dict": {"concat_arg0": np.float32, "concat_arg1": np.float32},
        },
    ]
    check_consistency(sym, ctx_list)
开发者ID:alextnewman,项目名称:mxnet,代码行数:35,代码来源:test_operator_gpu.py


示例4: test_reshape_with_type

def test_reshape_with_type():
    sym = mx.sym.Reshape(name='reshape', shape=(-1,1,1,0))
    ctx_list = [{'ctx': mx.gpu(0), 'reshape_data': (2, 2, 2, 10), 'type_dict': {'reshape_data': np.float64}},
                {'ctx': mx.gpu(0), 'reshape_data': (2, 2, 2, 10), 'type_dict': {'reshape_data': np.float32}},
                {'ctx': mx.gpu(0), 'reshape_data': (2, 2, 2, 10), 'type_dict': {'reshape_data': np.float16}},
                {'ctx': mx.cpu(0), 'reshape_data': (2, 2, 2, 10), 'type_dict': {'reshape_data': np.float64}},
                {'ctx': mx.cpu(0), 'reshape_data': (2, 2, 2, 10), 'type_dict': {'reshape_data': np.float32}}]
    check_consistency(sym, ctx_list)
开发者ID:max0x,项目名称:mxnet,代码行数:8,代码来源:test_operator_gpu.py


示例5: test_upsampling_with_type

def test_upsampling_with_type():
    sym = mx.sym.UpSampling(scale=2, num_filter=2, name='up', sample_type = 'nearest', num_args=1)
    ctx_list = [{'ctx': mx.gpu(0), 'up_arg0': (2, 2, 2, 10), 'type_dict': {'up_arg0': np.float64}},
                {'ctx': mx.gpu(0), 'up_arg0': (2, 2, 2, 10), 'type_dict': {'up_arg0': np.float32}},
                {'ctx': mx.gpu(0), 'up_arg0': (2, 2, 2, 10), 'type_dict': {'up_arg0': np.float16}},
                {'ctx': mx.cpu(0), 'up_arg0': (2, 2, 2, 10), 'type_dict': {'up_arg0': np.float64}},
                {'ctx': mx.cpu(0), 'up_arg0': (2, 2, 2, 10), 'type_dict': {'up_arg0': np.float32}}]
    check_consistency(sym, ctx_list)
开发者ID:max0x,项目名称:mxnet,代码行数:8,代码来源:test_operator_gpu.py


示例6: test_batchnorm_with_type

def test_batchnorm_with_type():
    sym = mx.sym.BatchNorm(name='norm', fix_gamma=False)
    ctx_list = [{'ctx': mx.gpu(0), 'norm_data': (10, 2, 10, 10), 'type_dict': {'norm_data': np.float32}},
                {'ctx': mx.cpu(0), 'norm_data': (10, 2, 10, 10), 'type_dict': {'norm_data': np.float32}}]
    check_consistency(sym, ctx_list)

    sym = mx.sym.BatchNorm(name='norm', fix_gamma=True)
    check_consistency(sym, ctx_list)
开发者ID:max0x,项目名称:mxnet,代码行数:8,代码来源:test_operator_gpu.py


示例7: test_deconvolution_with_type

def test_deconvolution_with_type():
    sym = mx.sym.Deconvolution(num_filter=2, kernel=(3,3), name='deconv')
    ctx_list = [{'ctx': mx.gpu(0), 'deconv_data': (2, 2, 10, 10), 'type_dict': {'deconv_data': np.float64}},
                {'ctx': mx.gpu(0), 'deconv_data': (2, 2, 10, 10), 'type_dict': {'deconv_data': np.float32}},
                {'ctx': mx.gpu(0), 'deconv_data': (2, 2, 10, 10), 'type_dict': {'deconv_data': np.float16}},
                {'ctx': mx.cpu(0), 'deconv_data': (2, 2, 10, 10), 'type_dict': {'deconv_data': np.float64}},
                {'ctx': mx.cpu(0), 'deconv_data': (2, 2, 10, 10), 'type_dict': {'deconv_data': np.float32}}]
    check_consistency(sym, ctx_list)
开发者ID:4ker,项目名称:mxnet,代码行数:8,代码来源:test_operator_gpu.py


示例8: test_swapaxis_with_type

def test_swapaxis_with_type():
    sym = mx.sym.SwapAxis(name='swap', dim1=1)
    ctx_list = [{'ctx': mx.gpu(0), 'swap_data': (2, 2, 2, 10), 'type_dict': {'swap_data': np.float64}},
                {'ctx': mx.gpu(0), 'swap_data': (2, 2, 2, 10), 'type_dict': {'swap_data': np.float32}},
                {'ctx': mx.gpu(0), 'swap_data': (2, 2, 2, 10), 'type_dict': {'swap_data': np.float16}},
                {'ctx': mx.cpu(0), 'swap_data': (2, 2, 2, 10), 'type_dict': {'swap_data': np.float64}},
                {'ctx': mx.cpu(0), 'swap_data': (2, 2, 2, 10), 'type_dict': {'swap_data': np.float32}}]
    check_consistency(sym, ctx_list)
开发者ID:max0x,项目名称:mxnet,代码行数:8,代码来源:test_operator_gpu.py


示例9: test_fullyconnected_with_type

def test_fullyconnected_with_type():
    sym = mx.sym.FullyConnected(num_hidden=3, name='inner')
    ctx_list = [{'ctx': mx.gpu(0), 'inner_data': (2, 10), 'type_dict': {'inner_data': np.float64}},
                {'ctx': mx.gpu(0), 'inner_data': (2, 10), 'type_dict': {'inner_data': np.float32}},
                {'ctx': mx.gpu(0), 'inner_data': (2, 10), 'type_dict': {'inner_data': np.float16}},
                {'ctx': mx.cpu(0), 'inner_data': (2, 10), 'type_dict': {'inner_data': np.float64}},
                {'ctx': mx.cpu(0), 'inner_data': (2, 10), 'type_dict': {'inner_data': np.float32}}]
    check_consistency(sym, ctx_list)
开发者ID:max0x,项目名称:mxnet,代码行数:8,代码来源:test_operator_gpu.py


示例10: test_blockgrad_with_type

def test_blockgrad_with_type():
    sym = mx.sym.BlockGrad(name='bg')
    ctx_list = [{'ctx': mx.gpu(0), 'bg_data': (2, 2, 2, 10), 'type_dict': {'bg_data': np.float64}},
                {'ctx': mx.gpu(0), 'bg_data': (2, 2, 2, 10), 'type_dict': {'bg_data': np.float32}},
                {'ctx': mx.gpu(0), 'bg_data': (2, 2, 2, 10), 'type_dict': {'bg_data': np.float16}},
                {'ctx': mx.cpu(0), 'bg_data': (2, 2, 2, 10), 'type_dict': {'bg_data': np.float64}},
                {'ctx': mx.cpu(0), 'bg_data': (2, 2, 2, 10), 'type_dict': {'bg_data': np.float32}}]
    check_consistency(sym, ctx_list)
开发者ID:max0x,项目名称:mxnet,代码行数:8,代码来源:test_operator_gpu.py


示例11: test_activation_with_type

def test_activation_with_type():
    sym = mx.sym.Activation(name='act', act_type='sigmoid')
    ctx_list = [{'ctx': mx.gpu(0), 'act_data': (2, 2, 10, 10), 'type_dict': {'act_data': np.float64}},
                {'ctx': mx.gpu(0), 'act_data': (2, 2, 10, 10), 'type_dict': {'act_data': np.float32}},
                {'ctx': mx.gpu(0), 'act_data': (2, 2, 10, 10), 'type_dict': {'act_data': np.float16}},
                {'ctx': mx.cpu(0), 'act_data': (2, 2, 10, 10), 'type_dict': {'act_data': np.float64}},
                {'ctx': mx.cpu(0), 'act_data': (2, 2, 10, 10), 'type_dict': {'act_data': np.float32}},
                {'ctx': mx.cpu(0), 'act_data': (2, 2, 10, 10), 'type_dict': {'act_data': np.float16}}]
    check_consistency(sym, ctx_list)
开发者ID:max0x,项目名称:mxnet,代码行数:9,代码来源:test_operator_gpu.py


示例12: test_svmoutput_with_type

def test_svmoutput_with_type():
    sym = mx.sym.SVMOutput(name='svmoutput', use_linear=True)
    ctx_list = [{'ctx': mx.gpu(0), 'svmoutput_data': (20, 10), 'type_dict': {'svmoutput_data': np.float64}},
                {'ctx': mx.gpu(0), 'svmoutput_data': (20, 10), 'type_dict': {'svmoutput_data': np.float32}},
                {'ctx': mx.gpu(0), 'svmoutput_data': (20, 10), 'type_dict': {'svmoutput_data': np.float16}},
                {'ctx': mx.cpu(0), 'svmoutput_data': (20, 10), 'type_dict': {'svmoutput_data': np.float64}},
                {'ctx': mx.cpu(0), 'svmoutput_data': (20, 10), 'type_dict': {'svmoutput_data': np.float32}},
                {'ctx': mx.cpu(0), 'svmoutput_data': (20, 10), 'type_dict': {'svmoutput_data': np.float16}}]
    check_consistency(sym, ctx_list)
开发者ID:ChisBread,项目名称:mxnet,代码行数:9,代码来源:test_operator_gpu.py


示例13: test_embedding_with_type

def test_embedding_with_type():
    sym = mx.sym.Embedding(name='embedding', input_dim=10, output_dim=20)
    ctx_list = [{'ctx': mx.gpu(0), 'embedding_data': (2, 10), 'type_dict': {'embedding_data': np.float64}},
                {'ctx': mx.gpu(0), 'embedding_data': (2, 10), 'type_dict': {'embedding_data': np.float32}},
                {'ctx': mx.gpu(0), 'embedding_data': (2, 10), 'type_dict': {'embedding_data': np.float16}},
                {'ctx': mx.cpu(0), 'embedding_data': (2, 10), 'type_dict': {'embedding_data': np.float64}},
                {'ctx': mx.cpu(0), 'embedding_data': (2, 10), 'type_dict': {'embedding_data': np.float32}},
                {'ctx': mx.cpu(0), 'embedding_data': (2, 10), 'type_dict': {'embedding_data': np.float16}}]
    check_consistency(sym, ctx_list, grad_req={'embedding_data': 'null','embedding_weight': 'write'})
开发者ID:sxjscience,项目名称:mxnet,代码行数:9,代码来源:test_operator_gpu.py


示例14: test_swapaxis_with_type

def test_swapaxis_with_type():
    sym = mx.sym.SwapAxis(name="swap", dim1=1)
    ctx_list = [
        {"ctx": mx.gpu(0), "swap_data": (2, 2, 2, 10), "type_dict": {"swap_data": np.float64}},
        {"ctx": mx.gpu(0), "swap_data": (2, 2, 2, 10), "type_dict": {"swap_data": np.float32}},
        {"ctx": mx.gpu(0), "swap_data": (2, 2, 2, 10), "type_dict": {"swap_data": np.float16}},
        {"ctx": mx.cpu(0), "swap_data": (2, 2, 2, 10), "type_dict": {"swap_data": np.float64}},
        {"ctx": mx.cpu(0), "swap_data": (2, 2, 2, 10), "type_dict": {"swap_data": np.float32}},
    ]
    check_consistency(sym, ctx_list)
开发者ID:alextnewman,项目名称:mxnet,代码行数:10,代码来源:test_operator_gpu.py


示例15: test_reshape_with_type

def test_reshape_with_type():
    sym = mx.sym.Reshape(name="reshape", shape=(-1, 1, 1, 0))
    ctx_list = [
        {"ctx": mx.gpu(0), "reshape_data": (2, 2, 2, 10), "type_dict": {"reshape_data": np.float64}},
        {"ctx": mx.gpu(0), "reshape_data": (2, 2, 2, 10), "type_dict": {"reshape_data": np.float32}},
        {"ctx": mx.gpu(0), "reshape_data": (2, 2, 2, 10), "type_dict": {"reshape_data": np.float16}},
        {"ctx": mx.cpu(0), "reshape_data": (2, 2, 2, 10), "type_dict": {"reshape_data": np.float64}},
        {"ctx": mx.cpu(0), "reshape_data": (2, 2, 2, 10), "type_dict": {"reshape_data": np.float32}},
    ]
    check_consistency(sym, ctx_list)
开发者ID:alextnewman,项目名称:mxnet,代码行数:10,代码来源:test_operator_gpu.py


示例16: test_blockgrad_with_type

def test_blockgrad_with_type():
    sym = mx.sym.BlockGrad(name="bg")
    ctx_list = [
        {"ctx": mx.gpu(0), "bg_data": (2, 2, 2, 10), "type_dict": {"bg_data": np.float64}},
        {"ctx": mx.gpu(0), "bg_data": (2, 2, 2, 10), "type_dict": {"bg_data": np.float32}},
        {"ctx": mx.gpu(0), "bg_data": (2, 2, 2, 10), "type_dict": {"bg_data": np.float16}},
        {"ctx": mx.cpu(0), "bg_data": (2, 2, 2, 10), "type_dict": {"bg_data": np.float64}},
        {"ctx": mx.cpu(0), "bg_data": (2, 2, 2, 10), "type_dict": {"bg_data": np.float32}},
    ]
    check_consistency(sym, ctx_list)
开发者ID:alextnewman,项目名称:mxnet,代码行数:10,代码来源:test_operator_gpu.py


示例17: test_batchnorm_with_type

def test_batchnorm_with_type():
    sym = mx.sym.BatchNorm(name="norm", fix_gamma=False)
    ctx_list = [
        {"ctx": mx.gpu(0), "norm_data": (10, 2, 10, 10), "type_dict": {"norm_data": np.float32}},
        {"ctx": mx.cpu(0), "norm_data": (10, 2, 10, 10), "type_dict": {"norm_data": np.float32}},
    ]
    check_consistency(sym, ctx_list)

    sym = mx.sym.BatchNorm(name="norm", fix_gamma=True)
    check_consistency(sym, ctx_list)
开发者ID:alextnewman,项目名称:mxnet,代码行数:10,代码来源:test_operator_gpu.py


示例18: test_deconvolution_with_type

def test_deconvolution_with_type():
    sym = mx.sym.Deconvolution(num_filter=2, kernel=(3, 3), name="deconv")
    ctx_list = [
        {"ctx": mx.gpu(0), "deconv_data": (2, 2, 10, 10), "type_dict": {"deconv_data": np.float64}},
        {"ctx": mx.gpu(0), "deconv_data": (2, 2, 10, 10), "type_dict": {"deconv_data": np.float32}},
        {"ctx": mx.gpu(0), "deconv_data": (2, 2, 10, 10), "type_dict": {"deconv_data": np.float16}},
        {"ctx": mx.cpu(0), "deconv_data": (2, 2, 10, 10), "type_dict": {"deconv_data": np.float64}},
        {"ctx": mx.cpu(0), "deconv_data": (2, 2, 10, 10), "type_dict": {"deconv_data": np.float32}},
    ]
    check_consistency(sym, ctx_list)
开发者ID:alextnewman,项目名称:mxnet,代码行数:10,代码来源:test_operator_gpu.py


示例19: test_fullyconnected_with_type

def test_fullyconnected_with_type():
    sym = mx.sym.FullyConnected(num_hidden=3, name="inner")
    ctx_list = [
        {"ctx": mx.gpu(0), "inner_data": (2, 10), "type_dict": {"inner_data": np.float64}},
        {"ctx": mx.gpu(0), "inner_data": (2, 10), "type_dict": {"inner_data": np.float32}},
        {"ctx": mx.gpu(0), "inner_data": (2, 10), "type_dict": {"inner_data": np.float16}},
        {"ctx": mx.cpu(0), "inner_data": (2, 10), "type_dict": {"inner_data": np.float64}},
        {"ctx": mx.cpu(0), "inner_data": (2, 10), "type_dict": {"inner_data": np.float32}},
    ]
    check_consistency(sym, ctx_list)
开发者ID:alextnewman,项目名称:mxnet,代码行数:10,代码来源:test_operator_gpu.py


示例20: test_upsampling_with_type

def test_upsampling_with_type():
    sym = mx.sym.UpSampling(scale=2, num_filter=2, name="up", sample_type="nearest", num_args=1)
    ctx_list = [
        {"ctx": mx.gpu(0), "up_arg0": (2, 2, 2, 10), "type_dict": {"up_arg0": np.float64}},
        {"ctx": mx.gpu(0), "up_arg0": (2, 2, 2, 10), "type_dict": {"up_arg0": np.float32}},
        {"ctx": mx.gpu(0), "up_arg0": (2, 2, 2, 10), "type_dict": {"up_arg0": np.float16}},
        {"ctx": mx.cpu(0), "up_arg0": (2, 2, 2, 10), "type_dict": {"up_arg0": np.float64}},
        {"ctx": mx.cpu(0), "up_arg0": (2, 2, 2, 10), "type_dict": {"up_arg0": np.float32}},
    ]
    check_consistency(sym, ctx_list)
开发者ID:alextnewman,项目名称:mxnet,代码行数:10,代码来源:test_operator_gpu.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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