Skip to content
This repository was archived by the owner on Dec 31, 2020. It is now read-only.

Commit 7ff3353

Browse files
committed
rename GraphMethod type aliases
1 parent 31d9a14 commit 7ff3353

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

flink-tensorflow/src/main/scala/org/apache/flink/contrib/tensorflow/examples/inception/ImageNormalization.scala

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import org.tensorflow.framework.{SignatureDef, TensorInfo}
1313

1414
sealed trait ImageNormalizationMethod extends GraphMethod {
1515
val name = NORMALIZE_METHOD_NAME
16-
override type IN = ImageFileTensor
17-
override type OUT = ImageTensor
16+
override type Input = ImageFileTensor
17+
override type Output = ImageTensor
1818
}
1919

2020
object ImageNormalizationMethod {
@@ -26,8 +26,8 @@ object ImageNormalizationMethod {
2626
* Normalizes a vector of image files to a vector of images.
2727
*/
2828
implicit val impl = new ImageNormalizationMethod {
29-
def inputs(i: IN): Map[String, Tensor] = Map(NORMALIZE_INPUTS -> i)
30-
def outputs(o: Map[String, Tensor]): OUT = o(NORMALIZE_OUTPUTS).taggedAs[ImageTensor]
29+
def inputs(i: Input): Map[String, Tensor] = Map(NORMALIZE_INPUTS -> i)
30+
def outputs(o: Map[String, Tensor]): Output = o(NORMALIZE_OUTPUTS).taggedAs[ImageTensor]
3131
}
3232
}
3333

flink-tensorflow/src/main/scala/org/apache/flink/contrib/tensorflow/examples/inception/InceptionModel.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import scala.collection.JavaConverters._
1818

1919
sealed trait LabelMethod extends GraphMethod {
2020
def name = LABEL_METHOD_NAME
21-
override type IN = ImageTensor
22-
override type OUT = LabelTensor
21+
override type Input = ImageTensor
22+
override type Output = LabelTensor
2323
}
2424

2525
@SerialVersionUID(1L)

flink-tensorflow/src/main/scala/org/apache/flink/contrib/tensorflow/graphs/GraphMethod.scala

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ trait GraphMethod {
1010
/**
1111
* The input type of the method.
1212
*/
13-
type IN
13+
type Input
1414

1515
/**
1616
* The output type of the method.
1717
*/
18-
type OUT
18+
type Output
1919

2020
/**
2121
* The method name.
@@ -25,12 +25,12 @@ trait GraphMethod {
2525
/**
2626
* Gets the input values to feed when the method is invoked.
2727
*/
28-
def inputs(in: IN): Map[String, Tensor]
28+
def inputs(in: Input): Map[String, Tensor]
2929

3030
/**
3131
* Gets the result of invoking the method.
3232
* @param outputs a map of fetched outputs.
3333
*/
34-
def outputs(outputs: Map[String, Tensor]): OUT
34+
def outputs(outputs: Map[String, Tensor]): Output
3535

3636
}

flink-tensorflow/src/main/scala/org/apache/flink/contrib/tensorflow/ml/signatures/RegressionMethod.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import org.apache.flink.contrib.tensorflow.graphs.GraphMethod
1717
*/
1818
sealed trait RegressionMethod extends GraphMethod {
1919
val name = REGRESS_METHOD_NAME
20-
override type IN = ExampleTensor
21-
override type OUT = PredictionTensor
20+
override type Input = ExampleTensor
21+
override type Output = PredictionTensor
2222
}
2323

2424
object RegressionMethod {

flink-tensorflow/src/main/scala/org/apache/flink/contrib/tensorflow/models/ModelFunction.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ trait ModelFunction[T <: GraphMethod] {
2121
*
2222
* @return the output values as provided by the method.
2323
*/
24-
def apply(in: T#IN): ManagedResource[T#OUT]
24+
def apply(in: T#Input): ManagedResource[T#Output]
2525
}
2626

2727
object ModelFunction {
@@ -37,7 +37,7 @@ object ModelFunction {
3737
require(method.name == signatureDef.getMethodName)
3838

3939
new ModelFunction[T] {
40-
def apply(in: T#IN): ManagedResource[T#OUT] = {
40+
def apply(in: T#Input): ManagedResource[T#Output] = {
4141
require(in != null, "Input must be provided")
4242

4343
// create a managed resource that lazily runs the graph
@@ -47,7 +47,7 @@ object ModelFunction {
4747
val runner = session.runner
4848

4949
// map inputs according to the signaturedef
50-
val inputs = method.inputs(in.asInstanceOf[method.IN])
50+
val inputs = method.inputs(in.asInstanceOf[method.Input])
5151
signatureDef.getInputsMap.asScala.foreach { kv =>
5252
val tensor = inputs.getOrElse(kv._1,
5353
throw new IllegalArgumentException(s"An input tensor named ${kv._1} must be provided for this computation."))

0 commit comments

Comments
 (0)