Skip to content

tensortask/ttp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoDoc Go Report Card Keybase Chat

Tensor Transport Protocol (TTP)

A minimalist yet exstensible protocol for transporting tensors.

The goal of the Tensor Transport Protocol (TTP) is to create a standard minimum that enables basic conversion between tensor handling protocols. TTP facilitates transporting tensors over the wire without framework lock-in. Metadata string[byte] maps allow users to add application specific metadata (e.g. dimension labels and unique ID's).

TTP is inspired from the methods employed by TensorFlow Serving and distributed TensorFlow. TTP generalizes these concepts and adds support for different frameworks/use-cases.

Per Transport

  • Target (recepient and computation)
  • Map of Alias' and Tensors (alias -> tensor)
  • Metadata Map (name -> byte array)

Per Tensor

  • Data Type (data type of the given tensor)
  • Tensor Dimensions (dimensionality of the given tensor)
  • Tensor Contents (raw bytes using C-standard for packing a multidim array)
  • Metadata Map (name -> byte array)

gRPC Support

TTP is defined with protocol buffers which means they directly support gRPC. Simply import the TTP definitions within your service definition.

JSON Support

Protocol Buffers automatically maps to JSON and vice versa. Examples of standard and extended JSON tensors transports are on the way!

Compiling Protobuffers

If you haven't already, download and install the protobuf compiler (protoc). Add the binary to your path.

Run protoc with your language specific plugins.

Golang

TTP comes pre-packaged with Golang-specific optimizations. These optimizations depend on a 3rd party fork of Google's protoc-gen code which improves the quality of code generated by the protoc tool. A useful generator script has been made to simplify compilation even further. Install third-party dependencies and then run generate in the repo root.

# generate necessary code files
go get -u github.com/gogo/protobuf/protoc-gen-gogofaster
go generate ./...

or simply import github.com/tensortask/ttp/go.