[hotfix]: Remove math.prod dependency
📌 Checklist before creating the PR
- [x] I have created an issue for this PR for traceability
- [x] The title follows the standard format:
[doc/gemini/tensor/...]: A concise description - [ ] I have added relevant tags if possible for us to better distinguish different PRs
🚨 Issue number
Fixed #2832
📝 What does this PR do?
Removes dependency on the math.prod functionality and replaces it with reduce and operator.mul that are backward compatible with Python3.7.
💥 Checklist before requesting a review
- [x] I have linked my PR to an issue (instruction)
- [x] My issue clearly describes the problem/feature/proposal, with diagrams/charts/table/code if possible
- [x] I have performed a self-review of my code
- [ ] I have added thorough tests.
- [ ] I have added docstrings for all the functions/methods I implemented
⭐️ Do you enjoy contributing to Colossal-AI?
- [x] 🌝 Yes, I do.
- [ ] 🌚 No, I don't.
Tell us more if you don't enjoy contributing to Colossal-AI.
Your pre-commit check failed, follow the steps to run pre-commit on your file for code style consistency.
- install pre-commit via "pip install pre-commit"
- install pre-commit hooks via "pre-commit install"
- run pre-commit on file with format error via "pre-commit run --files path" by replacing "path" with the actual file path
- commit and push to your branch
View your job at https://github.com/hpcaitech/ColossalAI/actions/runs/4222743567. Read our "CONTRIBUTING.md" for more reference to the code style.
The code coverage for the changed files is 89%.
Click me to view the complete report
Name Stmts Miss Cover
------------------------------------------------------
colossalai/nn/_ops/view.py 63 8 87%
colossalai/tensor/colo_tensor.py 165 16 90%
------------------------------------------------------
TOTAL 228 24 89%
Hi, @JThh The pre-commit CI fails. Could you polish your code with pre-commit? You can refer to https://github.com/hpcaitech/ColossalAI/blob/main/CONTRIBUTING.md#code-style
Your pre-commit check failed, follow the steps to run pre-commit on your file for code style consistency.
- install pre-commit via "pip install pre-commit"
- install pre-commit hooks via "pre-commit install"
- run pre-commit on file with format error via "pre-commit run --files path" by replacing "path" with the actual file path
- commit and push to your branch
View your job at https://github.com/hpcaitech/ColossalAI/actions/runs/4252824424. Read our "CONTRIBUTING.md" for more reference to the code style.
The code coverage for the changed files is 89%.
Click me to view the complete report
Name Stmts Miss Cover
------------------------------------------------------
colossalai/nn/_ops/view.py 63 8 87%
colossalai/tensor/colo_tensor.py 165 16 90%
------------------------------------------------------
TOTAL 228 24 89%
The code coverage for the changed files is 89%.
Click me to view the complete report
Name Stmts Miss Cover
------------------------------------------------------
colossalai/nn/_ops/view.py 63 8 87%
colossalai/tensor/colo_tensor.py 165 16 90%
------------------------------------------------------
TOTAL 228 24 89%