嵌套参数范围

时间:2017-12-09 02:48:36

标签: tensorflow tensorflow-slim

我需要帮助理解TensorFlow中的这个嵌套参数作用域:

def vgg_arg_scope(weight_decay=0.0005):
  """Defines the VGG arg scope.
  Args:
    weight_decay: The l2 regularization coefficient.
  Returns:
    An arg_scope.
  """
  with arg_scope(
          [layers.conv2d, layers_lib.fully_connected],
          activation_fn=nn_ops.relu,
          weights_regularizer=regularizers.l2_regularizer(weight_decay),
          biases_initializer=init_ops.zeros_initializer()):
    with arg_scope([layers.conv2d], padding='SAME') as arg_sc:
        return arg_sc

我理解的是外层范围适用于函数

[layers.conv2d, layers_lib.fully_connected]. 

内部水平范围有什么作用?

1 个答案:

答案 0 :(得分:0)

内部arg_scope将layers.conv2d应用于layers_lib.fully_connected但不应用于padding,这可能没有public class MainActivity extends AppCompatActivity { private Button btn; private EditText et1,et2,et3; DatabaseReference dr; private static final String TAG = MainActivity.class.getSimpleName(); DatabaseError error; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); et1 = (EditText)findViewById(R.id.editText1); et2 = (EditText)findViewById(R.id.editText2); et3 = (EditText)findViewById(R.id.editText3); btn = (Button)findViewById(R.id.button); class User{ String name,email,password; User() {} User(String name,String email,String password) { this.name=name; this.email=email; this.password=password; } } btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String name = et1.getText().toString(); String email = et2.getText().toString(); String password = et3.getText().toString(); User user = new User(name,email,password); dr = FirebaseDatabase.getInstance().getReference("Profile-Detailed"); String id = dr.push().getKey(); dr.child(id).setValue(user); Log.e(TAG, "Failed to read app title value.", error.toException()); } }); } } 参数。