Example #1
0
    def __init__(self):
        self.sequence_with_explicit_order = GraphSequence([
            ConverterSequenceNode('root', ['Transpose']),
            ConverterSequenceNode('order', ['Const']),
            NonConsumableConverterSequenceNode('input', ['?']),
        ])
        self.sequence_with_explicit_order.set_inputs('root',
                                                     ['input', 'order'])
        self.sequence_with_explicit_order.set_outputs(['root'])

        self.sequence_with_implicit_order = GraphSequence([
            ConverterSequenceNode('root', ['Transpose']),
            ConverterSequenceNode('order', ['Sub']),
            ConverterSequenceNode('a', ['Sub']),
            ConverterSequenceNode('b', ['Const']),
            ConverterSequenceNode('c', ['Range']),
            ConverterSequenceNode('d', ['Const']),
            ConverterSequenceNode('e', ['Const']),
            ConverterSequenceNode('f', ['Rank']),
            NonConsumableConverterSequenceNode('input', ['?'])
        ])

        self.sequence_with_implicit_order.set_inputs('root',
                                                     ['input', 'order'])
        self.sequence_with_implicit_order.set_inputs('order', ['a', 'c'])
        self.sequence_with_implicit_order.set_inputs('a', ['b', 'f'])
        self.sequence_with_implicit_order.set_inputs('c', ['d', 'e', 'f'])
        self.sequence_with_implicit_order.set_inputs('f', ['input'])
        self.sequence_with_implicit_order.set_outputs(['root'])

        self.sequences = [
            self.sequence_with_explicit_order,
            self.sequence_with_implicit_order
        ]
    def __init__(self):

        sequence = GraphSequence([
            ConverterSequenceNode('matmul_op', ['MatMul']),
            ConverterSequenceNode('bias_op', ['BiasAdd', 'Add']),  # output
            NonConsumableConverterSequenceNode('biases',
                                               ['Identity', 'Const']),
            NonConsumableConverterSequenceNode('weights',
                                               ['Identity', 'Const']),
            NonConsumableConverterSequenceNode('inputs', ['?'])
        ])
        sequence.set_inputs('matmul_op', ['inputs', 'weights'])
        sequence.set_inputs('bias_op', ['matmul_op', 'biases'])
        sequence.set_outputs(['bias_op'])

        sequence_without_bias = GraphSequence([
            ConverterSequenceNode('matmul_op', ['MatMul']),
            NonConsumableConverterSequenceNode('weights',
                                               ['Identity', 'Const']),
            NonConsumableConverterSequenceNode('inputs', ['?'])
        ])
        sequence_without_bias.set_inputs('matmul_op', ['inputs', 'weights'])
        sequence_without_bias.set_outputs(['matmul_op'])

        self.sequences = [sequence_without_bias, sequence]
Example #3
0
    def __init__(self):
        self.sequence = GraphSequence([
            NonConsumableConverterSequenceNode('input', ['?']),
            ConverterSequenceNode('tile', ['Tile']),
            NonConsumableConverterSequenceNode('multiples', ['?'])
        ])
        self.sequence.set_inputs('tile', ['input', 'multiples'])
        self.sequence.set_outputs(['tile'])

        # sequence input->shape->stridedslice->pack->tile
        self.sequence_pack = GraphSequence([
            NonConsumableConverterSequenceNode('input', ['?']),
            NonConsumableConverterSequenceNode('shape', ['Shape']),
            NonConsumableConverterSequenceNode('stridedslice', ['StridedSlice']),
            NonConsumableConverterSequenceNode('const_3', ['Const']),
            NonConsumableConverterSequenceNode('const_4', ['Const']),
            NonConsumableConverterSequenceNode('const_5', ['Const']),
            ConverterSequenceNode('tile', ['Tile']),
            NonConsumableConverterSequenceNode('tile_multiples_pack', ['Pack']),
            NonConsumableConverterSequenceNode('const_1', ['Const']),
            NonConsumableConverterSequenceNode('const_2', ['Const']),
            NonConsumableConverterSequenceNode('tile_input', ['?'])
        ])
        self.sequence_pack.set_inputs('shape', ['input'])
        self.sequence_pack.set_inputs('stridedslice', ['shape', 'const_3', 'const_4', 'const_5'])
        self.sequence_pack.set_inputs('tile_multiples_pack', ['stridedslice', 'const_1', 'const_2'])
        self.sequence_pack.set_inputs('tile', ['tile_input', 'tile_multiples_pack'])
        self.sequence_pack.set_outputs(['tile'])
Example #4
0
 def __init__(self):
     self.sequence = GraphSequence([
         ConverterSequenceNode('root', ['ArgMax']),
         ConverterSequenceNode('axis', ['Const']),
         NonConsumableConverterSequenceNode('input', ['?']),
     ])
     self.sequence.set_inputs('root', ['input', 'axis'])
     self.sequence.set_outputs(['root'])
Example #5
0
 def __init__(self):
     self.sequence = GraphSequence([
         ConverterSequenceNode('root', ['FakeQuantWithMinMaxVars']),
         ConverterSequenceNode('min', ['?']),
         ConverterSequenceNode('max', ['?']),
         NonConsumableConverterSequenceNode('input', ['?'])
     ])
     self.sequence.set_inputs('root', ['input', 'min', 'max'])
     self.sequence.set_outputs(['root'])
Example #6
0
    def __init__(self):
        sequence_scalar_pow = GraphSequence([
            NonConsumableConverterSequenceNode('input', ['?']),
            ConverterSequenceNode('pow', ['Pow']),
            ConverterSequenceNode('const', ['Const'])
        ])
        sequence_scalar_pow.set_inputs('pow', ['input', 'const'])
        sequence_scalar_pow.set_outputs(['pow'])

        self.sequences = [sequence_scalar_pow]
Example #7
0
 def __init__(self):
     self.sequence = GraphSequence([
         ConverterSequenceNode('root', ['StridedSlice']),
         ConverterSequenceNode('begin', ['Const']),
         ConverterSequenceNode('end', ['Const']),
         ConverterSequenceNode('strides', ['Const']),
         NonConsumableConverterSequenceNode('input', ['?']),
     ])
     self.sequence.set_inputs('root', ['input', 'begin', 'end', 'strides'])
     self.sequence.set_outputs(['root'])
Example #8
0
    def __init__(self):
        super(MomentsLayerResolver, self).__init__()

        # Graph sequence where keep_dims is False and dims of 1 are stripped (default)
        sequence = GraphSequence([
            ConverterSequenceNode('moments/mean', ['Mean']),
            ConverterSequenceNode('moments/StopGradient', ['StopGradient']),
            ConverterSequenceNode('moments/SquaredDifference',
                                  ['SquaredDifference']),
            ConverterSequenceNode('moments/variance', ['Mean']),
            ConverterSequenceNode('moments/squeeze_mean', ['Squeeze']),
            ConverterSequenceNode('moments/squeeze_variance', ['Squeeze']),
            NonConsumableConverterSequenceNode('input', ['?']),
            NonConsumableConverterSequenceNode('mean_reduction_indices',
                                               ['?']),
            NonConsumableConverterSequenceNode('variance_reduction_indices',
                                               ['?']),
        ])
        sequence.set_inputs('moments/mean',
                            ['input', 'mean_reduction_indices'])
        sequence.set_inputs('moments/StopGradient', ['moments/mean'])
        sequence.set_inputs('moments/SquaredDifference',
                            ['input', 'moments/StopGradient'])
        sequence.set_inputs(
            'moments/variance',
            ['moments/SquaredDifference', 'variance_reduction_indices'])
        sequence.set_inputs('moments/squeeze_mean', ['moments/mean'])
        sequence.set_inputs('moments/squeeze_variance', ['moments/variance'])
        sequence.set_outputs(
            ['moments/squeeze_mean', 'moments/squeeze_variance'])

        # Graph sequence where keep_dims is True and input dimensions are maintained
        sequence_keep_dims = GraphSequence([
            ConverterSequenceNode('moments/mean', ['Mean']),
            ConverterSequenceNode('moments/StopGradient', ['StopGradient']),
            ConverterSequenceNode('moments/SquaredDifference',
                                  ['SquaredDifference']),
            ConverterSequenceNode('moments/variance', ['Mean']),
            NonConsumableConverterSequenceNode('input', ['?']),
            NonConsumableConverterSequenceNode('variance_reduction_indices',
                                               ['?']),
            NonConsumableConverterSequenceNode('mean_reduction_indices',
                                               ['?']),
        ])
        sequence_keep_dims.set_inputs('moments/mean',
                                      ['input', 'mean_reduction_indices'])
        sequence_keep_dims.set_inputs('moments/StopGradient', ['moments/mean'])
        sequence_keep_dims.set_inputs('moments/SquaredDifference',
                                      ['input', 'moments/StopGradient'])
        sequence_keep_dims.set_inputs(
            'moments/variance',
            ['moments/SquaredDifference', 'variance_reduction_indices'])
        sequence_keep_dims.set_outputs(['moments/mean', 'moments/variance'])

        self.sequences = [sequence, sequence_keep_dims]
Example #9
0
    def __init__(self):
        sequence_resize = GraphSequence([ConverterSequenceNode('root', ['ResizeBilinear'])])
        sequence_resize.set_outputs(['root'])

        sequence_shape_stridedslice_resize = GraphSequence([
            NonConsumableConverterSequenceNode('input', ['?']),
            ConverterSequenceNode('shape', ['Shape']),
            ConverterSequenceNode('stridedSlice', ['StridedSlice']),
            ConverterSequenceNode('mul', ['Mul']),
            ConverterSequenceNode('const_stridedSlice_1', ['?']),
            ConverterSequenceNode('const_stridedSlice_2', ['?']),
            ConverterSequenceNode('const_stridedSlice_3', ['?']),
            ConverterSequenceNode('mul_const', ['?']),
            ConverterSequenceNode('root', ['ResizeBilinear'])])

        sequence_shape_stridedslice_resize.set_inputs('shape', ['input'])
        sequence_shape_stridedslice_resize.set_inputs('stridedSlice', ['shape',
                                                                       'const_stridedSlice_1',
                                                                       'const_stridedSlice_2',
                                                                       'const_stridedSlice_3'])
        sequence_shape_stridedslice_resize.set_inputs('mul', ['stridedSlice', 'mul_const'])
        sequence_shape_stridedslice_resize.set_inputs('root', ['mul', 'input'])
        sequence_shape_stridedslice_resize.set_outputs(['root'])

        self.sequences = [sequence_resize, sequence_shape_stridedslice_resize]
Example #10
0
 def __init__(self):
     self.sequence = GraphSequence([
         NonConsumableConverterSequenceNode('inputs', ['?']),
         ConverterSequenceNode('a', ['Mul']),
         ConverterSequenceNode('b', ['Add']),
         ConverterSequenceNode('weights', ['Const', 'Identity']),
         ConverterSequenceNode('biases', ['Const', 'Identity'])
     ])
     self.sequence.set_inputs('a', ['inputs', 'weights'])
     self.sequence.set_inputs('b', ['a', 'biases'])
     self.sequence.set_outputs(['b'])
    def __init__(self):
        sequence_extract_glimpse = GraphSequence([
            NonConsumableConverterSequenceNode('input', ['?']),
            NonConsumableConverterSequenceNode('offsets', ['?']),
            ConverterSequenceNode('size', ['Const']),
            ConverterSequenceNode('extract_glimpse', ['ExtractGlimpse'])
        ])
        sequence_extract_glimpse.set_inputs('extract_glimpse',
                                            ['input', 'size', 'offsets'])
        sequence_extract_glimpse.set_outputs(['extract_glimpse'])

        self.sequences = [sequence_extract_glimpse]
Example #12
0
    def __init__(self, layer_type, op_type, descriptor_class):
        super(ReductionLayerResolver, self).__init__()
        self._layer_type = layer_type
        self._op_type = op_type
        self._descriptor_class = descriptor_class

        self.sequence = GraphSequence([
            ConverterSequenceNode('root', [self._op_type]),
            ConverterSequenceNode('reduction_indices', ['Const']),
            NonConsumableConverterSequenceNode('input', ['?']),
        ])
        self.sequence.set_inputs('root', ['input', 'reduction_indices'])
        self.sequence.set_outputs(['root'])
Example #13
0
    def __init__(self):
        super(DepthwiseConvolutionLayerResolver, self).__init__()
        self.graph_sequence_with_bias = GraphSequence([
            ConverterSequenceNode('conv', ['DepthwiseConv2dNative']),
            ConverterSequenceNode('bias', ['BiasAdd', 'Add']),
            NonConsumableConverterSequenceNode('other', ['?'])
        ])
        self.graph_sequence_with_bias.set_inputs('bias', ['conv', 'other'])
        self.graph_sequence_with_bias.set_outputs(['bias'])

        self.graph_sequence = GraphSequence(
            [ConverterSequenceNode('conv', ['DepthwiseConv2dNative'])])
        self.graph_sequence.set_outputs(['conv'])
Example #14
0
    def __init__(self):
        sequence_two_dim_softmax = GraphSequence(
            [ConverterSequenceNode('root', ['SoftMax'])])
        sequence_two_dim_softmax.set_outputs(['root'])

        sequence_multi_dim_softmax = GraphSequence([
            ConverterSequenceNode('max', ['Max']),
            ConverterSequenceNode('max_reduction_indicies', ['Const']),
            ConverterSequenceNode('sub', ['Sub']),
            ConverterSequenceNode('exp', ['Exp']),
            ConverterSequenceNode('sum', ['Sum']),
            ConverterSequenceNode('sum_reduction_indicies', ['Const']),
            ConverterSequenceNode('root', ['RealDiv']),
            NonConsumableConverterSequenceNode('input', ['?'])
        ])
        sequence_multi_dim_softmax.set_inputs(
            'max', ['input', 'max_reduction_indicies'])
        sequence_multi_dim_softmax.set_inputs('sub', ['input', 'max'])
        sequence_multi_dim_softmax.set_inputs('exp', ['sub'])
        sequence_multi_dim_softmax.set_inputs(
            'sum', ['exp', 'sum_reduction_indicies'])
        sequence_multi_dim_softmax.set_inputs('root', ['exp', 'sum'])
        sequence_multi_dim_softmax.set_outputs(['root'])

        self.sequences = [sequence_two_dim_softmax, sequence_multi_dim_softmax]
Example #15
0
    def __init__(self):
        self.sequence_with_zero_padding = GraphSequence([
            ConverterSequenceNode('root', ['Pad', 'PadV2']),
            ConverterSequenceNode('paddings', ['Const']),
            NonConsumableConverterSequenceNode('input', ['?']),
        ])
        self.sequence_with_zero_padding.set_inputs('root',
                                                   ['input', 'paddings'])
        self.sequence_with_zero_padding.set_outputs(['root'])

        self.sequence_with_const_padding = GraphSequence([
            ConverterSequenceNode('root', ['Pad', 'PadV2']),
            ConverterSequenceNode('paddings', ['Const']),
            ConverterSequenceNode('const_values', ['Const']),
            NonConsumableConverterSequenceNode('input', ['?']),
        ])
        self.sequence_with_const_padding.set_inputs(
            'root', ['input', 'paddings', 'const_values'])
        self.sequence_with_const_padding.set_outputs(['root'])

        self.sequence_with_reflect_padding = GraphSequence([
            ConverterSequenceNode('mirror_pad', ['MirrorPad']),
            ConverterSequenceNode('paddings', ['Const']),
            NonConsumableConverterSequenceNode('input', ['?']),
        ])
        self.sequence_with_reflect_padding.set_inputs('mirror_pad',
                                                      ['input', 'paddings'])
        self.sequence_with_reflect_padding.set_outputs(['mirror_pad'])

        self.sequences = [
            self.sequence_with_zero_padding, self.sequence_with_const_padding,
            self.sequence_with_reflect_padding
        ]
Example #16
0
 def __init__(self):
     self.sequence = GraphSequence([
         ConverterSequenceNode('root', ['Slice']),
         NonConsumableConverterSequenceNode('input', ['?']),
         NonConsumableConverterSequenceNode('offsets', ['?']),
         NonConsumableConverterSequenceNode('size', ['?']),
     ])
     self.sequence.set_inputs('root', ['input', 'offsets', 'size'])
     self.sequence.set_outputs(['root'])
Example #17
0
    def __init__(self, layer_type, descriptor_type, pooling_type, op_type):
        super(PoolingLayerResolver, self).__init__()
        self._layer_type = layer_type
        self._descriptor_type = descriptor_type
        self._polling_type = pooling_type
        self._op_type = op_type

        self.sequence = GraphSequence(
            [ConverterSequenceNode('root', [self._op_type])])
        self.sequence.set_outputs(['root'])
Example #18
0
    def __init__(self):

        sequence_1 = GraphSequence([
            ConverterSequenceNode('gather', ['GatherV2']),
            NonConsumableConverterSequenceNode('params', ['?']),
            NonConsumableConverterSequenceNode('axis', ['?']),
            NonConsumableConverterSequenceNode('indices', ['Placeholder'])
        ])
        sequence_1.set_inputs('gather', ['params', 'axis', 'indices'])
        sequence_1.set_outputs(['gather'])

        # Filter seqs 2
        sequence_2 = GraphSequence([
            ConverterSequenceNode('gather', ['Gather']),
            NonConsumableConverterSequenceNode('params', ['?']),
            NonConsumableConverterSequenceNode('indices', ['Placeholder'])
        ])
        sequence_2.set_inputs('gather', ['params', 'indices'])
        sequence_2.set_outputs(['gather'])

        self.sequences = [sequence_1, sequence_2]
    def __init__(self, layer_type, op_type, descriptor_class):
        super(EltWiseUnaryLayerResolver, self).__init__()
        self._layer_type = layer_type
        self._op_type = op_type
        self._descriptor_class = descriptor_class

        self.sequence = GraphSequence([
            ConverterSequenceNode('root', [self._op_type]),
            NonConsumableConverterSequenceNode('input1', ['?']),
        ])
        self.sequence.set_inputs('root', ['input1'])
        self.sequence.set_outputs(['root'])
Example #20
0
 def __init__(self):
     super(DilatedDepthwiseConvolutionLayerResolver, self).__init__()
     self.graph_sequence = GraphSequence([
         NonConsumableConverterSequenceNode('space_to_batch',
                                            ['SpaceToBatchND']),
         NonConsumableConverterSequenceNode('inputs', ['?']),
         NonConsumableConverterSequenceNode('dilation_sizes', ['?']),
         NonConsumableConverterSequenceNode('paddings', ['?']),
         ConverterSequenceNode('conv_op', ['DepthwiseConv2dNative']),
         ConverterSequenceNode('kernel', ['?']),
         NonConsumableConverterSequenceNode('batch_to_space',
                                            ['BatchToSpaceND']),  # output
         NonConsumableConverterSequenceNode('block_shape_out', ['?']),
         NonConsumableConverterSequenceNode('crops', ['?'])
     ])
     self.graph_sequence.set_inputs(
         'space_to_batch', ['inputs', 'dilation_sizes', 'paddings'])
     self.graph_sequence.set_inputs('conv_op', ['space_to_batch', 'kernel'])
     self.graph_sequence.set_inputs('batch_to_space',
                                    ['conv_op', 'block_shape_out', 'crops'])
     self.graph_sequence.set_outputs(['batch_to_space'])
Example #21
0
    def __init__(self):
        sequence_crop_and_resize = GraphSequence([
            NonConsumableConverterSequenceNode('input', ['?']),
            NonConsumableConverterSequenceNode('boxes', ['?']),
            NonConsumableConverterSequenceNode('box_ind', ['?']),
            NonConsumableConverterSequenceNode('crop_size', ['?']),
            ConverterSequenceNode('crop_and_resize', ['CropAndResize']),
        ])
        sequence_crop_and_resize.set_inputs('crop_and_resize', ['input', 'boxes', 'box_ind', 'crop_size'])
        sequence_crop_and_resize.set_outputs(['crop_and_resize'])

        self.sequences = [sequence_crop_and_resize]
Example #22
0
 def __init__(self):
     self.sequence = GraphSequence([
         ConverterSequenceNode('a', ['Add']),
         ConverterSequenceNode('b', ['Rsqrt']),
         ConverterSequenceNode('c', ['Mul']),
         ConverterSequenceNode('d', ['Mul']),
         ConverterSequenceNode('e', ['Sub']),
         ConverterSequenceNode('f', ['Add']),  # output
         NonConsumableConverterSequenceNode('inputs', ['?']),
         ConverterSequenceNode('mean', ['?']),
         ConverterSequenceNode('beta', ['?']),
         ConverterSequenceNode('variance', ['?']),
         ConverterSequenceNode('epsilon', ['?'])
     ])
     self.sequence.set_inputs('a', ['variance', 'epsilon'])
     self.sequence.set_inputs('b', ['a'])
     self.sequence.set_inputs('c', ['b', 'inputs'])
     self.sequence.set_inputs('d', ['b', 'mean'])
     self.sequence.set_inputs('e', ['d', 'beta'])
     self.sequence.set_inputs('f', ['c', 'e'])
     self.sequence.set_outputs(['f'])
Example #23
0
 def __init__(self):
     self.sequence = GraphSequence([
         ConverterSequenceNode('reshape_out', ['Reshape']),
         ConverterSequenceNode('transpose', ['Transpose']),
         ConverterSequenceNode('reshape_in', ['Reshape']),
         ConverterSequenceNode('shape_in', ['Const']),
         ConverterSequenceNode('order', ['Const']),
         ConverterSequenceNode('shape_out', ['Const']),
         NonConsumableConverterSequenceNode('input', ['?']),
     ])
     self.sequence.set_inputs('reshape_out', ['shape_out', 'transpose'])
     self.sequence.set_inputs('transpose', ['order', 'reshape_in'])
     self.sequence.set_inputs('reshape_in', ['shape_in', 'input'])
     self.sequence.set_outputs(['reshape_out'])
 def __init__(self):
     # Graph topology of tf.math.l2_normalize
     self.sequence = GraphSequence([
         NonConsumableConverterSequenceNode('input', ['?']),
         ConverterSequenceNode('a', ['Square']),
         ConverterSequenceNode('weights', ['Const', 'Identity']),
         ConverterSequenceNode('b', ['Sum']),
         ConverterSequenceNode('epsilon', ['Const', 'Identity']),
         ConverterSequenceNode('c', ['Maximum']),
         ConverterSequenceNode('d', ['Rsqrt']),
         ConverterSequenceNode('e', ['Mul'])
     ])
     self.sequence.set_inputs('a', ['input'])
     self.sequence.set_inputs('b', ['a', 'weights'])
     self.sequence.set_inputs('c', ['b', 'epsilon'])
     self.sequence.set_inputs('d', ['c'])
     self.sequence.set_inputs('e', ['d', 'input'])
     self.sequence.set_outputs(['e'])
Example #25
0
    def __init__(self):
        sequence_keras = GraphSequence([
            NonConsumableConverterSequenceNode('input', ['?']),
            ConverterSequenceNode('root', ['Relu']),
            ConverterSequenceNode('min', ['Minimum']),
            ConverterSequenceNode('min_cast', ['Cast']),
            ConverterSequenceNode('min_const', ['Const']),
            ConverterSequenceNode('max', ['Maximum']),
            ConverterSequenceNode('max_const', ['Const'])
        ])
        sequence_keras.set_inputs('root', ['input'])
        sequence_keras.set_inputs('min_cast', ['min_const'])
        sequence_keras.set_inputs('min', ['root', 'min_cast'])
        sequence_keras.set_inputs('max', ['min', 'max_const'])
        sequence_keras.set_outputs(['max'])

        self.sequences = [sequence_keras]
Example #26
0
    def __init__(self, layer_type, op_type, descriptor_class):
        super(EltWiseLayerResolver, self).__init__()
        self._layer_type = layer_type
        self._op_type = op_type
        self._descriptor_class = descriptor_class

        self.sequence = GraphSequence([
            ConverterSequenceNode('root', [self._op_type]),
            NonConsumableConverterSequenceNode('input1', ['?']),
            NonConsumableConverterSequenceNode('input2', ['?'])
        ])
        self.sequence.set_inputs('root', ['input1', 'input2'])
        self.sequence.set_outputs(['root'])

        self.sequence_with_identity = GraphSequence([
            ConverterSequenceNode('root', [self._op_type]),
            ConverterSequenceNode('identity', ['Identity']),
            NonConsumableConverterSequenceNode('input1', ['?']),
            NonConsumableConverterSequenceNode('input2', ['?'])
        ])
        self.sequence_with_identity.set_inputs('identity', ['root'])
        self.sequence_with_identity.set_inputs('root', ['input1', 'input2'])
        self.sequence_with_identity.set_outputs(['identity'])

        self.sequence_with_const_input = GraphSequence([
            ConverterSequenceNode('root', [self._op_type]),
            NonConsumableConverterSequenceNode('const', ['Const', 'Identity']),
            NonConsumableConverterSequenceNode('other', ['?'])
        ])
        self.sequence_with_const_input.set_inputs('root', ['const', 'other'])
        self.sequence_with_const_input.set_outputs(['root'])

        self.sequence_with_const_input_and_identity = GraphSequence([
            ConverterSequenceNode('root', [self._op_type]),
            ConverterSequenceNode('identity', ['Identity']),
            NonConsumableConverterSequenceNode('const', ['Const', 'Identity']),
            NonConsumableConverterSequenceNode('other', ['?'])
        ])
        self.sequence_with_const_input_and_identity.set_inputs(
            'root', ['const', 'other'])
        self.sequence_with_const_input_and_identity.set_inputs(
            'identity', ['root'])
        self.sequence_with_const_input_and_identity.set_outputs(['identity'])
Example #27
0
 def __init__(self):
     self.sequence = GraphSequence(
         [ConverterSequenceNode('root', ['FusedBatchNorm'])])
     self.sequence.set_outputs(['root'])
Example #28
0
 def __init__(self):
     self.sequence = GraphSequence([
         ConverterSequenceNode('root', ['BatchNormWithGlobalNormalization'])
     ])
     self.sequence.set_outputs(['root'])
Example #29
0
# =============================================================================
#
#  Copyright (c) 2017-2019 Qualcomm Technologies, Inc.
#  All Rights Reserved.
#  Confidential and Proprietary - Qualcomm Technologies, Inc.
#
# =============================================================================
from snpe.converters.tensorflow.graph_matcher import (
    ConverterSequenceNode, NonConsumableConverterSequenceNode, GraphSequence)

box_decoder_sequence = GraphSequence([
    NonConsumableConverterSequenceNode('Postprocessor/Tile', ['Tile']),
    ConverterSequenceNode('Postprocessor/Reshape_1', ['Reshape']),
    ConverterSequenceNode('Postprocessor/Reshape', ['Reshape']),
    ConverterSequenceNode('Postprocessor/Decode/transpose', ['Transpose']),
    ConverterSequenceNode('Postprocessor/Decode/div_3', ['RealDiv']),
    ConverterSequenceNode('Postprocessor/Decode/div_2', ['RealDiv']),
    ConverterSequenceNode(
        'Postprocessor/Decode/get_center_coordinates_and_sizes/transpose',
        ['Transpose']),
    ConverterSequenceNode('Postprocessor/Decode/unstack', ['Unpack']),
    ConverterSequenceNode('Postprocessor/Decode/Exp', ['Exp']),
    ConverterSequenceNode(
        'Postprocessor/Decode/get_center_coordinates_and_sizes/div_1',
        ['RealDiv']),
    ConverterSequenceNode(
        'Postprocessor/Decode/get_center_coordinates_and_sizes/sub', ['Sub']),
    ConverterSequenceNode('Postprocessor/Decode/div_1', ['RealDiv']),
    ConverterSequenceNode('Postprocessor/Decode/Exp_1', ['Exp']),
    ConverterSequenceNode(
        'Postprocessor/Decode/get_center_coordinates_and_sizes/div',
Example #30
0
 def __init__(self):
     self.sequence = GraphSequence(
         [ConverterSequenceNode('root', ['Tanh'])])
     self.sequence.set_outputs(['root'])