(self, graph, nodes)
return [reshape_1, transpose_1, final_reshape]
In general, CoreML Reshape and Transpose layers don't support tensors with more
        than 4 dimensions. However, certain patterns in onnx like
            "reshape-> (rank 6) -> transpose (rank 6) -> reshape (rank 4)"
        can be translated to CoreML as (i.e. without going to rank 6)
            "reshape-> (rank 4) -> transpose (rank 4) -> reshape (rank 4)"
In general, CoreML Reshape and Transpose layers don't support tensors with more
        than 4 dimensions. However, certain patterns in onnx like
            "reshape-> (rank 6) -> transpose (rank 6) -> reshape (rank 4)"
        can be translated to CoreML as (i.e. without going to rank 6)
            "reshape-> (rank 4) -> transpose (rank 4) -> reshape (rank 4)"
In general CoreML Reshape and Transpose layers don t support tensors with more than 4 dimensions . However certain patterns in onnx like reshape - > ( rank 6 ) - > transpose ( rank 6 ) - > reshape ( rank 4 ) can be translated to CoreML as ( i . e . without going to rank 6 ) reshape - > ( rank 4 ) - > transpose ( rank 4 ) - > reshape ( rank 4 )
def merge(self, graph, nodes):  # type: (Graph, Sequence[Node]) -> Sequence[Node]
        '''
        In general, CoreML Reshape and Transpose layers don't support tensors with more
        than 4 dimensions. However, certain patterns in onnx like
            "reshape-> (rank 6) -> transpose (rank 6) -> reshape (rank 4)"
        can be translated to CoreML as (i.e. without going to rank 6)
            "reshape-> (rank 4) -> transpose (rank 4) -> reshape (rank 4)"
        '''
        reshape_1 = nodes[0]
        transpose_1 = nodes[1]
        final_reshape = nodes[2]


        shape_1 = reshape_1.input_tensors[reshape_1.inputs[1]]
        shape_1 = _get_fully_defined_shape(shape_1, nodes[0].outputs[0], graph)
        shape_1 = shape_1[1:]
        perm = nodes[1].attrs.get('perm', [])
        perm = perm[1:]
        perm = [x - 1 for x in perm]
        # now perm is length 5 list

        new_perm = []
        new_shape = [1,1,1,1]
        i = 0
        found_consecutive_pair = False
        while i < 5:
            if not found_consecutive_pair and i < 4 and perm[i+1] - perm[i] == 1:
                new_perm.append(perm[i])
                new_shape[perm[i]] = shape_1[perm[i]] * shape_1[perm[i+1]]
                i = i + 2
                found_consecutive_pair = True
                continue
            else:
                new_perm.append(perm[i] - 1)
                new_shape[perm[i] - 1] = shape_1[perm[i]]
            i += 1

        reshape_1.input_tensors[reshape_1.inputs[1]] = np.asarray(new_shape)
        transpose_1.attrs['perm'] = new_perm

        return [reshape_1, transpose_1, final_reshape]
def merge ( self , graph , nodes ) : # type: (Graph, Sequence[Node]) -> Sequence[Node] reshape_1 = nodes [ 0 ] transpose_1 = nodes [ 1 ] final_reshape = nodes [ 2 ] shape_1 = reshape_1 . input_tensors [ reshape_1 . inputs [ 1 ] ] shape_1 = _get_fully_defined_shape ( shape_1 , nodes [ 0 ] . outputs [ 0 ] , graph ) shape_1 = shape_1 [ 1 : ] perm = nodes [ 1 ] . attrs . get ( 'perm' , [ ] ) perm = perm [ 1 : ] perm = [ x - 1 for x in perm ] # now perm is length 5 list new_perm = [ ] new_shape = [ 1 , 1 , 1 , 1 ] i = 0 found_consecutive_pair = False while i < 5 : if not found_consecutive_pair and i < 4 and perm [ i + 1 ] - perm [ i ] == 1 : new_perm . append ( perm [ i ] ) new_shape [ perm [ i ] ] = shape_1 [ perm [ i ] ] * shape_1 [ perm [ i + 1 ] ] i = i + 2 found_consecutive_pair = True continue else : new_perm . append ( perm [ i ] - 1 ) new_shape [ perm [ i ] - 1 ] = shape_1 [ perm [ i ] ] i += 1 reshape_1 . input_tensors [ reshape_1 . inputs [ 1 ] ] = np . asarray ( new_shape ) transpose_1 . attrs [ 'perm' ] = new_perm return [ reshape_1 , transpose_1 , final_reshape ]