-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optional bitlength when exporting + formatting (#74)
* make max_bitlen optional * formatting * separate methods for normal and limbs tensors * rename to `import_` and `export_` * update readme example, add it to examples/, rename old example Co-authored-by: jvmancuso <jason@manc.us>
- Loading branch information
1 parent
e74d1fd
commit ed7a611
Showing
15 changed files
with
828 additions
and
750 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ bazel* | |
**.pyc | ||
.mypy* | ||
__pycache__ | ||
**/*egg-info | ||
|
||
artifacts/* | ||
wheelhouse/* | ||
|
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
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,15 @@ | ||
import tensorflow as tf | ||
import tf_big | ||
|
||
# load large values as strings | ||
x = tf_big.constant([["100000000000000000000", "200000000000000000000"]]) | ||
|
||
# load ordinary TensorFlow tensors | ||
y = tf_big.import_tensor(tf.constant([[3, 4]])) | ||
|
||
# perform computation as usual | ||
z = x * y | ||
|
||
# export result back into a TensorFlow tensor | ||
tf_res = tf_big.export_tensor(z) | ||
print(tf_res) |
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,11 @@ | ||
[tool:isort] | ||
line_length=88 | ||
force_single_line=True | ||
|
||
[flake8] | ||
max-line-length=88 | ||
extend-ignore= | ||
E203 # okay: black | ||
T484 # TODO: should not be ignored | ||
T499 # TODO: status only? | ||
D10,D20,D40 # TODO |
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 |
---|---|---|
@@ -1,41 +1,37 @@ | ||
from tf_big.python.tensor import set_secure_default | ||
from tf_big.python.tensor import get_secure_default | ||
|
||
from tf_big.python.tensor import Tensor | ||
|
||
from tf_big.python.tensor import constant | ||
from tf_big.python.tensor import convert_from_tensor | ||
from tf_big.python.tensor import convert_to_tensor | ||
|
||
from tf_big.python.tensor import random_uniform | ||
from tf_big.python.tensor import random_rsa_modulus | ||
|
||
from tf_big.python.tensor import add | ||
from tf_big.python.tensor import sub | ||
from tf_big.python.tensor import mul | ||
from tf_big.python.tensor import pow | ||
from tf_big.python.tensor import constant | ||
from tf_big.python.tensor import export_limbs_tensor | ||
from tf_big.python.tensor import export_tensor | ||
from tf_big.python.tensor import get_secure_default | ||
from tf_big.python.tensor import import_limbs_tensor | ||
from tf_big.python.tensor import import_tensor | ||
from tf_big.python.tensor import inv | ||
from tf_big.python.tensor import matmul | ||
from tf_big.python.tensor import mod | ||
from tf_big.python.tensor import inv | ||
from tf_big.python.tensor import mul | ||
from tf_big.python.tensor import pow | ||
from tf_big.python.tensor import random_rsa_modulus | ||
from tf_big.python.tensor import random_uniform | ||
from tf_big.python.tensor import set_secure_default | ||
from tf_big.python.tensor import sub | ||
|
||
__all__ = [ | ||
'set_secure_default', | ||
'get_secure_default', | ||
|
||
'Tensor', | ||
|
||
'constant', | ||
'convert_from_tensor', | ||
'convert_to_tensor', | ||
|
||
'random_uniform', | ||
'randon_rsa_modulus', | ||
|
||
'add', | ||
'sub', | ||
'mul', | ||
'pow', | ||
'matmul', | ||
'mod', | ||
'inv', | ||
"set_secure_default", | ||
"get_secure_default", | ||
"Tensor", | ||
"constant", | ||
"export_limbs_tensor", | ||
"export_tensor", | ||
"import_limbs_tensor", | ||
"import_tensor", | ||
"random_uniform", | ||
"randon_rsa_modulus", | ||
"add", | ||
"sub", | ||
"mul", | ||
"pow", | ||
"matmul", | ||
"mod", | ||
"inv", | ||
] |
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
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.