mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-09 20:25:34 -05:00
feat(compiler): Python bindings (#53)
- feat(compiler): python bindings - build: update docker image for python bindings - pin pybind11 to 2.6.2, 2.7 is not having correct include_dirs set (still a question why?) - using generated parser/printer
This commit is contained in:
25
compiler/test_python.py
Executable file
25
compiler/test_python.py
Executable file
@@ -0,0 +1,25 @@
|
||||
import zamalang
|
||||
import zamalang.dialects.hlfhe as hlfhe
|
||||
import mlir.dialects.builtin as builtin
|
||||
import mlir.dialects.std as std
|
||||
from mlir.ir import *
|
||||
|
||||
|
||||
def main():
|
||||
with Context() as ctx, Location.unknown():
|
||||
# register zamalang's dialects
|
||||
zamalang.register_dialects(ctx)
|
||||
|
||||
module = Module.create()
|
||||
eint16 = hlfhe.EncryptedIntegerType.get(ctx, 16)
|
||||
with InsertionPoint(module.body):
|
||||
func_types = [RankedTensorType.get((10, 10), eint16) for _ in range(2)]
|
||||
@builtin.FuncOp.from_py_func(*func_types)
|
||||
def fhe_circuit(*arg):
|
||||
return arg[0]
|
||||
|
||||
print(module)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user