or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

config-persistence.mdcore-framework.mddata-examples.mddistributed-runtime.mdindex.mdutilities.md
tile.json

tessl/maven-org-tensorflow--proto

Generated Java code for TensorFlow protocol buffers, providing type-safe access to TensorFlow's structured data formats including MetaGraphDef, ConfigProto, and other core TensorFlow data structures.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
mavenpkg:maven/org.tensorflow/proto@1.15.x

To install, run

npx @tessl/cli install tessl/maven-org-tensorflow--proto@1.15.0

index.mddocs/

TensorFlow Proto

Generated Java code for TensorFlow protocol buffers, providing type-safe access to TensorFlow's structured data formats including MetaGraphDef, ConfigProto, and other core TensorFlow data structures. This package serves as a foundational dependency for TensorFlow Java API applications that need to serialize, deserialize, or manipulate TensorFlow protocol buffer messages.

Package Information

  • Package Name: org.tensorflow:proto
  • Package Type: maven
  • Language: Java
  • Installation: Add to your Maven pom.xml:
<dependency>
  <groupId>org.tensorflow</groupId>
  <artifactId>proto</artifactId>
  <version>1.15.0</version>
</dependency>

For Gradle:

implementation 'org.tensorflow:proto:1.15.0'

Core Imports

import org.tensorflow.framework.*;
import org.tensorflow.example.*;
import org.tensorflow.util.*;
import org.tensorflow.distruntime.*;
import com.google.protobuf.ByteString;

Common specific imports:

import org.tensorflow.framework.TensorProto;
import org.tensorflow.framework.GraphDef; 
import org.tensorflow.framework.NodeDef;
import org.tensorflow.framework.ConfigProto;
import org.tensorflow.framework.MetaGraphDef;
import org.tensorflow.framework.DataType;
import org.tensorflow.framework.TensorShapeProto;
import org.tensorflow.framework.AttrValue;
import org.tensorflow.example.Example;
import org.tensorflow.example.Feature;
import org.tensorflow.example.Features;
import org.tensorflow.example.FloatList;
import org.tensorflow.example.Int64List;
import org.tensorflow.example.BytesList;
import com.google.protobuf.ByteString;

Basic Usage

import org.tensorflow.framework.*;

// Create a tensor proto with float values
TensorProto tensor = TensorProto.newBuilder()
    .setDtype(DataType.DT_FLOAT)
    .setTensorShape(TensorShapeProto.newBuilder()
        .addDim(TensorShapeProto.Dim.newBuilder().setSize(3)))
    .addFloatVal(1.0f)
    .addFloatVal(2.0f) 
    .addFloatVal(3.0f)
    .build();

// Create a simple graph with one node
GraphDef graph = GraphDef.newBuilder()
    .addNode(NodeDef.newBuilder()
        .setName("input")
        .setOp("Placeholder")
        .putAttr("dtype", AttrValue.newBuilder()
            .setType(DataType.DT_FLOAT).build()))
    .build();

// Create training example
Example example = Example.newBuilder()
    .setFeatures(Features.newBuilder()
        .putFeature("height", Feature.newBuilder()
            .setFloatList(FloatList.newBuilder().addValue(175.5f))
            .build())
        .putFeature("weight", Feature.newBuilder()
            .setFloatList(FloatList.newBuilder().addValue(68.2f))
            .build()))
    .build();

Architecture

The TensorFlow Proto package is organized around several key areas:

  • Core Framework: Primary data structures for graphs, tensors, operations, and configurations (org.tensorflow.framework)
  • Data Examples: Normalized formats for training and inference data (org.tensorflow.example)
  • Distributed Runtime: Service interfaces and messages for distributed TensorFlow execution (org.tensorflow.distruntime)
  • Utilities: Event logging and other utility types (org.tensorflow.util)
  • Protocol Buffer Pattern: All classes follow the standard Protocol Buffer Java pattern with immutable message objects and mutable Builder classes

Capabilities

Core Framework Types

The fundamental data structures for TensorFlow graphs, tensors, operations, and session configuration. Essential for any application working with TensorFlow models or computation graphs.

class TensorProto {
  DataType getDtype();
  TensorShapeProto getTensorShape();
  ByteString getTensorContent();
  List<Float> getFloatValList();
  List<Integer> getIntValList();
  // ... other type-specific accessors
}

class GraphDef {
  List<NodeDef> getNodeList();
  VersionDef getVersions();
  FunctionDefLibrary getLibrary();
}

class NodeDef {
  String getName();
  String getOp();
  List<String> getInputList();
  String getDevice();
  Map<String, AttrValue> getAttrMap();
}

Core Framework

Data Examples and Features

Normalized data formats for representing training examples, feature vectors, and structured data inputs for machine learning models.

class Example {
  Features getFeatures();
}

class Feature {
  BytesList getBytesList();
  FloatList getFloatList();
  Int64List getInt64List();
  KindCase getKindCase();
}

class Features {
  Map<String, Feature> getFeatureMap();
}

Data Examples

Model Configuration and Persistence

Configuration objects and data structures for TensorFlow sessions, saved models, and model metadata management.

class ConfigProto {
  Map<String, Integer> getDeviceCountMap();
  int getIntraOpParallelismThreads();
  int getInterOpParallelismThreads();
  GPUOptions getGpuOptions();
  boolean getAllowSoftPlacement();
}

class MetaGraphDef {
  MetaInfoDef getMetaInfoDef();
  GraphDef getGraphDef();
  SaverDef getSaverDef();
  Map<String, CollectionDef> getCollectionDefMap();
  Map<String, SignatureDef> getSignatureDefMap();
}

class SavedModel {
  long getSavedModelSchemaVersion();
  List<MetaGraphDef> getMetaGraphsList();
}

Configuration and Persistence

Distributed Runtime Services

Service interfaces and message types for distributed TensorFlow execution across multiple devices and machines.

// Master Service Messages
class CreateSessionRequest {
  GraphDef getGraphDef();
  ConfigProto getConfig();
}

class RunStepRequest {
  String getSessionHandle();
  List<String> getFeedList();
  List<String> getFetchList();
}

// Worker Service Messages  
class RegisterGraphRequest {
  String getSessionHandle();
  GraphDef getGraphDef();
}

Distributed Runtime

Utility Types

Event logging, debugging, and other utility data structures for TensorFlow operations monitoring and analysis.

class Event {
  double getWallTime();
  long getStep();
  String getFileVersion();
  ByteString getGraphDef();
  Summary getSummary();
  WhatCase getWhatCase();
}

Utilities

Common Types

DataType Enum

enum DataType {
  DT_INVALID(0),
  DT_FLOAT(1),      // 32-bit float
  DT_DOUBLE(2),     // 64-bit double
  DT_INT32(3),      // 32-bit integer
  DT_UINT8(4),      // Unsigned 8-bit integer
  DT_INT16(5),      // 16-bit integer
  DT_INT8(6),       // 8-bit integer
  DT_STRING(7),     // String
  DT_COMPLEX64(8),  // Single-precision complex
  DT_INT64(9),      // 64-bit integer
  DT_BOOL(10),      // Boolean
  DT_QINT8(11),     // Quantized 8-bit integer
  DT_QUINT8(12),    // Quantized unsigned 8-bit
  DT_QINT32(13),    // Quantized 32-bit integer
  DT_BFLOAT16(14),  // Brain floating point 16-bit
  DT_QINT16(15),    // Quantized 16-bit integer
  DT_QUINT16(16),   // Quantized unsigned 16-bit
  DT_UINT16(17),    // Unsigned 16-bit integer
  DT_COMPLEX128(18), // Double-precision complex
  DT_HALF(19),      // 16-bit float
  DT_RESOURCE(20),  // Resource handle
  DT_VARIANT(21),   // Arbitrary C++ data types
  DT_UINT32(22),    // Unsigned 32-bit integer
  DT_UINT64(23),    // Unsigned 64-bit integer
  
  // Reference types (for parameters)
  DT_FLOAT_REF(101),
  DT_DOUBLE_REF(102),
  DT_INT32_REF(103),
  DT_UINT8_REF(104),
  DT_INT16_REF(105),
  DT_INT8_REF(106),
  DT_STRING_REF(107),
  DT_COMPLEX64_REF(108),
  DT_INT64_REF(109),
  DT_BOOL_REF(110),
  DT_QINT8_REF(111),
  DT_QUINT8_REF(112),
  DT_QINT32_REF(113),
  DT_BFLOAT16_REF(114),
  DT_QINT16_REF(115),
  DT_QUINT16_REF(116),
  DT_UINT16_REF(117),
  DT_COMPLEX128_REF(118),
  DT_HALF_REF(119),
  DT_RESOURCE_REF(120),
  DT_VARIANT_REF(121),
  DT_UINT32_REF(122),
  DT_UINT64_REF(123);
}

AttrValue

class AttrValue {
  ByteString getS();           // String value
  long getI();                 // Integer value
  float getF();                // Float value
  boolean getB();              // Boolean value
  DataType getType();          // Type value
  TensorShapeProto getShape(); // Shape value
  TensorProto getTensor();     // Tensor value
  ListValue getList();         // List value
  ValueCase getValueCase();    // Which value is set
}

TensorShapeProto

class TensorShapeProto {
  List<Dim> getDimList();
  boolean getUnknownRank();
  
  static class Dim {
    long getSize();
    String getName();
  }
}