Skip to content

Commit 197c5cf

Browse files
committed
Rename withSession to useSession to reflect closing semantics
Signed-off-by: Ryan Nett <[email protected]>
1 parent e71126a commit 197c5cf

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Diff for: tensorflow-core-kotlin/tensorflow-core-kotlin-api/src/main/kotlin/org/tensorflow/ExecutionEnvironmentHelpers.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public inline fun <R> Graph(block: Graph.() -> R): R {
3838
* @throws IllegalArgumentException if the config is not a valid serialization of the ConfigProto
3939
* protocol buffer.
4040
*/
41-
public inline fun <R> Graph.withSession(config: ConfigProto? = null, block: (Session) -> R): R {
41+
public inline fun <R> Graph.useSession(config: ConfigProto? = null, block: (Session) -> R): R {
4242
contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }
4343
return Session(this, config).use(block)
4444
}

Diff for: tensorflow-core-kotlin/tensorflow-core-kotlin-api/src/test/kotlin/org/tensorflow/Example.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public class Example {
5252
DenseLayer("OutputLayer", x, 10) { tf.math.sigmoid(x) }
5353
}
5454

55-
withSession {
55+
useSession {
5656
val outputValue = it.run(fetches = listOf(output))[output]
5757
println(outputValue.data())
5858
}

0 commit comments

Comments
 (0)