ufal / neuralmonkey

An open-source tool for sequence learning in NLP built on TensorFlow.
BSD 3-Clause "New" or "Revised" License
410 stars 104 forks source link

Dataset.buffer_size is not properly initialized #765

Open varisd opened 5 years ago

varisd commented 5 years ago

When initializing Dataset with buffer_size=None, attribute self.buffer_size is not created even though it can be called later in the Dataset methods. Most of the time, it is checked (by checking the value of the self.lazy attribute), however, this is not always the case as in https://github.com/ufal/neuralmonkey/blob/master/neuralmonkey/dataset.py#L569 (Also notice the mypy miss on the type mismatch of 'int' vs 'Tuple[int, int]')

Having the dependency of the value of self.buffer_size on self.lazy is also imho a bad practice and worsens code readability.