MXNet的gluon中,name_scope起啥作用

name_scope会给后续的网络层添加上前面的名称,这样便于访问到参数,举个例子
a = gluon.nn.Sequential(prefix=\u0026#39;net_\u0026#39;)with a.name_scope(): a.add(gluon.nn.Dense(1))params = a.collect_params()print(params)\u0026gt;\u0026gt; net_ ( Parameter net_dense0_weight (shape=(1, 0), dtype=\u0026lt;class \u0026#39;numpy.float32\u0026#39;\u0026gt;) Parameter net_dense0_bias (shape=(1,), dtype=\u0026lt;class \u0026#39;numpy.float32\u0026#39;\u0026gt;)) 【MXNet的gluon中,name_scope起啥作用】 这样添加后面的层的时候都会在这个名字下面,所以访问参数也会在以net为前缀。
以上

■网友
会自动提供各个参数提供一个独一无二的name

■网友
Just copy from TF


    推荐阅读