mirror of https://github.com/hpcaitech/ColossalAI
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
459 B
15 lines
459 B
1 year ago
|
def divide(numerator, denominator):
|
||
|
"""Only allow exact division.
|
||
|
|
||
|
Args:
|
||
|
numerator (int): Numerator of the division.
|
||
|
denominator (int): Denominator of the division.
|
||
|
|
||
|
Returns:
|
||
|
int: the result of exact division.
|
||
|
"""
|
||
|
assert denominator != 0, 'denominator can not be zero'
|
||
|
assert numerator % denominator == 0, \
|
||
|
'{} is not divisible by {}'.format(numerator, denominator)
|
||
|
return numerator // denominator
|