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

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

struct2tensor-0.21.0-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.0-cp36-cp36m-manylinux2010_x86_64.whl (4.9 MB view details)

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

struct2tensor-0.21.0-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.0-cp35-cp35m-manylinux2010_x86_64.whl (4.9 MB view details)

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

struct2tensor-0.21.0-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.0-cp37-cp37m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: struct2tensor-0.21.0-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.0-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 41390a94680340b2ebd82306200de50a114b7b7d7978c2c68a5f73d637001201
MD5 13d355a9518574f130a2342b09408f00
BLAKE2b-256 94e842155513f1c3a4bcc8028702c868a94c30e1650f52a6a9294d46efdecd2f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: struct2tensor-0.21.0-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.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c2eb2bd84d2c777b629d37400bb9f22c609daa5e6e92b78c12d9335be0ddab66
MD5 234bfbb5791eade551d2a935ca7cd87e
BLAKE2b-256 4d37cc2ed8b6e3a2647a4c58bc62fcf2353efc400997d26368dc9ddc0789cfd0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: struct2tensor-0.21.0-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.0-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 e499d37e327de858227d31e8ea89c1be98cad2f8c6d4765933a2dd4685e3b46a
MD5 c7b18740cb70f2051bd2d435f47176f3
BLAKE2b-256 3bcf5b96f87cac4e41d0359bda4656c7ac423695567989fd66b58f6b58118ece

See more details on using hashes here.

File details

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

File metadata

  • Download URL: struct2tensor-0.21.0-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.0-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 82afb7b13d522dc4661375f7f4dc5ca8f712800fe586712b6306af52589fce7f
MD5 acf5f1841e3a000271d398fb0c3f3e77
BLAKE2b-256 cab023d303118622d867fd8ac8e45fcfd4d569978e924df98d0795f9c938989a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: struct2tensor-0.21.0-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.0-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 6f555c4263693c54514e0bf162843d52b7f7ca655d931c41fb706235ba1ff9e5
MD5 c0076ab5f3f6423b05a35f0a84a43e84
BLAKE2b-256 ce7a64486cefb0cc65dbc8c2051ed82d033b36f56289986c067ce650490788e8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: struct2tensor-0.21.0-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.0-cp35-cp35m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 f97a2da9c161600fc9996068a0b6df5aa210e82133ef47548828fe0652ac5f29
MD5 ff217115404d25345e5b3923eb57b86d
BLAKE2b-256 00ab85e402d36df8a5afb7cab11c7f2d75df3e599845884e250a7b23c16a7a08

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