def create(self):
self._input_name = 'text'
self._output_name = 'output'
self.add_input(
name=self._input_name,
input_shape=(self._config.max_input_time_steps, self._config.input_dim,))
self.inputs['text'].input = T.imatrix()
self.add_node(Embedding(
self._config.input_dim,
self._config.textual_embedding_dim,
mask_zero=True),
name='embedding', input='text')
self.add_node(
self._config.recurrent_encoder(
self._config.hidden_state_dim,
return_sequences=False,
go_backwards=self._config.go_backwards),
name='recurrent', input='embedding')
self.add_node(Dropout(0.5), name='dropout', input='recurrent')
self.add_node(Dense(self._config.output_dim), name='dense', input='dropout')
self.add_node(Activation('softmax'), name='softmax', input='dense')
self.add_output(name=self._output_name, input='softmax')
model_zoo.py 文件源码
python
阅读 19
收藏 0
点赞 0
评论 0
评论列表
文章目录