Very Deep Convolutional Networks for Text Classification
1、模型
2、代码
import torch
import torch.nn.functional as F
from torch import nn
# char-level
# embedding_dim=16, SGD, mini-batch=128, init_lr=0.01, momentum=0.9
# init_conv=He et al.,2015, use temporal batch norm without dropout.
# 29 conv layers is best.
# MaxPooling is better than KMaxPooling and Conv
class VDCNN(nn.Module):
def __init__(self):
super(VDCNN, self).__init__()
num_embeddings = 5031 + 1