implement batch entropy in python

Maybe this is a good time to rename `to_sample` to a noun like `requested_row` everywhere.