Skip to main content

Struct2Tensor is a package for parsing and manipulating structured data for TensorFlow

Project description

Struct2Tensor

Python PyPI

Introduction

struct2tensor is a library for parsing structured data inside of tensorflow. In particular, it makes it easy to manipulate structured data, e.g., slicing, flattening, copying substructures, and so on, as part of a TensorFlow model graph. The notebook in 'examples/prensor_playground.ipynb' provides a few examples of struct2tensor in action and an introduction to the main concepts. You can run the notebook in your browser through Google's colab environment, or download the file to run it in your own Jupyter environment.

There are two main use cases of this repo:

  1. To create a PIP package. The PIP package contains plug-ins (OpKernels) to an existing tensorflow installation.
  2. To staticlly link with tensorflow-serving.

As these processes are independent, one can follow either set of directions below.

Use a pre-built Linux PIP package.

From a virtual environment, run:

pip install struct2tensor

Creating a PIP package.

The struct2tensor PIP package is useful for creating models. It works with either tensorflow 2.0 or tensorflow 1.15.0.

In order to unify the process, we recommend compiling struct2tensor inside a docker container.

Downloading the Code

Go to your home directory.

Download the source code.

git clone https://github.com/google/struct2tensor.git
cd ~/struct2tensor

Use docker-compose

Install docker-compose.

Use it to build a pip wheel for Python 3.6 with tensorflow version 2:

docker-compose build manylinux2010
docker-compose run -e PYTHON_VERSION=36 -e TF_VERSION=NIGHTLY_TF manylinux2010

Or build a pip wheel for Python 3.7 with tensorflow version 2 (note that if you run one of these docker-compose commands after the other, the second will erase the result from the first):

docker-compose build manylinux2010
docker-compose run -e PYTHON_VERSION=37 -e TF_VERSION=NIGHTLY_TF manylinux2010

This will create a manylinux package in the ~/struct2tensor/dist directory.

Creating a static library.

In order to construct a static library for tensorflow-serving, we run:

bazel build -c opt struct2tensor:prensor_kernels_and_ops

This can also be linked into another library.

Compatibility

struct2tensor tensorflow
0.0.1.dev* 1.15

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

struct2tensor-0.22.0-cp37-cp37m-manylinux2010_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

struct2tensor-0.22.0-cp37-cp37m-macosx_10_9_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

struct2tensor-0.22.0-cp36-cp36m-manylinux2010_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

struct2tensor-0.22.0-cp36-cp36m-macosx_10_9_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.6m macOS 10.9+ x86-64

struct2tensor-0.22.0-cp35-cp35m-manylinux2010_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.5m manylinux: glibc 2.12+ x86-64

struct2tensor-0.22.0-cp35-cp35m-macosx_10_6_intel.whl (1.8 MB view details)

Uploaded CPython 3.5m macOS 10.6+ intel

File details

Details for the file struct2tensor-0.22.0-cp37-cp37m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: struct2tensor-0.22.0-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 2.3 MB
  • Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

File hashes

Hashes for struct2tensor-0.22.0-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 f618b9e3eedb04060e72ed22f5c5f8e8042887a586ebec671b1f5266c95cf708
MD5 18cd70f6c3780ea968487c0816cfee2c
BLAKE2b-256 6fc5756feff2a25704d5c74f15746a78420c871d35d0b8872860ec9399779234

See more details on using hashes here.

File details

Details for the file struct2tensor-0.22.0-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: struct2tensor-0.22.0-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

File hashes

Hashes for struct2tensor-0.22.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 27c50a1a8243dcb3232e92aedb5f9dedfe270a33f727f21c4b70f685a36de2d3
MD5 11fda7c127820e9a60f1ba1b0c02f4ea
BLAKE2b-256 a7ee35901243cf93b8f1261e229b9a4b166d111abc60a8ffda9de55136d1557f

See more details on using hashes here.

File details

Details for the file struct2tensor-0.22.0-cp36-cp36m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: struct2tensor-0.22.0-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 2.3 MB
  • Tags: CPython 3.6m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

File hashes

Hashes for struct2tensor-0.22.0-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 10fb2f93a0ef23802398e423d5203eb94fac8773146d05b5b9b939937d681521
MD5 0b97497935499fa95e77c74ea7703b5c
BLAKE2b-256 1507d76737d287e69e26c8d99b82c733060b519fc197fa8e0162ff31e51a33c1

See more details on using hashes here.

File details

Details for the file struct2tensor-0.22.0-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: struct2tensor-0.22.0-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: CPython 3.6m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

File hashes

Hashes for struct2tensor-0.22.0-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8dd167b15e85ed0302ecc453416ff3a149fc77924ddf559384b649635eaf047b
MD5 953b1d32d17e6fef3a86243dae376a15
BLAKE2b-256 b9313da96ec08bf2288630740007fc667f6a41c3c866998e1a620138fc7f6c96

See more details on using hashes here.

File details

Details for the file struct2tensor-0.22.0-cp35-cp35m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: struct2tensor-0.22.0-cp35-cp35m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 2.3 MB
  • Tags: CPython 3.5m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

File hashes

Hashes for struct2tensor-0.22.0-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 489eeff2ab8ecfd25ec420a25c3f216590cb2e1fa5a4c90279d727934ae96b6f
MD5 5eac3a4a4c316988796aa6d546d49776
BLAKE2b-256 d2517b2d7d4d1820e4079bfa0d19b8c9ce9b1911b12d76e437df79ed7489bc6b

See more details on using hashes here.

File details

Details for the file struct2tensor-0.22.0-cp35-cp35m-macosx_10_6_intel.whl.

File metadata

  • Download URL: struct2tensor-0.22.0-cp35-cp35m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: CPython 3.5m, macOS 10.6+ intel
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

File hashes

Hashes for struct2tensor-0.22.0-cp35-cp35m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 24961aaac5ecc33f7d9cbc1fb2476ce504b3734cd8f3fca4687ebafb5345bfb7
MD5 6410f306ac429b9d6546e94180ea00b1
BLAKE2b-256 948304890769bc617ae5fe77b5ac6b970cddd22a31eed8d518be192a0c9d5fb7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page