Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ The following describes the layout of the repository and its different artifacts
* High-level APIs built on top of the core libraries to simplify neural network training and inference
using TensorFlow.

* `tensorflow-tools`
* Utility libraries that do not depend on the TensorFlow runtime but are useful for machine learning purposes.
* `ndarray`
* Generic utility library for n-dimensional data I/O operations. It is used by TensorFlow without depending
on it, making its usage eligible to any type of projects, using TensorFlow or not.

## Building Sources

Expand Down Expand Up @@ -71,12 +72,12 @@ systems, you should add the following dependencies:
<dependency>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-core-api</artifactId>
<version>0.1.0-SNAPSHOT</version>
<version>0.2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-core-api</artifactId>
<version>0.1.0-SNAPSHOT</version>
<version>0.2.0-SNAPSHOT</version>
<classifier>linux-x86_64${javacpp.platform.extension}</classifier>
</dependency>
```
Expand All @@ -87,24 +88,24 @@ native dependencies as follows:
<dependency>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-core-api</artifactId>
<version>0.1.0-SNAPSHOT</version>
<version>0.2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-core-api</artifactId>
<version>0.1.0-SNAPSHOT</version>
<version>0.2.0-SNAPSHOT</version>
<classifier>linux-x86_64${javacpp.platform.extension}</classifier>
</dependency>
<dependency>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-core-api</artifactId>
<version>0.1.0-SNAPSHOT</version>
<version>0.2.0-SNAPSHOT</version>
<classifier>macosx-x86_64${javacpp.platform.extension}</classifier>
</dependency>
<dependency>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-core-api</artifactId>
<version>0.1.0-SNAPSHOT</version>
<version>0.2.0-SNAPSHOT</version>
<classifier>windows-x86_64${javacpp.platform.extension}</classifier>
</dependency>
```
Expand All @@ -117,7 +118,7 @@ artifact includes transitively all the artifacts above as a single dependency:
<dependency>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-core-platform${javacpp.platform.extension}</artifactId>
<version>0.1.0-SNAPSHOT</version>
<version>0.2.0-SNAPSHOT</version>
</dependency>
```

Expand Down Expand Up @@ -147,7 +148,7 @@ to add Sonatype OSS repository in your pom.xml, like the following
<dependency>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-core-platform</artifactId>
<version>0.1.0-SNAPSHOT</version>
<version>0.2.0-SNAPSHOT</version>
</dependency>
</dependencies>
```
Expand All @@ -159,6 +160,7 @@ This table shows the mapping between different version of TensorFlow for Java an
| TensorFlow Java Version | TensorFlow Version |
| ------------- | ------------- |
| 0.1.0-SNAPSHOT | 2.2.0 |
| 0.2.0-SNAPSHOT | 2.2.0 |

## How to Contribute?

Expand Down
14 changes: 7 additions & 7 deletions tensorflow-tools/README.md → ndarray/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# TensorFlow Tools
# TensorFlow NdArray

## Introduction

TensorFlow Tools is a utility library used by TensorFlow to accomplish tasks that are not easily
TensorFlow NdArray is a utility library used by TensorFlow to accomplish tasks that are not easily
achievable using a standard JDK. As opposed to other artifacts in this repository, this library does
not depend on TensorFlow runtime itself and can be imported by any other projects running on a JVM
that wants to make use of those tools. For example, an instance of `NdArray` could easily be passed
from one library to another for sharing data.

To import TensorFlow Tools in your project, simply add the following dependency:
To import TensorFlow NdArray in your project, simply add the following dependency:
```xml
<dependency>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-tools</artifactId>
<version>0.1.0-SNAPSHOT</version>
<artifactId>ndarray</artifactId>
<version>0.2.0-SNAPSHOT</version>
</dependency>
```

Expand Down Expand Up @@ -91,7 +91,7 @@ assertEquals(3, slice.getInt(1, 0)); // (1, 1, 0) in the original matrix

## Integration with TensorFlow

TensorFlow tools are independent of the TensorFlow runtime library, making it a good choice for
TensorFlow NdArray library is independent of the TensorFlow runtime library, making it a good choice for
manipulating multi-dimensional data structures from anywhere. As an example, here
is how it is actually done by the [TensorFlow Core API](https://github.com/tensorflow/java/tree/master/tensorflow-core/tensorflow-core-api):

Expand Down Expand Up @@ -121,4 +121,4 @@ try (EagerSession session = EagerSession.create()) {
assertEquals(-1, scalar.getInt())
);
}
```
```
12 changes: 6 additions & 6 deletions tensorflow-tools/pom.xml → ndarray/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@
<parent>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-java</artifactId>
<version>0.1.0-SNAPSHOT</version>
<version>0.2.0-SNAPSHOT</version>
</parent>
<artifactId>tensorflow-tools</artifactId>
<artifactId>ndarray</artifactId>
<packaging>jar</packaging>

<name>TensorFlow Tools Library</name>
<name>TensorFlow NdArray Library</name>
<description>
Utility library used by TensorFlow Java language bindings. This library does not depend on
the TensorFlow runtime and therefore can be included by any other projects outside the TensorFlow
organization.
Utility library used by TensorFlow Java for n-dimensional data I/O operations. This library does
not depend on the TensorFlow runtime and therefore can be included by any other projects outside
the TensorFlow organization.
</description>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
limitations under the License.
=======================================================================
*/
package org.tensorflow.tools.ndarray;
package org.tensorflow.ndarray;

import org.tensorflow.tools.buffer.BooleanDataBuffer;
import org.tensorflow.tools.buffer.DataBuffer;
import org.tensorflow.tools.ndarray.index.Index;
import org.tensorflow.ndarray.buffer.BooleanDataBuffer;
import org.tensorflow.ndarray.buffer.DataBuffer;
import org.tensorflow.ndarray.index.Index;

/**
* An {@link NdArray} of booleans.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
limitations under the License.
=======================================================================
*/
package org.tensorflow.tools.ndarray;
package org.tensorflow.ndarray;

import org.tensorflow.tools.buffer.ByteDataBuffer;
import org.tensorflow.tools.buffer.DataBuffer;
import org.tensorflow.tools.ndarray.index.Index;
import org.tensorflow.ndarray.buffer.ByteDataBuffer;
import org.tensorflow.ndarray.buffer.DataBuffer;
import org.tensorflow.ndarray.index.Index;

/**
* An {@link NdArray} of bytes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
limitations under the License.
=======================================================================
*/
package org.tensorflow.tools.ndarray;
package org.tensorflow.ndarray;

import org.tensorflow.tools.buffer.DataBuffer;
import org.tensorflow.tools.buffer.DoubleDataBuffer;
import org.tensorflow.tools.ndarray.index.Index;
import org.tensorflow.ndarray.buffer.DataBuffer;
import org.tensorflow.ndarray.buffer.DoubleDataBuffer;
import org.tensorflow.ndarray.index.Index;

/**
* An {@link NdArray} of doubles.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
limitations under the License.
=======================================================================
*/
package org.tensorflow.tools.ndarray;
package org.tensorflow.ndarray;

import org.tensorflow.tools.buffer.DataBuffer;
import org.tensorflow.tools.buffer.FloatDataBuffer;
import org.tensorflow.tools.ndarray.index.Index;
import org.tensorflow.ndarray.buffer.DataBuffer;
import org.tensorflow.ndarray.buffer.FloatDataBuffer;
import org.tensorflow.ndarray.index.Index;

/**
* An {@link NdArray} of floats.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
=======================================================================
*/
package org.tensorflow.tools.ndarray;
package org.tensorflow.ndarray;

/**
* Exception thrown when an operation cannot be completed because of the rank of the targeted array.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
limitations under the License.
=======================================================================
*/
package org.tensorflow.tools.ndarray;
package org.tensorflow.ndarray;

import org.tensorflow.tools.buffer.DataBuffer;
import org.tensorflow.tools.buffer.IntDataBuffer;
import org.tensorflow.tools.ndarray.index.Index;
import org.tensorflow.ndarray.buffer.DataBuffer;
import org.tensorflow.ndarray.buffer.IntDataBuffer;
import org.tensorflow.ndarray.index.Index;

/**
* An {@link NdArray} of integers.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
limitations under the License.
=======================================================================
*/
package org.tensorflow.tools.ndarray;
package org.tensorflow.ndarray;

import org.tensorflow.tools.buffer.DataBuffer;
import org.tensorflow.tools.buffer.LongDataBuffer;
import org.tensorflow.tools.ndarray.index.Index;
import org.tensorflow.ndarray.buffer.DataBuffer;
import org.tensorflow.ndarray.buffer.LongDataBuffer;
import org.tensorflow.ndarray.index.Index;

/**
* An {@link NdArray} of longs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@
limitations under the License.
=======================================================================
*/
package org.tensorflow.tools.ndarray;
package org.tensorflow.ndarray;

import java.util.function.BiConsumer;
import java.util.function.Consumer;
import org.tensorflow.tools.Shape;
import org.tensorflow.tools.buffer.DataBuffer;
import org.tensorflow.tools.ndarray.index.Index;
import org.tensorflow.ndarray.buffer.DataBuffer;
import org.tensorflow.ndarray.index.Index;

/**
* A data structure of N-dimensions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
* =======================================================================
*/

package org.tensorflow.tools.ndarray;
package org.tensorflow.ndarray;

import java.util.function.BiConsumer;
import org.tensorflow.ndarray.buffer.DataBufferWindow;

/**
* A sequence of elements of an N-dimensional array.
Expand Down Expand Up @@ -48,7 +49,7 @@ public interface NdArraySequence<T extends NdArray<?>> extends Iterable<T> {
*
* <p>Unlike conventional Java collections, elements of a {@code NdArraySequence} are transient, i.e. new {@code NdArray}
* instances are allocated for each iteration. To improve performance, the same instance can be recycled to view
* all elements of this sequence, using a {@link org.tensorflow.tools.buffer.DataBufferWindow}.
* all elements of this sequence, using a {@link DataBufferWindow}.
*
* <p>In some cases though, it might be preferable to disable such optimizations to ensure that each element returned is a
* new slice of the original array. For example, if one or more elements visited must live beyond the scope of the sequence
Expand All @@ -62,7 +63,7 @@ public interface NdArraySequence<T extends NdArray<?>> extends Iterable<T> {
* }</pre>
*
* @return a sequence that returns each elements iterated as a new slice
* @see org.tensorflow.tools.buffer.DataBufferWindow
* @see DataBufferWindow
*/
NdArraySequence<T> asSlices();
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,25 @@
limitations under the License.
=======================================================================
*/
package org.tensorflow.tools.ndarray;

import org.tensorflow.tools.Shape;
import org.tensorflow.tools.buffer.BooleanDataBuffer;
import org.tensorflow.tools.buffer.ByteDataBuffer;
import org.tensorflow.tools.buffer.DataBuffer;
import org.tensorflow.tools.buffer.DataBuffers;
import org.tensorflow.tools.buffer.DoubleDataBuffer;
import org.tensorflow.tools.buffer.FloatDataBuffer;
import org.tensorflow.tools.buffer.IntDataBuffer;
import org.tensorflow.tools.buffer.LongDataBuffer;
import org.tensorflow.tools.buffer.ShortDataBuffer;
import org.tensorflow.tools.ndarray.impl.dense.BooleanDenseNdArray;
import org.tensorflow.tools.ndarray.impl.dense.ByteDenseNdArray;
import org.tensorflow.tools.ndarray.impl.dense.DenseNdArray;
import org.tensorflow.tools.ndarray.impl.dense.DoubleDenseNdArray;
import org.tensorflow.tools.ndarray.impl.dense.FloatDenseNdArray;
import org.tensorflow.tools.ndarray.impl.dense.IntDenseNdArray;
import org.tensorflow.tools.ndarray.impl.dense.LongDenseNdArray;
import org.tensorflow.tools.ndarray.impl.dense.ShortDenseNdArray;
package org.tensorflow.ndarray;

import org.tensorflow.ndarray.impl.dense.DenseNdArray;
import org.tensorflow.ndarray.impl.dense.IntDenseNdArray;
import org.tensorflow.ndarray.buffer.BooleanDataBuffer;
import org.tensorflow.ndarray.buffer.ByteDataBuffer;
import org.tensorflow.ndarray.buffer.DataBuffer;
import org.tensorflow.ndarray.buffer.DataBuffers;
import org.tensorflow.ndarray.buffer.DoubleDataBuffer;
import org.tensorflow.ndarray.buffer.FloatDataBuffer;
import org.tensorflow.ndarray.buffer.IntDataBuffer;
import org.tensorflow.ndarray.buffer.LongDataBuffer;
import org.tensorflow.ndarray.buffer.ShortDataBuffer;
import org.tensorflow.ndarray.impl.dense.BooleanDenseNdArray;
import org.tensorflow.ndarray.impl.dense.ByteDenseNdArray;
import org.tensorflow.ndarray.impl.dense.DoubleDenseNdArray;
import org.tensorflow.ndarray.impl.dense.FloatDenseNdArray;
import org.tensorflow.ndarray.impl.dense.LongDenseNdArray;
import org.tensorflow.ndarray.impl.dense.ShortDenseNdArray;

/**
* Utility class for instantiating {@link NdArray} objects.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
=======================================================================
*/

package org.tensorflow.tools;
package org.tensorflow.ndarray;

import java.util.Arrays;

/**
* The shape of a Tensor or {@link org.tensorflow.tools.ndarray.NdArray}.
* The shape of a Tensor or {@link NdArray}.
*
* <p>A {@code Shape} defines sizes along its axes. It may contain an unknown size for one of the
* axes or may be totally unknown, in which case not even the number of axes is known. If the size
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
limitations under the License.
=======================================================================
*/
package org.tensorflow.tools.ndarray;
package org.tensorflow.ndarray;

import org.tensorflow.tools.buffer.DataBuffer;
import org.tensorflow.tools.buffer.ShortDataBuffer;
import org.tensorflow.tools.ndarray.index.Index;
import org.tensorflow.ndarray.buffer.DataBuffer;
import org.tensorflow.ndarray.buffer.ShortDataBuffer;
import org.tensorflow.ndarray.index.Index;

/**
* An {@link NdArray} of shorts.
Expand Down
Loading