Take the mean over all non-batch dimensions.
(tensor)
| 163 | |
| 164 | |
| 165 | def mean_flat(tensor): |
| 166 | """ |
| 167 | Take the mean over all non-batch dimensions. |
| 168 | """ |
| 169 | return tensor.mean(dim=list(range(1, len(tensor.shape)))) |
| 170 | |
| 171 | |
| 172 | def normal_kl(mean1, logvar1, mean2, logvar2): |
no outgoing calls
no test coverage detected