allenai / bilm-tf

Tensorflow implementation of contextualized word representations from bi-directional language models
Apache License 2.0
1.62k stars 452 forks source link

How it works? #223

Open ZXR-v2 opened 4 years ago

ZXR-v2 commented 4 years ago

https://github.com/allenai/bilm-tf/blob/7cffee2b0986be51f5e2a747244836e1047657f4/bilm/model.py#L547

lstm_cell.state_size is an Integer or TensorShape, what does "for dim in lstm_cell.state_size" mean? And I don't know how "state_update_op = tf.assign(init_states[i], new_state)" works, since you assign init_states using "tf.zeros([self._max_batch_size, dim]" in L548.