Skip to content

Commit 264081a

Browse files
committed
[CORE] Minor edits.
1 parent 1fe672e commit 264081a

File tree

2 files changed

+16
-32
lines changed
  • api/src/main/scala/org/platanios/tensorflow/api/core/client
  • examples/src/main/scala/org/platanios/tensorflow/examples

2 files changed

+16
-32
lines changed

api/src/main/scala/org/platanios/tensorflow/api/core/client/Session.scala

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,11 @@ class Session private[api](
7171
*/
7272
@throws[IllegalStateException]
7373
def run[F, E, R](
74-
feeds: FeedMap = FeedMap.empty, fetches: F = Seq.empty[Output],
75-
targets: E = Traversable.empty[Op], options: Option[RunOptions] = None)
76-
(implicit executable: Executable[E], fetchable: Fetchable.Aux[F, R]): R = {
74+
feeds: FeedMap = FeedMap.empty,
75+
fetches: F = Seq.empty[Output],
76+
targets: E = Traversable.empty[Op],
77+
options: Option[RunOptions] = None
78+
)(implicit executable: Executable[E], fetchable: Fetchable.Aux[F, R]): R = {
7779
runHelper(feeds = feeds, fetches = fetches, targets = targets, options = options)._1
7880
}
7981

@@ -106,18 +108,23 @@ class Session private[api](
106108
*/
107109
@throws[IllegalStateException]
108110
def runWithMetadata[F, E, R](
109-
feeds: FeedMap = FeedMap.empty, fetches: F = Seq.empty[Output], targets: E = Traversable.empty[Op],
110-
options: Option[RunOptions] = None)
111-
(implicit executable: Executable[E], fetchable: Fetchable.Aux[F, R]): (R, Option[RunMetadata]) = {
111+
feeds: FeedMap = FeedMap.empty,
112+
fetches: F = Seq.empty[Output],
113+
targets: E = Traversable.empty[Op],
114+
options: Option[RunOptions] = None
115+
)(implicit executable: Executable[E], fetchable: Fetchable.Aux[F, R]): (R, Option[RunMetadata]) = {
112116
runHelper(feeds = feeds, fetches = fetches, targets = targets, options = options, wantMetadata = true)
113117
}
114118

115119
/** Helper method for [[run]] and [[runWithMetadata]]. */
116120
@throws[IllegalStateException]
117121
private[api] def runHelper[F, E, R](
118-
feeds: FeedMap = FeedMap.empty, fetches: F = Seq.empty[Output], targets: E = Traversable.empty[Op],
119-
options: Option[RunOptions] = None, wantMetadata: Boolean = false)
120-
(implicit executable: Executable[E], fetchable: Fetchable.Aux[F, R]): (R, Option[RunMetadata]) = {
122+
feeds: FeedMap = FeedMap.empty,
123+
fetches: F = Seq.empty[Output],
124+
targets: E = Traversable.empty[Op],
125+
options: Option[RunOptions] = None,
126+
wantMetadata: Boolean = false
127+
)(implicit executable: Executable[E], fetchable: Fetchable.Aux[F, R]): (R, Option[RunMetadata]) = {
121128
if (nativeHandle == 0)
122129
throw new IllegalStateException("This session has already been closed.")
123130
// TODO: !!! [JNI] Add a call to 'extend' once some JNI issues are resolved.

examples/src/main/scala/org/platanios/tensorflow/examples/MNIST.scala

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -130,26 +130,3 @@ object MNIST {
130130
// }
131131
}
132132
}
133-
134-
case class DummyAccuracy(
135-
variablesCollections: Set[Graph.Key[Variable]] = Set(METRIC_VARIABLES),
136-
valuesCollections: Set[Graph.Key[Output]] = Set(METRIC_VALUES),
137-
updatesCollections: Set[Graph.Key[Output]] = Set(METRIC_UPDATES),
138-
resetsCollections: Set[Graph.Key[Op]] = Set(METRIC_RESETS),
139-
override val name: String = "Accuracy"
140-
) extends Metric[(Output, (Output, Output)), Output] {
141-
private[this] val accuracyMetric =
142-
Accuracy(variablesCollections, valuesCollections, updatesCollections, resetsCollections, name)
143-
144-
override def compute(values: (Output, (Output, Output)), weights: Output = null, name: String = name): Output = {
145-
accuracyMetric.compute((values._1.argmax(-1), values._2._2), weights, name)
146-
}
147-
148-
override def streaming(
149-
values: (Output, (Output, Output)),
150-
weights: Output = null,
151-
name: String = name
152-
): Metric.StreamingInstance[Output] = {
153-
accuracyMetric.streaming((values._1.argmax(-1), values._2._2), weights, name)
154-
}
155-
}

0 commit comments

Comments
 (0)