Skip to content

Value streaming for NdArrays #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 25, 2023

Conversation

karllessard
Copy link
Collaborator

Adds basic methods allowing users to visit all scalar values of a NdArray using Java Streams.

Array of all types can retrieve their values as a stream of objects, while arrays of Int, Long or Double can also stream of primitive values (which is preferred).

@karllessard karllessard requested a review from Craigacp January 25, 2023 16:27
Copy link
Collaborator

@Craigacp Craigacp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lack of FloatStream in the JDK is annoying as that's the one we'd use the most, but we can't fix that.

@@ -20,6 +20,12 @@
import org.tensorflow.ndarray.buffer.IntDataBuffer;
import org.tensorflow.ndarray.index.Index;

import java.util.stream.DoubleStream;
import java.util.stream.IntStream;
import java.util.stream.LongStream;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some redundant imports here.

@@ -18,6 +18,10 @@

import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.stream.DoubleStream;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant import?

Copy link
Collaborator

@Craigacp Craigacp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@karllessard karllessard merged commit a9d3f25 into tensorflow:main Jan 25, 2023
@karllessard karllessard deleted the value-streaming branch January 25, 2023 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants