matchzoo.dataloader.callbacks.dynamic_pooling
¶
Module Contents¶
-
class
matchzoo.dataloader.callbacks.dynamic_pooling.
DynamicPooling
(fixed_length_left: int, fixed_length_right: int, compress_ratio_left: float = 1, compress_ratio_right: float = 1)¶ Bases:
matchzoo.engine.base_callback.BaseCallback
DPoolPairDataGenerator
constructor.Parameters: - fixed_length_left – max length of left text.
- fixed_length_right – max length of right text.
- compress_ratio_left – the length change ratio, especially after normal pooling layers.
- compress_ratio_right – the length change ratio, especially after normal pooling layers.
-
on_batch_unpacked
(self, x, y)¶ Insert dpool_index into x.
Parameters: - x – unpacked x.
- y – unpacked y.
-
matchzoo.dataloader.callbacks.dynamic_pooling.
_dynamic_pooling_index
(length_left: np.array, length_right: np.array, fixed_length_left: int, fixed_length_right: int, compress_ratio_left: float, compress_ratio_right: float) → np.array¶