def add_permute(self, name, dim, input_name, output_name):
        """
        Add a permute layer. Assumes that the input has dimensions in the order [Seq, C, H, W]

        Parameters
        ----------
        name: str
            The name of this layer.
        dim: tuple
            The order in which to permute the input dimensions = [seq,C,H,W].
            Must have length 4 and a permutation of ``[0, 1, 2, 3]``.

            examples:

            Lets say input has shape: [seq, C, H, W].

            If ``dim`` is set to ``[0, 3, 1, 2]``,
            then the output has shape ``[W,C,H]``
            and has the same sequence length that of the input.

            If ``dim`` is set to ``[3, 1, 2, 0]``,
            and the input is a sequence of data
            with length ``Seq`` and shape ``[C, 1, 1]``,
            then the output is a unit sequence of data with shape ``[C, 1, Seq]``.

            If ``dim`` is set to ``[0, 3, 2, 1]``,
            the output is a reverse of the input: ``[C, H, W] -> [W, H, C]``.

            If ``dim`` is not set, or is set to ``[0, 1, 2, 3]``,
            the output is the same as the input.
        input_name: str
            The input blob name of this layer.
        output_name: str
            The output blob name of this layer.

        See Also
        --------
        add_flatten, add_reshape
        """
        spec = self.spec
        nn_spec = self.nn_spec

        # Add a new layer
        spec_layer = nn_spec.layers.add()
        spec_layer.name = name
        spec_layer.input.append(input_name)
        spec_layer.output.append(output_name)

        spec_layer_params = spec_layer.permute
        spec_layer_params.axis.extend(list(dim))

        if len(dim) != 4:
            raise ValueError("Length of the 'dim' parameter must be equal to 4")
def add_permute ( self , name , dim , input_name , output_name ) : spec = self . spec nn_spec = self . nn_spec spec_layer = nn_spec . layers . add ( ) spec_layer . name = name spec_layer . input . append ( input_name ) spec_layer . output . append ( output_name ) spec_layer_params = spec_layer . permute spec_layer_params . axis . extend ( list ( dim ) ) if len ( dim ) != 4 : raise ValueError ( "Length of the 'dim' parameter must be equal to 4" )
Add a permute layer. Assumes that the input has dimensions in the order [Seq, C, H, W]

        Parameters
        ----------
        name: str
            The name of this layer.
        dim: tuple
            The order in which to permute the input dimensions = [seq,C,H,W].
            Must have length 4 and a permutation of ``[0, 1, 2, 3]``.

            examples:

            Lets say input has shape: [seq, C, H, W].

            If ``dim`` is set to ``[0, 3, 1, 2]``,
            then the output has shape ``[W,C,H]``
            and has the same sequence length that of the input.

            If ``dim`` is set to ``[3, 1, 2, 0]``,
            and the input is a sequence of data
            with length ``Seq`` and shape ``[C, 1, 1]``,
            then the output is a unit sequence of data with shape ``[C, 1, Seq]``.

            If ``dim`` is set to ``[0, 3, 2, 1]``,
            the output is a reverse of the input: ``[C, H, W] -> [W, H, C]``.

            If ``dim`` is not set, or is set to ``[0, 1, 2, 3]``,
            the output is the same as the input.
        input_name: str
            The input blob name of this layer.
        output_name: str
            The output blob name of this layer.

        See Also
        --------
        add_flatten, add_reshape