mirror of
https://github.com/hpcaitech/ColossalAI.git
synced 2025-09-06 11:32:10 +00:00
[hotfix]: Remove math.prod dependency (#2837)
* Remove math.prod dependency * Fix style * Fix style --------- Co-authored-by: Jiatong Han <jiatong.han@u.nus.edu>
This commit is contained in:
committed by
GitHub
parent
819e25d8b1
commit
8c8a39be95
@@ -1,6 +1,6 @@
|
||||
import math
|
||||
import operator
|
||||
from copy import copy
|
||||
from functools import lru_cache
|
||||
from functools import lru_cache, reduce
|
||||
from typing import Callable, Optional, Set
|
||||
|
||||
import torch
|
||||
@@ -312,7 +312,7 @@ class ColoTensor(torch.Tensor):
|
||||
def numel_global(self):
|
||||
"""Returns the number of elements in the tensor when it's replicated.
|
||||
"""
|
||||
return math.prod(self.size_global())
|
||||
return reduce(operator.mul, self.size_global(), 1)
|
||||
|
||||
# Some API for dist spec check
|
||||
|
||||
|
Reference in New Issue
Block a user