{"id":18519980,"url":"https://github.com/tf-encrypted/tf-big","last_synced_at":"2025-04-09T09:32:32.456Z","repository":{"id":34999567,"uuid":"191934936","full_name":"tf-encrypted/tf-big","owner":"tf-encrypted","description":"Arbitrary precision integers in TensorFlow","archived":false,"fork":false,"pushed_at":"2022-12-27T15:36:40.000Z","size":126,"stargazers_count":11,"open_issues_count":18,"forks_count":1,"subscribers_count":16,"default_branch":"master","last_synced_at":"2024-04-29T09:01:15.276Z","etag":null,"topics":["cryptography","machine-learning","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tf-encrypted.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-14T11:53:07.000Z","updated_at":"2024-02-04T17:22:52.000Z","dependencies_parsed_at":"2023-01-15T11:46:11.247Z","dependency_job_id":null,"html_url":"https://github.com/tf-encrypted/tf-big","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tf-encrypted%2Ftf-big","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tf-encrypted%2Ftf-big/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tf-encrypted%2Ftf-big/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tf-encrypted%2Ftf-big/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tf-encrypted","download_url":"https://codeload.github.com/tf-encrypted/tf-big/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248012585,"owners_count":21033225,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cryptography","machine-learning","tensorflow"],"created_at":"2024-11-06T17:18:09.808Z","updated_at":"2025-04-09T09:32:32.184Z","avatar_url":"https://github.com/tf-encrypted.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TF Big\n\nTF Big adds big number support to TensorFlow, allowing computations to be performed on arbitrary precision integers. Internally these are represented as variant tensors of [GMP](https://gmplib.org/) values, and exposed in Python through the `tf_big.Tensor` wrapper for convenience. For importing and exporting, numbers are typically expressed as strings.\n\n[![PyPI](https://img.shields.io/pypi/v/tf-big.svg)](https://pypi.org/project/tf-big/) [![CircleCI Badge](https://circleci.com/gh/tf-encrypted/tf-big/tree/master.svg?style=svg)](https://circleci.com/gh/tf-encrypted/tf-big/tree/master)\n\n## Usage\n\n```python\nimport tensorflow as tf\nimport tf_big\n\n# load large values as strings\nx = tf_big.constant([[\"100000000000000000000\", \"200000000000000000000\"]])\n\n# load ordinary TensorFlow tensors\ny = tf_big.import_tensor(tf.constant([[3, 4]]))\n\n# perform computation as usual\nz = x * y\n\n# export result back into a TensorFlow tensor\ntf_res = tf_big.export_tensor(z)\nprint(tf_res)\n```\n\n## Installation\n\nPython 3 packages are available from [PyPI](https://pypi.org/project/tf-big/):\n\n```\npip install tf-big\n```\n\nSee below for further instructions for setting up a development environment.\n\n## Development\n\n### Requirements\n\nWe recommend using [Miniconda](https://docs.conda.io/en/latest/miniconda.html) or [Anaconda](https://www.anaconda.com/distribution/) to set up and use a Python 3.5 or 3.6 environment for all instructions below:\n\n```\nconda create -n tfbig-dev python=3.6\nsource activate tfbig-dev\n```\n\n#### Ubuntu\n\nThe only requirement for Ubuntu is to have [docker installed](https://docs.docker.com/install/linux/docker-ce/ubuntu/). This is the recommended way to [build custom operations for TensorFlow](https://github.com/tensorflow/custom-op). We provide a custom development container for TF Big with all dependencies already installed.\n\n#### macOS\n\nSetting up a development environment on macOS is a little more involved since we cannot use a docker container. We need four things:\n\n- Python (\u003e= 3.5)\n- [Bazel](https://www.bazel.build/) (\u003e= 0.15.0)\n- [GMP](https://gmplib.org/) (\u003e= 6.1.2)\n- [TensorFlow](https://www.tensorflow.org/) (see setup.py for version requirements for your TF Big version)\n\nUsing [Homebrew](https://brew.sh/) we first make sure that both [Bazel](https://docs.bazel.build/versions/master/install-os-x.html#install-with-installer-mac-os-x) and GMP are installed. We recommend using a Bazel version earlier than 1.0.0, e.g.:\n\n```\nbrew tap bazelbuild/tap\nbrew extract bazel bazelbuild/tap --version 0.26.1\nbrew install gmp\nbrew install mmv\n```\n\nThe remaining PyPI packages can then be installed using:\n\n```\npip install -r requirements-dev.txt\n```\n\n### Testing\n\n#### Ubuntu\n\nRun the tests on Ubuntu by running the `make test` command inside of a docker container. Right now, the docker container doesn't exist on docker hub yet so we must first build it:\n\n```\ndocker build -t tf-encrypted/tf-big:build .\n```\n\nThen we can run `make test`:\n\n```\nsudo docker run -it \\\n  -v `pwd`:/opt/my-project -w /opt/my-project \\\n  tf-encrypted/tf-big:0.1.0 /bin/bash -c \"make test\"\n```\n\n#### macOS\n\nOnce the development environment is set up we can simply run:\n\n```\nmake test\n```\n\nThis will install TensorFlow if not previously installed and build and run the tests.\n\n### Building pip package\n\nJust run:\n\n```\nmake build \u0026\u0026 make bundle\n```\n\nFor linux, doing it inside the tensorflow/tensorflow:custom-op container is recommended. Note that [CircleCI](#circle-ci) is currently used to build the official pip packages.\n\n## Circle CI\n\nWe use [Circle CI](https://circleci.com/gh/tf-encrypted/workflows/tf-big) for integration testing and deployment of TF Big.\n\n### Releasing\n\n1. update version number in setup.py and push to master; this will build and tests wheels\n2. iterate 1. until happy with the release, having potentially tested the wheel manually\n3. when happy, tag a commit with semver label and push; this will build, test, and deploy wheels\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftf-encrypted%2Ftf-big","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftf-encrypted%2Ftf-big","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftf-encrypted%2Ftf-big/lists"}