Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize summing of losses in run_step() & Fix typos (#862)
Summary: I noticed that the `run_step()` method uses `sum(loss for loss in loss_dict.values())` which could be simplified to `sum(loss_dict.values())`. A side benefit is faster execution. Tested locally with a `loss_dict` consisting of 32 losses: Proposed: `482 ns ± 53.4 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)` Original: `2.02 µs ± 77.6 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)` Plus I fixed some typos and an assertion along the way :) Pull Request resolved: #862 Differential Revision: D19907088 Pulled By: ppwwyyxx fbshipit-source-id: 403000087fe8fb302f5a7226a3320a3101951721
- Loading branch information