python - 如何在python中加入对象及其成员
问题描述
我有一个caffe object
名为net
. 通常在python中,网络为其层设置为
net.conv1_1 = L.Convolution(net[from_layer], num_output=64, pad=1, kernel_size=3, **kwargs)
但对我来说,我将图层名称作为程序中的变量而不是硬编码。那么我如何将层名称 conv1 加入网络。我做了
join( net.,'%s'%(layer[lIdx]['l_name']))=L.Convolution(net[layer[lIdx-1]['l_name']], num_output=layer[lIdx]['n_channels'], pad=layer[lIdx]['l_struct'][2], kernel_size=layer[lIdx]['l_struct'][0], **kwargs)
这join( net.,'%s'%(layer[lIdx]['l_name']))
给了我SyntaxError: ('invalid syntax',
解决方案
推荐阅读
- sql - 为类似系统的 filemaker pro 自动同步数据库
- docker - 如何在 nginx 的上游服务器中使用容器名称解析到其 IP?
- android - 如何在 android 中同步两个或多个 EditText?
- jquery - 即使数据存在并出现在表中,jQuery 数据表也会显示“表中没有可用数据”
- angular-material - 升级到 Angular 6、材料 6 后,选择选项事件连续触发,浏览器挂起。如何停止不需要的发射事件?
- java - 仅在一组值整数中按比例分配值
- javascript - Redux-saga - 选择/等待来自多个其他 saga 的数据
- python - QListView 中的复选框选择
- tensorflow - 如何通过 TensorFlow 加载 MNIST(包括下载)?
- android - 围栏状态的 Awareness API 查询