You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/ops/doc/CallingOps.md
+20-4Lines changed: 20 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,15 +72,31 @@ direct execution, since the parameters have not been concretely specified yet.
72
72
Using [wildcards](https://docs.oracle.com/javase/tutorial/extra/generics/wildcards.html), such as `Img<?> inImage`, can make Op reuse difficult. For example, the following code segment will not compile in a Java runtime:
var gaussOp = ops.op("filter.gauss").input(inImage, 2.0).output(outImage).computer();
77
77
gaussOp.compute(inImage, 2.0, outImage);
78
78
```
79
79
80
80
### Solution 1: Use `compute` instead of `computer`
81
81
82
-
If you don't need to save the Op to a variable, *just call it directly* as shown [here](#computing-with-compute). Generally speaking, op requests are **cached**, meaning repeated OpBuilder calls that directly execute Ops will **not** significantly increase performance.
82
+
If you don't need to save the Op to a variable, *just [call it directly](#computing-with-compute)*:
83
83
84
-
### Solution 2: Use Type Parameters on your functions
Generally speaking, op requests are **cached**, meaning repeated OpBuilder calls that directly execute Ops will **not** significantly decrease performance.
89
+
90
+
### Solution 2: Avoid using wildcards
91
+
92
+
If you *know* that your `Img` will always contain unsigned byte values, for example, define your variable as an `Img<UnsignedByteType>` rather than using `Img<?>`.
0 commit comments