parameters: (self, graph: Graph, node: Node)
return_statement: return []
docstring: Reconnecting input edges of LSTMSequence:
          TF input edges:             Description:                 MO input edges:
                1                          input                        0
                4                         weights                       1
                8                         biases                        2
                3               h_prev: initial output of cell          3
                2               cs_prev: initial cell state             4
docstring_summary: Reconnecting input edges of LSTMSequence:
          TF input edges:             Description:                 MO input edges:
                1                          input                        0
                4                         weights                       1
                8                         biases                        2
                3               h_prev: initial output of cell          3
                2               cs_prev: initial cell state             4
docstring_tokens: Reconnecting input edges of LSTMSequence : TF input edges : Description : MO input edges : 1 input 0 4 weights 1 8 biases 2 3 h_prev : initial output of cell 3 2 cs_prev : initial cell state 4
function: def replace_op(self, graph: Graph, node: Node):
          if node.use_peephole:
              raise Error("BlockLSTM operation is not supported with `use_peephole`==True. Node: {}"
                          "".format(node.soft_get('name')))
  
          if node.cell_clip != -1:
              raise Error("Clipping is not supported for BlockLSTM operation. `cell_clip`={!s} for node: {}"
                          "".format(node.cell_clip, node.soft_get('name')))
  
          log.debug("Start BlockLSTM->LSTMSequence translation for node: {} with parameters:\n"
                    "`cell_clip`={!s}, `use_peephole`=={!s}, `forget_bias`={!s}\n"
                    "inputs: {},\noutputs:{}".format(node.soft_get('name'), node.cell_clip, node.use_peephole,
                                                     node.forget_bias, {p: i.id for p, i in node.in_nodes().items()},
                                                     {p: o.id for p, o in node.out_nodes().items()}))
  
          log.debug("Cutting all inputs for peephole connection (5, 6, 7 input ports) off, as `use_peephole`=False")
  
          for p, input_data in node.in_nodes().items():
              if p in [5, 6, 7]:
                  key = self.find_key_by_input_port(node.in_node(p), node, p)
                  assert key is not None
                  graph.remove_edge(node.in_node(p).id, node.id, key=key)
  
          log.debug("Cutting seq_len_max input off")
          graph.remove_edge(node.in_node(0).id, node.id)
  
          """
          Reconnecting input edges of LSTMSequence:
          TF input edges:             Description:                 MO input edges:
                1                          input                        0
                4                         weights                       1
                8                         biases                        2
                3               h_prev: initial output of cell          3
                2               cs_prev: initial cell state             4
          """
          inputs = node.in_edges()
          assert 1 in inputs, "Sequence input to the BlockLSTM is required (1 port). Node {}".format(node.id)
          assert 2 in inputs, "Value of the initial cell state is required (2 port). Node {}".format(node.id)
          assert 3 in inputs, "Initial output of cell is required input to BlockLSTM (3 port). Node {}".format(node.id)
          assert 4 in inputs, "The weight matrix is required input to BlockLSTM (4 port) . Node {}".format(node.id)
          assert 8 in inputs, "The bias vector is required input to BlockLSTM (8 port). Node {}".format(node.id)
  
          inputs[3]['in'] = 3
          inputs[1]['in'] = 0
          inputs[4]['in'] = 1
          inputs[2]['in'] = 4
          inputs[8]['in'] = 2
  
          log.debug("Checking for unsupported outputs usage (output ports: 0, 2, 3, 4, 5)")
          for port, input_data in node.out_nodes().items():
              if port in [0, 2, 3, 4, 5]:
                  raise Error("Output port {} of BlockLSTM node {} is not supported".format(node.id, port))
  
          """
          Reconnecting output edges of LSTMSequence:
          TF output edges:             Description:                 MO output edges:
                6                     output h vector                     0
                1                   cell state before the tanh            1
          """
  
          outputs = node.out_edges()
          if 6 in outputs:
              outputs[6]['out'] = 0
              node.add_output_port(0, skip_if_exist=True)
  
          # do not replace any output edge
          return []
function_tokens: def replace_op ( self , graph : Graph , node : Node ) : if node . use_peephole : raise Error ( "BlockLSTM operation is not supported with `use_peephole`==True. Node: {}" "" . format ( node . soft_get ( 'name' ) ) ) if node . cell_clip != - 1 : raise Error ( "Clipping is not supported for BlockLSTM operation. `cell_clip`={!s} for node: {}" "" . format ( node . cell_clip , node . soft_get ( 'name' ) ) ) log . debug ( "Start BlockLSTM->LSTMSequence translation for node: {} with parameters:\n" "`cell_clip`={!s}, `use_peephole`=={!s}, `forget_bias`={!s}\n" "inputs: {},\noutputs:{}" . format ( node . soft_get ( 'name' ) , node . cell_clip , node . use_peephole , node . forget_bias , { p : i . id for p , i in node . in_nodes ( ) . items ( ) } , { p : o . id for p , o in node . out_nodes ( ) . items ( ) } ) ) log . debug ( "Cutting all inputs for peephole connection (5, 6, 7 input ports) off, as `use_peephole`=False" ) for p , input_data in node . in_nodes ( ) . items ( ) : if p in [ 5 , 6 , 7 ] : key = self . find_key_by_input_port ( node . in_node ( p ) , node , p ) assert key is not None graph . remove_edge ( node . in_node ( p ) . id , node . id , key = key ) log . debug ( "Cutting seq_len_max input off" ) graph . remove_edge ( node . in_node ( 0 ) . id , node . id ) inputs = node . in_edges ( ) assert 1 in inputs , "Sequence input to the BlockLSTM is required (1 port). Node {}" . format ( node . id ) assert 2 in inputs , "Value of the initial cell state is required (2 port). Node {}" . format ( node . id ) assert 3 in inputs , "Initial output of cell is required input to BlockLSTM (3 port). Node {}" . format ( node . id ) assert 4 in inputs , "The weight matrix is required input to BlockLSTM (4 port) . Node {}" . format ( node . id ) assert 8 in inputs , "The bias vector is required input to BlockLSTM (8 port). Node {}" . format ( node . id ) inputs [ 3 ] [ 'in' ] = 3 inputs [ 1 ] [ 'in' ] = 0 inputs [ 4 ] [ 'in' ] = 1 inputs [ 2 ] [ 'in' ] = 4 inputs [ 8 ] [ 'in' ] = 2 log . debug ( "Checking for unsupported outputs usage (output ports: 0, 2, 3, 4, 5)" ) for port , input_data in node . out_nodes ( ) . items ( ) : if port in [ 0 , 2 , 3 , 4 , 5 ] : raise Error ( "Output port {} of BlockLSTM node {} is not supported" . format ( node . id , port ) ) """
          Reconnecting output edges of LSTMSequence:
          TF output edges:             Description:                 MO output edges:
                6                     output h vector                     0
                1                   cell state before the tanh            1
          """ outputs = node . out_edges ( ) if 6 in outputs : outputs [ 6 ] [ 'out' ] = 0 node . add_output_port ( 0 , skip_if_exist = True ) # do not replace any output edge return [ ]