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.21.1-cp37-cp37m-manylinux2010_x86_64.whl (4.9 MB view details)

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

struct2tensor-0.21.1-cp37-cp37m-macosx_10_9_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

struct2tensor-0.21.1-cp36-cp36m-manylinux2010_x86_64.whl (4.9 MB view details)

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

struct2tensor-0.21.1-cp36-cp36m-macosx_10_9_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.6m macOS 10.9+ x86-64

struct2tensor-0.21.1-cp35-cp35m-manylinux2010_x86_64.whl (4.9 MB view details)

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

struct2tensor-0.21.1-cp35-cp35m-macosx_10_6_intel.whl (4.0 MB view details)

Uploaded CPython 3.5m macOS 10.6+ intel

File details

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

File metadata

  • Download URL: struct2tensor-0.21.1-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 4.9 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.6

File hashes

Hashes for struct2tensor-0.21.1-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 0af863b24ce11c5e5f2b125e1f6d38dd80829d712a2851648f2ad89760b0947e
MD5 b8947cfaad656a1bda33f5797cee52fb
BLAKE2b-256 f76a71199d3bcf2bed8ad17c0d22789efc4f44055db8e1710dcfd086d551fe24

See more details on using hashes here.

File details

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

File metadata

  • Download URL: struct2tensor-0.21.1-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 4.0 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.6

File hashes

Hashes for struct2tensor-0.21.1-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2c09d558fd16697497d88fda9d58cbcbd5f3f33427add5cd167f486f6eb8995e
MD5 e269a91bb43d844faa5e1f81bbdbfbf9
BLAKE2b-256 9e51a4b491277bc7cd2bec8ceb08963fa761eff6c4aa45d096149fb5b22237bd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: struct2tensor-0.21.1-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 4.9 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.6

File hashes

Hashes for struct2tensor-0.21.1-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 42982bb0980c8550a66b55c28024aa595ead5cbd1a7871bfd0ef653d9839ba8c
MD5 ef54324980c49167ab3aa0c87cec1ace
BLAKE2b-256 60db7c9e09df2a9c1919316759cdccab592c5c848b839da75a90562f7858a81d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: struct2tensor-0.21.1-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 4.0 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.6

File hashes

Hashes for struct2tensor-0.21.1-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7654ffb9ab9fa7c4f82318f57a3c3bbe22c9e81d402748c878d46ecff2c8fe1b
MD5 4a90c5adf3514fe28fdd23d85f9b7998
BLAKE2b-256 dc067e4760a96b416ebe96b40a6b44b77579892990f4eb1d5df5db447007cc53

See more details on using hashes here.

File details

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

File metadata

  • Download URL: struct2tensor-0.21.1-cp35-cp35m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 4.9 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.6

File hashes

Hashes for struct2tensor-0.21.1-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 5be94eb3ca19c40ccfb4f611aabddf03d19bc55d0783b2f56c37d9262111d769
MD5 5185b2dd0839298e3569dfda22fbec66
BLAKE2b-256 ba2d18dceeb139487a03fe3f452f165c04f3f4f142b7eecf8beb149656a8c418

See more details on using hashes here.

File details

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

File metadata

  • Download URL: struct2tensor-0.21.1-cp35-cp35m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 4.0 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.6

File hashes

Hashes for struct2tensor-0.21.1-cp35-cp35m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 e2395dafb804e65c33eca613da6e98d0fcde280b21c402ec4a1dcdf6207d1c13
MD5 9bddc8283e247805ddf37a191b198e48
BLAKE2b-256 2099df45d24074eec319d1623aa58db1bab5af29cfedf6aeea533ae8a51369bf

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