Skip to content
Open
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
  •  
  •  
  •  
48 changes: 1 addition & 47 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,55 +139,9 @@ jobs:
- name: Deploy native artifact
if: env.DEPLOY_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true'
run: mvn -f tensorflow-core/tensorflow-core-native/pom.xml deploy:deploy-file@native-only -B -e -Djavacpp.platform=${{ github.job }} -Djavacpp.platform.extension=${{ matrix.ext }} -Durl=${{ needs.prepare.outputs.repositoryUrl }}
windows-x86_64:
runs-on: windows-2022
needs: prepare
strategy:
matrix:
ext: [""] #, -gpu]
steps:
- name: Install environment
shell: cmd
run: |
set "PATH=C:\msys64\usr\bin;%PATH%"
python -m pip install numpy six
set "EXT=${{ matrix.ext }}"
echo %JAVA_HOME%
- name: Configure Java
uses: actions/setup-java@v5
with:
distribution: 'adopt'
java-version: '11'
- name: Checkout repository
uses: actions/checkout@v6
- name: Build project
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
set "PATH=C:\msys64\usr\bin;%PATH%"
echo Shorten work paths to prevent Bazel from reaching MAX_PATH limit
mkdir C:\tmp
set "TEST_TMPDIR=C:\tmp"
set "TMPDIR=C:\tmp"
set "TEMP=C:\tmp"
set "TMP=C:\tmp"
bash --version
git --version
cl
call mvn -version
echo ^<settings^>^<servers^>^<server^>^<id^>ossrh^</id^>^<username^>${{ secrets.CI_DEPLOY_USERNAME }}^</username^>^<password^>${{ secrets.CI_DEPLOY_PASSWORD }}^</password^>^</server^>^</servers^>^</settings^> > %USERPROFILE%\.m2\settings.xml
set "SKIP_EXPORT=true"
call mvn clean install -pl "!tensorflow-framework" -B -U -e -Djavacpp.platform=${{ github.job }} -Djavacpp.platform.extension=${{ matrix.ext }}
if ERRORLEVEL 1 exit /b
- name: Deploy native artifact
if: env.DEPLOY_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true'
shell: cmd
run: |
call mvn -f tensorflow-core/tensorflow-core-native/pom.xml deploy:deploy-file@native-only -B -e -Djavacpp.platform=${{ github.job }} -Djavacpp.platform.extension=${{ matrix.ext }} -Durl=${{ needs.prepare.outputs.repositoryUrl }}
if ERRORLEVEL 1 exit /b
deploy:
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/staging') }} # DEPLOY_SNAPSHOT (releases should be signed and deployed manually from local machine)
needs: [linux-x86_64, windows-x86_64, macosx-arm64, linux-arm64]
needs: [linux-x86_64, macosx-arm64, linux-arm64]
runs-on: ubuntu-22.04
steps:
- name: Configure Java
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ only binaries for the following are being **supported and distributed** by this
- `linux-x86_64-gpu`: Linux platforms on Intel/AMD chips with Cuda GPU support
- `linux-arm64`: Linux platforms on Arm chips
- `macosx-arm64`: MacOS X platforms on Apple Silicon chips
- `windows-x86_64`: Windows platforms on Intel/AMD chips
- `windows-x86_64`: Windows platforms on Intel/AMD chips (v1.1.0 and earlier)

Binaries for `macosx-x86_64` are available for TF-Java 1.0 series releases and earlier, they were dropped from
TF-Java 1.1 and newer as they are no longer supported or released by Google.
Expand Down Expand Up @@ -215,7 +215,7 @@ This table shows the mapping between TensorFlow, TensorFlow Java and minimum sup
| 1.0.0-rc.2 | 2.16.2 | 11 |
| 1.0.0 | 2.16.2 | 11 |
| 1.1.0 | 2.18.0 | 11 |
| 1.2.0-SNAPSHOT | 2.18.0 | 11 |
| 1.2.0-SNAPSHOT | 2.20.0 | 11 |

## How to Contribute?

Expand Down
2 changes: 1 addition & 1 deletion tensorflow-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/workspace2.bzl
(but for the currently used release, not master)
-->
<protobuf.version>3.21.9</protobuf.version>
<protobuf.version>4.28.3</protobuf.version>

<native.classifier>${javacpp.platform}${javacpp.platform.extension}</native.classifier>
<javacpp.platform.extension></javacpp.platform.extension>
Expand Down
6 changes: 3 additions & 3 deletions tensorflow-core/tensorflow-core-api/scripts/test_download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ DOWNLOAD_FOLDER="$1"

case ${PLATFORM:-} in
'linux-x86_64')
TEXT_WHEEL_URL='https://files.pythonhosted.org/packages/f3/73/3a906feb0d71d9353c6fb2363d4052856cc6eff5a78a097b1a6002d4e908/tensorflow_text-2.18.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl'
TEXT_WHEEL_URL='https://files.pythonhosted.org/packages/c3/e6/cfd784298ffb759a4235721cac2ac20f7ff758bf687069cfbaebb06c5804/tensorflow_text-2.20.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl'
;;
'linux-arm64')
TEXT_WHEEL_URL='https://files.pythonhosted.org/packages/8a/9a/ebba9f6274f8b51e5fe1ac2411b8b6bf680a32d10bd6e9c54be1faeec062/tensorflow_text-2.18.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl'
TEXT_WHEEL_URL='https://files.pythonhosted.org/packages/f5/ca/796cfd97ae6693d3c84c37575a6d481be5f1ef36c920d1a73c884f31797b/tensorflow_text-2.20.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl'
;;
'macosx-arm64')
TEXT_WHEEL_URL='https://files.pythonhosted.org/packages/18/b6/8ad233edb0732847db1da538cea941dcccc42f59304ff6fb449676e6dd5a/tensorflow_text-2.18.1-cp311-cp311-macosx_11_0_arm64.whl'
TEXT_WHEEL_URL='https://files.pythonhosted.org/packages/98/e4/e3c72d0a73caeba90cf5b31e69d44e9a08d614e0e829484d813f3b63e037/tensorflow_text-2.20.0-cp312-cp312-macosx_11_0_arm64.whl'
;;
*)
echo "TensorFlow Text distribution for ${PLATFORM} is not supported for download"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "DecodeWebP"
endpoint {
name: "image.DecodeWebP"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
op {
graph_op_name: "TPUDummyInput"
visibility: HIDDEN
endpoint {
name: "tpu.TPUDummyInput"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
op {
graph_op_name: "XlaSparseActivationsUnstack"
visibility: VISIBLE
endpoint {
name: "xla.XlaSparseActivationsUnstack"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
op {
graph_op_name: "XlaSparseDenseMatmulCustomCombinerOnTcGradWithAdagradAndCsrInput"
visibility: VISIBLE
endpoint {
name: "xla.XlaSparseDenseMatmulCustomCombinerOnTcGradWithAdagradAndCsrInput"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
op {
graph_op_name: "XlaSparseDenseMatmulCustomCombinerOnTcGradWithAdagradMomentumAndCsrInput"
visibility: VISIBLE
endpoint {
name: "xla.XlaSparseDenseMatmulCustomCombinerOnTcGradWithAdagradMomentumAndCsrInput"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
op {
graph_op_name: "XlaSparseDenseMatmulCustomCombinerOnTcGradWithAdamAndCsrInput"
visibility: VISIBLE
endpoint {
name: "xla.XlaSparseDenseMatmulCustomCombinerOnTcGradWithAdamAndCsrInput"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
op {
graph_op_name: "XlaSparseDenseMatmulCustomCombinerOnTcGradWithCsrInput"
visibility: VISIBLE
endpoint {
name: "xla.XlaSparseDenseMatmulCustomCombinerOnTcGradWithCsrInput"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
op {
graph_op_name: "XlaSparseDenseMatmulCustomCombinerOnTcGradWithFtrlAndCsrInput"
visibility: VISIBLE
endpoint {
name: "xla.XlaSparseDenseMatmulCustomCombinerOnTcGradWithFtrlAndCsrInput"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "XlaSparseDenseMatmulCustomCombinerOnTcGradWithSgdAndCsrInput"
endpoint {
name: "xla.XlaSparseDenseMatmulCustomCombinerOnTcGradWithSgdAndCsrInput"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "XlaSparseDenseMatmulCustomCombinerOnTcWithCsrInput"
endpoint {
name: "xla.XlaSparseDenseMatmulCustomCombinerOnTcWithCsrInput"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "XlaSparseGradientsStack"
endpoint {
name: "xla.XlaSparseGradientsStack"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public final class DtypesOps {
* Converts each entry in the given tensor to strings.
* Supports many numeric types and boolean.
* <p>For Unicode, see the
* [https://www.tensorflow.org/tutorials/representation/unicode](Working with Unicode text)
* [https://www.tensorflow.org/text/guide/unicode](Working with Unicode text)
* tutorial.
* <p>Examples:
* <blockquote>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.tensorflow.op.image.DecodeImage;
import org.tensorflow.op.image.DecodeJpeg;
import org.tensorflow.op.image.DecodePng;
import org.tensorflow.op.image.DecodeWebP;
import org.tensorflow.op.image.DrawBoundingBoxes;
import org.tensorflow.op.image.EncodeJpeg;
import org.tensorflow.op.image.EncodeJpegVariableQuality;
Expand Down Expand Up @@ -336,17 +337,18 @@ public DecodeGif decodeGif(Operand<TString> contents) {
}

/**
* Function for decode_bmp, decode_gif, decode_jpeg, and decode_png.
* Detects whether an image is a BMP, GIF, JPEG, or PNG, and performs the
* Function for decode_bmp, decode_gif, decode_jpeg, decode_webp, and decode_png.
* Detects whether an image is a BMP, GIF, JPEG, WebP, or PNG, and performs the
* appropriate operation to convert the input bytes string into a Tensor of type
* dtype.
* <p><em>NOTE</em>: decode_gif returns a 4-D array [num_frames, height, width, 3], as
* opposed to decode_bmp, decode_jpeg and decode_png, which return 3-D arrays
* [height, width, num_channels]. Make sure to take this into account when
* constructing your graph if you are intermixing GIF files with BMP, JPEG, and/or
* PNG files. Alternately, set the expand_animations argument of this function to
* False, in which case the op will return 3-dimensional tensors and will truncate
* animated GIF files to the first frame.
* <p><em>NOTE</em>: decode_gif and decode_webp return a 4-D
* array [num_frames, height, width, 3], as opposed to decode_bmp,
* decode_jpeg, and decode_png, which always return 3-D arrays [height,
* width, num_channels]. Make sure to take this into account when
* constructing your graph if you are intermixing animated files with
* BMP, JPEG, and/or PNG files. Alternately, set the expand_animations
* argument of this function to False, in which case the op will return
* 3-dimensional tensors and will truncate animations to the first frame.
* <p><em>NOTE</em>: If the first frame of an animated GIF does not occupy the entire
* canvas (maximum frame width x maximum frame height), then it fills the
* unoccupied areas (in the first frame) with zeros (black). For frames after the
Expand All @@ -357,22 +359,24 @@ public DecodeGif decodeGif(Operand<TString> contents) {
* @param options carries optional attribute values
* @return a new instance of DecodeImage, with default output types
*/
public DecodeImage<TUint8> decodeImage(Operand<TString> contents, DecodeImage.Options[] options) {
public DecodeImage<TUint8> decodeImage(Operand<TString> contents,
DecodeImage.Options... options) {
return DecodeImage.create(scope, contents, options);
}

/**
* Function for decode_bmp, decode_gif, decode_jpeg, and decode_png.
* Detects whether an image is a BMP, GIF, JPEG, or PNG, and performs the
* Function for decode_bmp, decode_gif, decode_jpeg, decode_webp, and decode_png.
* Detects whether an image is a BMP, GIF, JPEG, WebP, or PNG, and performs the
* appropriate operation to convert the input bytes string into a Tensor of type
* dtype.
* <p><em>NOTE</em>: decode_gif returns a 4-D array [num_frames, height, width, 3], as
* opposed to decode_bmp, decode_jpeg and decode_png, which return 3-D arrays
* [height, width, num_channels]. Make sure to take this into account when
* constructing your graph if you are intermixing GIF files with BMP, JPEG, and/or
* PNG files. Alternately, set the expand_animations argument of this function to
* False, in which case the op will return 3-dimensional tensors and will truncate
* animated GIF files to the first frame.
* <p><em>NOTE</em>: decode_gif and decode_webp return a 4-D
* array [num_frames, height, width, 3], as opposed to decode_bmp,
* decode_jpeg, and decode_png, which always return 3-D arrays [height,
* width, num_channels]. Make sure to take this into account when
* constructing your graph if you are intermixing animated files with
* BMP, JPEG, and/or PNG files. Alternately, set the expand_animations
* argument of this function to False, in which case the op will return
* 3-dimensional tensors and will truncate animations to the first frame.
* <p><em>NOTE</em>: If the first frame of an animated GIF does not occupy the entire
* canvas (maximum frame width x maximum frame height), then it fills the
* unoccupied areas (in the first frame) with zeros (black). For frames after the
Expand Down Expand Up @@ -436,7 +440,7 @@ public DecodeJpeg decodeJpeg(Operand<TString> contents, DecodeJpeg.Options... op
* @param options carries optional attribute values
* @return a new instance of DecodePng, with default output types
*/
public DecodePng<TUint8> decodePng(Operand<TString> contents, DecodePng.Options[] options) {
public DecodePng<TUint8> decodePng(Operand<TString> contents, DecodePng.Options... options) {
return DecodePng.create(scope, contents, options);
}

Expand Down Expand Up @@ -467,6 +471,51 @@ public <T extends TNumber> DecodePng<T> decodePng(Operand<TString> contents, Cla
return DecodePng.create(scope, contents, dtype, options);
}

/**
* Decode a WebP-encoded image to a uint8 tensor.
* The attr {@code channels} indicates the desired number of color channels for the
* decoded image.
* <p>Accepted values are:
* <ul>
* <li>0: Use the number of channels in the WebP-encoded image.</li>
* <li>3: output an RGB image.</li>
* <li>4: output an RGBA image.</li>
* </ul>
* <p>The number of channels must currently match that of the underlying file.
* For WebP animations, only 4-channel RGBA is supported.
*
* @param contents 0-D. The WebP-encoded image.
* @param options carries optional attribute values
* @return a new instance of DecodeWebP, with default output types
*/
public DecodeWebP<TUint8> decodeWebP(Operand<TString> contents, DecodeWebP.Options... options) {
return DecodeWebP.create(scope, contents, options);
}

/**
* Decode a WebP-encoded image to a uint8 tensor.
* The attr {@code channels} indicates the desired number of color channels for the
* decoded image.
* <p>Accepted values are:
* <ul>
* <li>0: Use the number of channels in the WebP-encoded image.</li>
* <li>3: output an RGB image.</li>
* <li>4: output an RGBA image.</li>
* </ul>
* <p>The number of channels must currently match that of the underlying file.
* For WebP animations, only 4-channel RGBA is supported.
*
* @param contents 0-D. The WebP-encoded image.
* @param dtype The value of the dtype attribute
* @param options carries optional attribute values
* @param <T> data type for {@code DecodeWebP} output and operands
* @return a new instance of DecodeWebP
*/
public <T extends TNumber> DecodeWebP<T> decodeWebP(Operand<TString> contents, Class<T> dtype,
DecodeWebP.Options... options) {
return DecodeWebP.create(scope, contents, dtype, options);
}

/**
* Draw bounding boxes on a batch of images.
* Outputs a copy of {@code images} but draws on top of the pixels zero or more bounding
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2127,7 +2127,7 @@ public <T extends TNumber> MaxPoolGradWithArgmax<T> maxPoolGradWithArgmax(Operan
* @return a new instance of MaxPoolWithArgmax, with default output types
*/
public <T extends TNumber> MaxPoolWithArgmax<T, TInt64> maxPoolWithArgmax(Operand<T> input,
List<Long> ksize, List<Long> strides, String padding, MaxPoolWithArgmax.Options[] options) {
List<Long> ksize, List<Long> strides, String padding, MaxPoolWithArgmax.Options... options) {
return MaxPoolWithArgmax.create(scope, input, ksize, strides, padding, options);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,10 @@ public final class Ops {

public final SummaryOps summary;

public final ImageOps image;

public final RaggedOps ragged;

public final ImageOps image;

public final ShapeOps shape;

public final IoOps io;
Expand Down Expand Up @@ -457,8 +457,8 @@ public final class Ops {
train = new TrainOps(this);
quantization = new QuantizationOps(this);
summary = new SummaryOps(this);
image = new ImageOps(this);
ragged = new RaggedOps(this);
image = new ImageOps(this);
shape = new ShapeOps(this);
io = new IoOps(this);
dtypes = new DtypesOps(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public final class QuantizationOps {
* @return a new instance of Dequantize, with default output types
*/
public Dequantize<TFloat32> dequantize(Operand<? extends TNumber> input,
Operand<TFloat32> minRange, Operand<TFloat32> maxRange, Dequantize.Options[] options) {
Operand<TFloat32> minRange, Operand<TFloat32> maxRange, Dequantize.Options... options) {
return Dequantize.create(scope, input, minRange, maxRange, options);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public LogUniformCandidateSampler logUniformCandidateSampler(Operand<TInt64> tru
* @return a new instance of Multinomial, with default output types
*/
public Multinomial<TInt64> multinomial(Operand<? extends TNumber> logits,
Operand<TInt32> numSamples, Multinomial.Options[] options) {
Operand<TInt32> numSamples, Multinomial.Options... options) {
return Multinomial.create(scope, logits, numSamples, options);
}

Expand Down Expand Up @@ -327,7 +327,7 @@ public <T extends TNumber> RandomGammaGrad<T> randomGammaGrad(Operand<T> alpha,
* @return a new instance of RandomPoisson, with default output types
*/
public RandomPoisson<TInt64> randomPoisson(Operand<? extends TNumber> shape,
Operand<? extends TNumber> rate, RandomPoisson.Options[] options) {
Operand<? extends TNumber> rate, RandomPoisson.Options... options) {
return RandomPoisson.create(scope, shape, rate, options);
}

Expand Down
Loading
Loading