class_docstr: Attributes:
  layer_list - a list of layer names in the Keras model
  connection_map - a map where the key is a layer, the value is a list of its successors
  reverse_connection_map - a map where the key is a layer, the value is a list of its predecessors
  keras_layer_map - a map where the key is a layer name, the value is Keras layer
  model - a reference of the keras model.
  blob_names - blob names for each one of the edge.
class_docstr_tok: ["Attributes",":","layer_list","-","a","list","of","layer","names","in","the","Keras","model","connection_map","-","a","map","where","the","key","is","a","layer",",","the","value","is","a","list","of","its","successors","reverse_connection_map","-","a","map","where","the","key","is","a","layer",",","the","value","is","a","list","of","its","predecessors","keras_layer_map","-","a","map","where","the","key","is","a","layer","name",",","the","value","is","Keras","layer","model","-","a","reference","of","the","keras","model",".","blob_names","-","blob","names","for","each","one","of","the","edge","."]
docstr: Insert permutation layers before a 1D start point or after 1D end point
docstr_tok: ["Insert","permutation","layers","before","a","1D","start","point","or","after","1D","end","point"]
code: def insert_1d_permute_layers(self):
      """
      Insert permutation layers before a 1D start point or after 1D end point
      """
      idx, nb_layers = 0, len(self.layer_list)
      in_edges, out_edges = self._get_1d_interface_edges()
  
      # Hacky Warning: (1) use a 4-D permute, which is not likely to happen in Keras,
      # to represent actual permutation needed for (seq, c, h, w) in CoreML
      # (2) Assume 2-D input shape has meaning (seq, c), and during CoreML runtime,
      # it is represented as 4D blob, (seq, c, h, w)
      for in_edge in in_edges:
          src, snk = in_edge
          if src is None:
              permute_layer = "_permute_" + snk
          else:
              permute_layer = src + "_permute_" + snk
          keras_permute = _keras.layers.Permute(
              dims=(3, 1, 2, 0)
          )  # assume w = 1, switch seq and w
          self._insert_layer_between(
              src, snk, permute_layer, keras_permute
          )
      for out_edge in out_edges:
          src, snk = out_edge
          if snk is None:
              permute_layer = src + "_permute_"
          else:
              permute_layer = src + "_permute_" + snk
          keras_permute = _keras.layers.Permute(
              dims=(3, 1, 2, 0)
          )  # assume w = 1, switch seq and w back
          self._insert_layer_between(
              src, snk, permute_layer, keras_permute
          )
  
imports: import keras
  import numpy
  import six
  from distutils.version import StrictVersion
label_desc: Use image node_id 34 for calling the NetGraph obj's underlying member method code with example usage: obj.insert_1d_permute_layers() without return types