def generate_one_direction_RNN(transformer, X, W, R, B, initial_h, clip, activation):
    """
    This function generates subgraph that represents one direction of unrolled RNN layer

    Parameters:
      transformer (ModelTransformerHelper): helper for model generation
      X (list of str): names of input tensors in sequence. Tensor shapes: [batch_size, input_size].
      W (list of str): name of weight tensor
      R (list of str): name of recurrence weight tensor
      B (list of str): name of bias tensor
      initial_h (str or None): name of tensor containing initial hidden state. Shape [batch_size, hidden_size]
      clip (float or None): range which clips input of activations
      act (str): activation function
    """
    # one direction RNN:
    #
    # H = f(X*(W^T) + h*(R^T) + B)
    #
    # H  - new hidden state
    # h  - previous hidden state
    # X  - current input
    # W  - input weights matrix
    # R  - reccurent weights matrix
    # Wb - input weights matmul bias
    # Rb - reccurent weights matmul bias
    # f  - activation function

    seq_length = len(X)
    first_iter = 0
    state_tensors = []
    if initial_h is not None:
        previous_state_tensor = initial_h
    else:
        first_iter = 1
        state_tensor = transformer.make_node('Gemm', [X[0]] + W + B, 1, transB=1)
        if clip != None:
            state_tensor = transformer.make_node(
                'Clip', state_tensor, 1, min=-clip, max=clip)
        previous_state_tensor = transformer.make_node(activation, state_tensor, 1)
        state_tensors += previous_state_tensor

    for i in range(first_iter, seq_length):
        state_tensor = transformer.make_node('Gemm', [X[i]] + W + B, 1, transB=1)
        state_tensor = transformer.make_node(
            'Gemm', previous_state_tensor + R + state_tensor, 1, transB=1)
        if clip != None:
            state_tensor = transformer.make_node(
                'Clip', state_tensor, 1, min=-clip, max=clip)
        previous_state_tensor = transformer.make_node(activation, state_tensor, 1)
        state_tensors += previous_state_tensor
    return state_tensors