TensorFlow和TensorLayer相互转换

TensorLayer安装:

pip uninstall tensorlayer  
pip install --upgrade tensorflow     # if you do not use GPU support
pip install --upgrade tensorflow-gpu # if you use GPU support
pip install git+https://github.com/tensorlayer/tensorlayer.git

TensorFlow(TF) 转为 TensorLayer(TL) : 通过 InputLayer 把 tensor 输入到 tl.layers

conv_11 = tf.nn.conv2d(input, filter, strides=[1,1,1,1],padding='SAME' ,name='{}_1x1'.format(name))
conv_11_layer = tl.layers.InputLayer(conv_11)
offset_11 = tl.layers.Conv2d(conv_11_layer, 18, (3, 3), (1, 1), padding="SAME")
deformable_conv_11 = tl.layers.DeformableConv2d(conv_11_layer, offset_11, 64, (3,3), name='deformable_conv_11')

* TensorLayer(TL) 转为 TensorFlow(TF) : 通过 network.outputs 获取 tensor

output_cat = tf.concat([deformable_conv_11.outputs, deformable_conv_22.outputs], 3, name='{}_concat'.format(name))

* 其它途径 [issues7], 多输入 [issues31]

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值