Example #1
0
    def test_parse(self):
        pixel = layer.data(name='pixel3', type=data_type.dense_vector(784))
        label = layer.data(name='label3', type=data_type.integer_value(10))
        hidden = layer.fc(input=pixel,
                          size=100,
                          act=conf_helps.SigmoidActivation())
        inference = layer.fc(input=hidden,
                             size=10,
                             act=conf_helps.SoftmaxActivation())
        maxid = layer.max_id(input=inference)
        cost1 = layer.classification_cost(input=inference, label=label)
        cost2 = layer.cross_entropy_cost(input=inference, label=label)

        topology.Topology(cost2).proto()
        topology.Topology([cost1]).proto()
        topology.Topology([cost1, cost2]).proto()
        topology.Topology([inference, maxid]).proto()
Example #2
0
 def test_sampling_layer(self):
     maxid = layer.max_id(input=inference)
     sampling_id = layer.sampling_id(input=inference)
     eos = layer.eos(input=maxid, eos_id=5)
     print layer.parse_network(maxid, sampling_id, eos)
Example #3
0
 def test_sampling_layer(self):
     maxid = layer.max_id(input=inference)
     sampling_id = layer.sampling_id(input=inference)
     eos = layer.eos(input=maxid, eos_id=5)
     layer.printer(maxid)
     print layer.parse_network([maxid, sampling_id, eos])