小编Kha*_*dra的帖子

如何在Pytorch的`nn.Sequential`中变平输入

如何扁平化内部的输入 nn.Sequential

Model = nn.Sequential(x.view(x.shape[0],-1),
                     nn.Linear(784,256),
                     nn.ReLU(),
                     nn.Linear(256,128),
                     nn.ReLU(),
                     nn.Linear(128,64),
                     nn.ReLU(),
                     nn.Linear(64,10),
                     nn.LogSoftmax(dim=1))
Run Code Online (Sandbox Code Playgroud)

python artificial-intelligence neural-network pytorch

5
推荐指数
3
解决办法
2470
查看次数

用户单击 kotlin 中的注销按钮后如何返回登录屏幕?

我是初学者kotlin,我想知道firebase-ui当用户单击注销按钮时如何让用户返回登录屏幕。我正在尝试在android上实现这个。

class MainActivity : AppCompatActivity() {
private val RC_SIGN_IN = 123;
val auth=FirebaseAuth.getInstance()
// Choose authentication providers
val providers = arrayListOf(
    AuthUI.IdpConfig.EmailBuilder().build(),
    AuthUI.IdpConfig.PhoneBuilder().build(),
    AuthUI.IdpConfig.GoogleBuilder().build())

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)

    signout.setOnClickListener{v ->
        AuthUI.getInstance()
            .signOut(this)
            .addOnCompleteListener {
                // ...
            }
    }

    if(auth.currentUser!=null)
    {

    }
    else
    {
        // Create and launch sign-in intent
        startActivityForResult(
            AuthUI.getInstance()
                .createSignInIntentBuilder()
                .setAvailableProviders(providers)
                .build(),
            RC_SIGN_IN)
    }
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    super.onActivityResult(requestCode, resultCode, data)
    if (requestCode == RC_SIGN_IN) …
Run Code Online (Sandbox Code Playgroud)

android kotlin

2
推荐指数
1
解决办法
1980
查看次数