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 tensorflow 2.x.

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=RELEASED_TF_2 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=RELEASED_TF_2 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.22.0 2.2.0
0.21.1 2.1.0
0.21.0 2.1.0
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.23.0-cp37-cp37m-manylinux2010_x86_64.whl (2.3 MB view details)

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

struct2tensor-0.23.0-cp37-cp37m-macosx_10_9_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

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

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

struct2tensor-0.23.0-cp36-cp36m-macosx_10_9_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.6m macOS 10.9+ x86-64

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

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

struct2tensor-0.23.0-cp35-cp35m-macosx_10_14_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.5m macOS 10.14+ x86-64

File details

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

File metadata

  • Download URL: struct2tensor-0.23.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.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.6

File hashes

Hashes for struct2tensor-0.23.0-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 febfa7b7da2bca550176745b16cb65b6c6d684c27c3d35d953720b62cdfcb95c
MD5 40b7f68c4d1a15044930b6f9f68be95f
BLAKE2b-256 bb88e640c6828cc2e26e8ea424e1ac811daf90b43d5c4a60ff0101f2eead2b23

See more details on using hashes here.

File details

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

File metadata

  • Download URL: struct2tensor-0.23.0-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.3

File hashes

Hashes for struct2tensor-0.23.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 882217e75dcf6399c318da487203dd65a7c672de6ccc61b076a9832ccaf88d24
MD5 848d4b08a12df57a1023c3d005cf584a
BLAKE2b-256 941f984a168284643645f134ee4b17537195ea6afdde7d3e89a9448da3c9da64

See more details on using hashes here.

File details

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

File metadata

  • Download URL: struct2tensor-0.23.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.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.10

File hashes

Hashes for struct2tensor-0.23.0-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 ee5684421b684de1774deab4be4c1738f49ba73c54c9c1b45d08de7bf6c40f4b
MD5 64d4a110760fb2c0eb9e4de98e1da871
BLAKE2b-256 936db456aaa3b2481a4bb12f29ec3c47dda4b941f6d7edc7d2c070914bd260be

See more details on using hashes here.

File details

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

File metadata

  • Download URL: struct2tensor-0.23.0-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: CPython 3.6m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.8

File hashes

Hashes for struct2tensor-0.23.0-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d54816c90d6d1dd17219ccd0ccea53d3056c025ea76d299b40210aeea3c1346d
MD5 ca8280d494ad7f7d2aa049af2448e3b1
BLAKE2b-256 d19d51cbee74e230b81ce140cda28ea7f2e9e968ba96ef053f9931152b1b0b68

See more details on using hashes here.

File details

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

File metadata

  • Download URL: struct2tensor-0.23.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/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.5.9

File hashes

Hashes for struct2tensor-0.23.0-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 e894a6ac6e531f494d9eee8fd4f5187364f9ffcdeb11e65166de445071dd4ab0
MD5 5625e1a6c2a25f8e99b39929abc92eea
BLAKE2b-256 f91815940984d965c7c62685fc7a9ecc0d7f8ffd47f8601f9ecdde84a41921e7

See more details on using hashes here.

File details

Details for the file struct2tensor-0.23.0-cp35-cp35m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: struct2tensor-0.23.0-cp35-cp35m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: CPython 3.5m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.5.9

File hashes

Hashes for struct2tensor-0.23.0-cp35-cp35m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 a86cba2b67e8c218394c761afa1eb605ef2e260d6c3e939232293d4bb16653d4
MD5 d698537846aace702d857872156da188
BLAKE2b-256 4bd3cf2ac82bc3d0d686e2f804c9c1a7692e43cc475b31492bdbe1220ac68de7

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