-
Notifications
You must be signed in to change notification settings - Fork 42
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
Add mechanism to "reduce" an op to another op #57
Comments
We will call the data structure |
#74 introduces the same |
@dietzc and I changed our minds, and are going to call it |
One thing that wasn't clear in the writeup above (and so I forgot in the intervening months) is that op reduction is really most valuable when a single reduction rule covers multiple different ops. The Actually, in the above example, we should probably have a single object that holds space+indices, and reduce all representations to that. Will make the op implementations cleaner. |
One possible issue with this idea is that it makes it harder to fully enumerate all the possible op invocations as compile-safe method signatures (see #19). To accomplish that programmatically, the op reductions would need to be invertible in some sense. |
@dietzc In light of the above, I think I want to gather some more use cases before committing to this feature, since it will cost substantial work to implement properly. Do you have some intuition for where the op reduction will be most valuable? Do we have a proliferation of op implementations now, or anticipate specific ones in the future, which will be avoided by this scheme? |
@dietzc and I chatted more, and we still think we want this, but not urgently. When #54 is solved, the situation will be much nicer. However, it would still be good to document a few concrete use cases for the reducers, where the op ➡️ op translation is not argument-independent (which is what you can achieve with the currently supported single-argument converters). As soon as you want to either: A) add or remove a parameter; or B) have a destination parameter type determined by more than one input parameter type, then having op reduction would be useful. |
@LeonYang5114 pointed out another potential use case for this. Suppose you have |
Closed in favor of the new scijava-ops work, which includes an "op simplification" framework as well as other related niceties. |
Given a set of "op parameters" (name, type and args), the
OpMatchingService
works in multiple stages:Contingent
and reject the specific args givenNote that "compatible" above means "able to be converted using the SJC
ConvertService
."We will add another phase of the matching process, as follows:
OpParams
class (tentative name) that encapsulates the (name, type, args) as a single object.Converter
implementations that know how to "reduce" from certainOpParams
to otherOpParams
. This is very useful in the case when an op ends up being a simple wrapper around another op, which is very common.For example: these converters could define the following reduction path:
normalize(outputImgPlus, imgPlus, axisTypes)
normalize(outputImg, img, axisIndices)
slicewise(outputImg, img, op(normalize), axisIndices)
map(...)
Then the
OpMatchingService
would need to—when an exact match is not found—attempt to apply a reduction then repeat the matching algorithm, repeating as needed until no more reductions can be found (excluding cycles).See the match-conversion branch to follow progress on this issue.
The text was updated successfully, but these errors were encountered: