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.24.0-cp38-cp38-manylinux2010_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

struct2tensor-0.24.0-cp38-cp38-macosx_10_9_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

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

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

struct2tensor-0.24.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.24.0-cp36-cp36m-manylinux2010_x86_64.whl (2.3 MB view details)

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

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

Uploaded CPython 3.6m macOS 10.9+ x86-64

File details

Details for the file struct2tensor-0.24.0-cp38-cp38-manylinux2010_x86_64.whl.

File metadata

  • Download URL: struct2tensor-0.24.0-cp38-cp38-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 2.3 MB
  • Tags: CPython 3.8, 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/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

File hashes

Hashes for struct2tensor-0.24.0-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 9551f1c025c847fe5779236d00ac2bed0736301656c14e0595c9db1267b17554
MD5 9f013cd0c5314bb39253aeef072d4374
BLAKE2b-256 4b55a370250fe1c07dd2bbc5c67897164274fc215c05441077d69370f0c040ab

See more details on using hashes here.

File details

Details for the file struct2tensor-0.24.0-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: struct2tensor-0.24.0-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: CPython 3.8, 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/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.2

File hashes

Hashes for struct2tensor-0.24.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1447d1b344a0087ce71c5030c7111c5c5d83bd8864365f3d407546225366a593
MD5 2f746afb62db60ca08474e34677631c4
BLAKE2b-256 971827db22510f639fa6d6ff645adca4401779cab722dd54ccecd380948f0a02

See more details on using hashes here.

File details

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

File metadata

  • Download URL: struct2tensor-0.24.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/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.6

File hashes

Hashes for struct2tensor-0.24.0-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 845d0c42c466e4221c4fb4571701fd860413afc4c2fe69f19dfc4136a4aef6ed
MD5 6e58d9677c70bd4fbd3b9b9444e343b1
BLAKE2b-256 35f8ad622e346434616e7de04cb76499d2fcd7f219d28e75eee4f324ebe43e46

See more details on using hashes here.

File details

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

File metadata

  • Download URL: struct2tensor-0.24.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.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.3

File hashes

Hashes for struct2tensor-0.24.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 52747621f0e48427b1045f78f06ec5683dcf811498f0867723fedb13061bd666
MD5 6bd9032f1dc877f59368bea1d697a834
BLAKE2b-256 e7cc7908b931c0291bbb89067e8a16d551f48b6e7c1997c4da5889010adcb72c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: struct2tensor-0.24.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/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.10

File hashes

Hashes for struct2tensor-0.24.0-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 5807a8d142d69955529c2fc16f5ea49346ba9f2f05bb8705f58be2bc31d74687
MD5 c974429fd2862fcfd19c09045629da44
BLAKE2b-256 a2030694cd59579d73434c8f5e135e93e3a88ef5a982053cf8596e641833f0f0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: struct2tensor-0.24.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.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.8

File hashes

Hashes for struct2tensor-0.24.0-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0fc76e284a294bd5238fc1f1e885388681ec7e6c58280cc90a212becd5f28812
MD5 0918840357439c45ea849d27185acb0c
BLAKE2b-256 1c785066d8c57e7bca9c0158e9adc2790fa714df68f0d75a2577b02122f9e431

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