diff --git a/python/paddle/trainer/config_parser.py b/python/paddle/trainer/config_parser.py index 0f7c601fe0d29dbda9c5ec4c1812704a51db31f4..83fda9f709223f0fbf9edd46a8b271ae9c6ae6c7 100644 --- a/python/paddle/trainer/config_parser.py +++ b/python/paddle/trainer/config_parser.py @@ -1584,6 +1584,13 @@ class PriorBoxLayer(LayerBase): variance): super(PriorBoxLayer, self).__init__(name, 'priorbox', 0, inputs) config_assert(len(inputs) == 2, 'PriorBoxLayer must have 2 input') + input_layer = self.get_input_layer(1) + config_assert( + input_layer.type == 'data', + 'Expecting the second input layer of an priorbox layer to be ' + 'a data layer') + config_assert(input_layer.width > 0, 'The data layer must set width') + config_assert(input_layer.height > 0, 'The data layer must set height') self.config.inputs[0].priorbox_conf.min_size.extend(min_size) self.config.inputs[0].priorbox_conf.max_size.extend(max_size) self.config.inputs[0].priorbox_conf.aspect_ratio.extend(aspect_ratio)