def __init__(self, vocab, shift):
    """Initialize shift layer.

    Args:
      vocab: (list of String) the vocabulary
      shift: (Integer) the amount of shift apply to the alphabet.
        Positive number implies shift to the right, negative number
        implies shift to the left.
    """
    self.shift = shift
    alphabet = vocab
    shifted_alphabet = deque(alphabet)
    shifted_alphabet.rotate(shift)
    self.encrypt = dict(zip(alphabet, list(shifted_alphabet)))
    self.decrypt = dict(zip(list(shifted_alphabet), alphabet))
Initialize shift layer.

    Args:
      vocab: (list of String) the vocabulary
      shift: (Integer) the amount of shift apply to the alphabet.
        Positive number implies shift to the right, negative number
        implies shift to the left.
    
tensor2tensor/data_generators/cipher.py