Exemple #1
0
    def compute_output_shape(node):
        if custom_layers.has_layer(node.kind):
            return custom_layers.compute_output_shape(node.kind, node)

        try:
            val = LAYER_DESCRIPTORS[node.kind](node)
            return val
        except NotImplementedError:
            raise KaffeError(
                'Output shape computation not implemented for type: %s' %
                node.kind)
Exemple #2
0
    def get_handler(self, node_kind, prefix):
        if custom_layers.has_layer(node_kind):
            return getattr(self, 'map_custom')

        name = self.get_handler_name(node_kind)
        name = '_'.join((prefix, name))
        try:
            return getattr(self, name)
        except AttributeError:
            raise NodeDispatchError(
                'No handler found for node kind: %s (expected: %s)' %
                (node_kind, name))
Exemple #3
0
    def map_raw_kind(kind):
        if custom_layers.has_layer(kind):
            return kind

        if kind in LAYER_TYPES:
            return kind

        v1_layers = get_v1_layer_map()
        if kind in v1_layers:
            return v1_layers[kind]
        else:
            return None