Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

简化了模型代码 #5

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

QiangZiBro
Copy link

1.使用Conv1dProbLayer简化了模型代码

class Conv1dProbLayer(BaseModel):
    def __init__(self, in_channels, out_channels, out=False, kernel_size=1, dropout=0.2):
        super().__init__()
        self.out = out
        self.dropout_conv_bn_layer = nn.Sequential(
            nn.Dropout(dropout),
            nn.Conv1d(in_channels=in_channels, out_channels=out_channels, kernel_size=kernel_size),
            nn.BatchNorm1d(num_features=out_channels),
        )
        self.relu = nn.ReLU()
        self.softmax = nn.Softmax(dim=2)

    def forward(self, x):
        x = self.dropout_conv_bn_layer(x)
        if self.out:
            x = self.softmax(x)
        else:
            x = self.relu(x)
        return x
  1. readme 使用指定cuda版本安装torch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant