About   cv   Etc   Now   Zettelkästen  
numpy

Masking with Boolean arrays in Numpy

Use case ¶ I regularly encounter situations where I have an array that specifies which elements to keep in another array. If you for example want to provide batched inputs to a BERT language model as a tensor, you have to pad the input text sequences because the tensor needs to be a square matrix. BERT uses attention masks (Boolean arrays) to …

Read more


See archives for more ...

An IndieWeb Webring 🕸💍