def test_repeat_vector(self):
from keras.layers import RepeatVector
model = Sequential()
model.add(RepeatVector(3, input_shape=(5,)))
input_names = ['input']
output_names = ['output']
spec = keras.convert(model, input_names, output_names).get_spec()
self.assertIsNotNone(spec)
# Test the model class
self.assertIsNotNone(spec.description)
self.assertTrue(spec.HasField('neuralNetwork'))
# Test the inputs and outputs
self.assertEquals(len(spec.description.input), len(input_names))
self.assertItemsEqual(input_names,
map(lambda x: x.name, spec.description.input))
self.assertEquals(len(spec.description.output), len(output_names))
self.assertItemsEqual(output_names,
map(lambda x: x.name, spec.description.output))
layers = spec.neuralNetwork.layers
self.assertIsNotNone(layers[0].sequenceRepeat)
评论列表
文章目录