Skip to content

Instantly share code, notes, and snippets.

@alonstern
Created April 13, 2020 08:10
Show Gist options
  • Save alonstern/ef8cc1f961d12098f607d57c0c4e461d to your computer and use it in GitHub Desktop.
Save alonstern/ef8cc1f961d12098f607d57c0c4e461d to your computer and use it in GitHub Desktop.
split to block without padding
def _split_to_blocks(self, data, tags, block_size):
data_blocks = []
tags_blocks = []
for file_data, file_tags in zip(data, tags):
for start_index in range(0, len(file_data), block_size):
data_blocks.append(file_data[start_index: start_index + block_size])
tags_blocks.append(file_tags[start_index: start_index + block_size])
return data_blocks, tags_blocks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment