def create_net(self, dropout=0.5): self.embed = layer.Dense('embed', self.embed_size, input_sample_shape=(self.vocab_size, )) self.embed.to_device(self.dev) self.lstm = layer.LSTM( name='lstm', hidden_size=self.hidden_size, num_stacks=self.num_stack_layers, dropout=dropout, input_sample_shape=( self.embed_size, )) self.lstm.to_device(self.dev) self.dense = layer.Dense( 'dense', 2, #output shape input_sample_shape=( self.hidden_size, )) self.dense.to_device(self.dev) self.sft = layer.Softmax('softmax', input_sample_shape=( 2, )) self.sft.to_device(self.dev) self.loss = loss.SoftmaxCrossEntropy()
def test_softmax(self): input_sample_shape = (12, ) softmax = layer.Softmax('soft', input_sample_shape=input_sample_shape) out_sample_shape = softmax.get_output_sample_shape() self.check_shape(out_sample_shape, input_sample_shape)