text: # https://github.com/richliao/textClassifier/blob/master/textClassifierHATT.py
  
  l_lstm = Bidirectional(GRU(100, return_sequences=True))(embedded_sequences)
  l_att = AttLayer(100)(l_lstm)
  sentEncoder = Model(sentence_input, l_att)
  
  review_input = Input(shape=(MAX_SENTS, MAX_SENT_LENGTH), dtype='int32')
  review_encoder = TimeDistributed(sentEncoder)(review_input)
  l_lstm_sent = Bidirectional(GRU(100, return_sequences=True))(review_encoder)
  l_att_sent = AttLayer(100)(l_lstm_sent)
  preds = Dense(2, activation='softmax')(l_att_sent)
  model = Model(review_input, preds)
  
  model.compile(loss='categorical_crossentropy',
                optimizer='rmsprop',
                metrics=['acc'])
  
  print("model fitting - Hierachical attention network")
  model.fit(x_train, y_train, validation_data=(x_val, y_val),
            nb_epoch=10, batch_size=50)