Skip to content
This repository was archived by the owner on Jul 15, 2025. It is now read-only.

Value streaming for NdArrays #15

Merged
merged 2 commits into from
Jan 25, 2023

Conversation

karllessard
Copy link
Contributor

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
Contributor

@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
Contributor

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
Contributor

Choose a reason for hiding this comment

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

Redundant import?

Copy link
Contributor

@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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants