matchzoo.dataloader.callbacks.padding

Module Contents

class matchzoo.dataloader.callbacks.padding.BasicPadding(fixed_length_left:int=None, fixed_length_right:int=None, pad_value:typing.Union[int, str]=0, pad_mode:str='pre')

Bases: matchzoo.engine.base_callback.BaseCallback

Pad data for basic preprocessor.

Parameters:
  • fixed_length_left – Integer. If set, text_left will be padded to this length.
  • fixed_length_right – Integer. If set, text_right will be padded to this length.
  • pad_value – the value to fill text.
  • pad_mode – String, pre or post: pad either before or after each sequence.
on_batch_unpacked(self, x:dict, y:np.ndarray)

Pad x[‘text_left’] and x[‘text_right].

class matchzoo.dataloader.callbacks.padding.DRMMPadding(fixed_length_left:int=None, fixed_length_right:int=None, pad_value:typing.Union[int, str]=0, pad_mode:str='pre')

Bases: matchzoo.engine.base_callback.BaseCallback

Pad data for DRMM Model.

Parameters:
  • fixed_length_left – Integer. If set, text_left and match_histogram will be padded to this length.
  • fixed_length_right – Integer. If set, text_right will be padded to this length.
  • pad_value – the value to fill text.
  • pad_mode – String, pre or post: pad either before or after each sequence.
on_batch_unpacked(self, x:dict, y:np.ndarray)

Padding.

Pad x[‘text_left’], x[‘text_right] and x[‘match_histogram’].

class matchzoo.dataloader.callbacks.padding.CDSSMPadding(fixed_length_left:int=None, fixed_length_right:int=None, pad_value:typing.Union[int, str]=0, pad_mode:str='pre')

Bases: matchzoo.engine.base_callback.BaseCallback

Pad data for cdssm preprocessor.

Parameters:
  • fixed_length_left – Integer. If set, text_left will be padded to this length.
  • fixed_length_right – Integer. If set, text_right will be padded to this length.
  • pad_value – the value to fill text.
  • pad_mode – String, pre or post: pad either before or after each sequence.
on_batch_unpacked(self, x:dict, y:np.ndarray)

Pad x[‘text_left’] and x[‘text_right].

class matchzoo.dataloader.callbacks.padding.DIINPadding(fixed_length_left:int=None, fixed_length_right:int=None, fixed_length_word:int=None, pad_value:typing.Union[int, str]=0, pad_mode:str='pre')

Bases: matchzoo.engine.base_callback.BaseCallback

Pad data for diin preprocessor.

Parameters:
  • fixed_length_left – Integer. If set, text_left, char_left and match_left will be padded to this length.
  • fixed_length_right – Integer. If set, text_right, char_right and match_right will be padded to this length.
  • fixed_length_word – Integer. If set, words in char_left and char_right will be padded to this length.
  • pad_value – the value to fill text.
  • pad_mode – String, pre or post: pad either before or after each sequence.
on_batch_unpacked(self, x:dict, y:np.ndarray)

Padding.

Pad x[‘text_left’], x[‘text_right],
x[‘char_left’], x[‘char_right], x[‘match_left’], x[‘match_right].
class matchzoo.dataloader.callbacks.padding.BertPadding(fixed_length_left:int=None, fixed_length_right:int=None, pad_value:typing.Union[int, str]=0, pad_mode:str='pre')

Bases: matchzoo.engine.base_callback.BaseCallback

Pad data for bert preprocessor.

Parameters:
  • fixed_length_left – Integer. If set, text_left will be padded to this length.
  • fixed_length_right – Integer. If set, text_right will be padded to this length.
  • pad_value – the value to fill text.
  • pad_mode – String, pre or post: pad either before or after each sequence.
on_batch_unpacked(self, x:dict, y:np.ndarray)

Pad x[‘text_left’] and x[‘text_right].