-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[type] Support exponents in CustomFloatType (#2122)
- Loading branch information
1 parent
0f81998
commit f1768ca
Showing
18 changed files
with
415 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
class TypeFactory: | ||
def __init__(self): | ||
from taichi.core import ti_core | ||
self.core = ti_core.get_type_factory_instance() | ||
|
||
def custom_int(self, bits, signed=True): | ||
return self.core.get_custom_int_type(bits, signed) | ||
|
||
def custom_float(self, | ||
significand_type, | ||
exponent_type=None, | ||
compute_type=None, | ||
scale=1.0): | ||
import taichi as ti | ||
if compute_type is None: | ||
compute_type = ti.get_runtime().default_fp.get_ptr() | ||
return self.core.get_custom_float_type(significand_type, | ||
exponent_type, | ||
compute_type, | ||
scale=scale) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.