You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/12/20 03:36:40 UTC

[GitHub] shengfeng edited a comment on issue #13374: [Bug] ValueError: There are multiple outputs with name "resnetv1b0_layers1_relu0_fwd_output".

shengfeng edited a comment on issue #13374: [Bug] ValueError: There are multiple outputs with name "resnetv1b0_layers1_relu0_fwd_output".
URL: https://github.com/apache/incubator-mxnet/issues/13374#issuecomment-448850208
 
 
   I also encounter this problem when using TextCNN, here is my model:
   
   `
   class TextCNN(HybridBlock):
       def __init__(self, args, vocab, kernel_sizes, num_channels, **kwargs):
           super(TextCNN, self).__init__(**kwargs)
           self.embedding = nn.Embedding(len(vocab), args.embed_size)
           self.constant_embedding = nn.Embedding(len(vocab), args.embed_size)
           self.dropout = nn.Dropout(0.5)
           self.decoder = nn.Dense(5)
           self.pool = nn.GlobalMaxPool1D()
           self.convs = nn.HybridSequential()
           for c, k in zip(num_channels, kernel_sizes):
               self.convs.add(nn.Conv1D(c, k, activation='relu'))
   
   
       def hybrid_forward(self, F, inputs):
           embeddings = F.concat(self.embedding(inputs), self.constant_embedding(inputs), dim=2)
           embeddings = embeddings.transpose((0, 2, 1))
           encoding = F.concat(*[F.flatten(
               self.pool(conv(embeddings))) for conv in self.convs], dim=1)
           outputs = self.decoder(self.dropout(encoding))
           return F.softmax(outputs)
   `

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services