Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Rllib] Make 'get_num_parameters' more efficient. (#50923)
## Why are these changes needed The actual parameter count method uses multiple loops to count the number of parameters. Furthermore it uses `np.prod` and `filter`. The proposed method in this PR instead uses native torch C++ code to count parameters in a single loop without filtering. ## Related issue number <!-- For example: "Closes #1234" --> ## Checks - [ ] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR. - [ ] I've run `scripts/format.sh` to lint the changes in this PR. - [ ] I've included any doc changes needed for https://docs.ray.io/en/master/. - [ ] I've added any new APIs to the API Reference. For example, if I added a method in Tune, I've added it in `doc/source/tune/api/` under the corresponding `.rst` file. - [ ] I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/ - Testing Strategy - [ ] Unit tests - [ ] Release tests - [ ] This PR is not tested :( --------- Signed-off-by: simonsays1980 <simon.zehnder@gmail.com>
- Loading branch information