Returns all the subsets of this set. This is a generator.
(seq)
| 19 | from thop import clever_format |
| 20 | |
| 21 | def powerset(seq): |
| 22 | """ |
| 23 | Returns all the subsets of this set. This is a generator. |
| 24 | """ |
| 25 | if len(seq) <= 1: |
| 26 | yield seq |
| 27 | yield [] |
| 28 | else: |
| 29 | for item in powerset(seq[1:]): |
| 30 | yield [seq[0]]+item |
| 31 | yield item |
| 32 | |
| 33 | def clip_gradient(optimizer, grad_clip): |
| 34 | """ |
no outgoing calls
no test coverage detected