我有一份清单如下
[<tf.Variable 'resnet_v1_101/conv1/weights:0' shape=(7, 7, 3, 64) dtype=float32_ref>, <tf.Variable 'resnet_v1_101/conv1/BatchNorm/beta:0' shape=(64,) dtype=float32_ref>, <tf.Variable 'resnet_v1_101/conv1/BatchNorm/gamma:0' shape=(64,) dtype=float32_ref>, <tf.Variable 'resnet_v1_101/conv1/BatchNorm/moving_mean:0' shape=(64,) dtype=float32_ref>, <tf.Variable 'resnet_v1_101/conv1/BatchNorm/moving_variance:0' shape=(64,) dtype=float32_ref>, <tf.Variable 'resnet_v1_101/block1/unit_1/bottleneck_v1/shortcut/weights:0' shape=(1, 1, 64, 256) dtype=float32_ref>, <tf.Variable 'resnet_v1_101/block1/unit_1/bottleneck_v1/shortcut/BatchNorm/beta:0' shape=(256,) dtype=float32_ref>, <tf.Variable 'resnet_v1_101/block1/unit_1/bottleneck_v1/shortcut/BatchNorm/gamma:0' shape=(256,) dtype=float32_ref>, <tf.Variable 'resnet_v1_101/block1/unit_1/bottleneck_v1/shortcut/BatchNorm/moving_mean:0' shape=(256,) dtype=float32_ref>, <tf.Variable 'resnet_v1_101/block1/unit_1/bottleneck_v1/shortcut/BatchNorm/moving_variance:0' shape=(256,) dtype=float32_ref>, <tf.Variable 'resnet_v1_101/block1/unit_1/bottleneck_v1/conv1/weights:0' shape=(1, 1, 64, 64) dtype=float32_ref>, <tf.Variable 'resnet_v1_101/block1/unit_1/bottleneck_v1/conv1/BatchNorm/beta:0' shape=(64,) dtype=float32_ref>, <tf.Variable 'resnet_v1_101/block1/unit_1/bottleneck_v1/conv1/BatchNorm/gamma:0' shape=(64,) dtype=float32_ref>, <tf.Variable 'resnet_v1_101/block1/unit_1/bottleneck_v1/conv1/BatchNorm/moving_mean:0' shape=(64,) dtype=float32_ref>, <tf.Variable 'resnet_v1_101/block1/unit_1/bottleneck_v1/conv1/BatchNorm/moving_variance:0' shape=(64,) dtype=float32_ref>]
我想获取列表中存储BatchNorm
的所有名称,并将其存储在新列表中,而不重复。名称将被剪切,直到批处理结束。例如
输入
'resnet_v1_101/block1/unit_1/bottleneck_v1/conv1/BatchNorm/moving_mean
输出
'resnet_v1_101/block1/unit_1/bottleneck_v1/conv1/BatchNorm'
我在新列表中的期望值是
['resnet_v1_101/conv1/BatchNorm','resnet_v1_101/block1/unit_1/bottleneck_v1/shortcut/BatchNorm','resnet_v1_101/block1/unit_1/bottleneck_v1/conv1/BatchNorm']
目前没有回答
相关问题 更多 >
编程相关推荐