KGraph

class KGraph(graphDef: ByteArray, prefix: String) : AutoCloseable

A wrapper object to extend functionality and behaviour of static TensorFlow graph.

It tracks all model variables (used in optimizers or layers) and its initializers.

Parameters

graphDef

A serialized representation of the graph.

prefix

A prefix that will be prepended to names in graphDef.

Constructors

KGraph
Link copied to clipboard
fun KGraph(graphDef: ByteArray)
KGraph
Link copied to clipboard
fun KGraph(graphDef: ByteArray, prefix: String)

Creates KGraph by serialized representation of the graph.

Functions

addOptimizerVariable
Link copied to clipboard
fun addOptimizerVariable(variable: Variable<Float>)

Adds a variable used in optimizer to the pool of tracked variables.

fun addOptimizerVariableAssignAddInitializer(initializer: AssignAdd<Float>)

Adds an optimizer initializer of special 'AssignAdd' type for optimizer variable tracked in KGraph.

addOptimizerVariableInitializer
Link copied to clipboard
fun addOptimizerVariableInitializer(initializer: Assign<*>)

Adds an optimizer initializer for optimizer variable tracked in KGraph.

close
Link copied to clipboard
open override fun close()

Closes internal TensorFlow graph.

copy
Link copied to clipboard
fun copy(): KGraph

Makes a graph copy.

initializeOptimizerVariables
Link copied to clipboard
fun initializeOptimizerVariables(session: Session)

Initializes TensorFlow graph variables used in optimizer.

optimizerVariables
Link copied to clipboard
fun optimizerVariables(): List<Variable<Float>>

Returns all variables used in optimizer and initialized by Assign TensorFlow operand.

toString
Link copied to clipboard
open override fun toString(): String
variableNames
Link copied to clipboard
fun variableNames(): List<String>

Returns list of variable names in TensorFlow graph.

Properties

isClosed
Link copied to clipboard
var isClosed: Boolean = false

True if the graph object is closed and the occupied resources are freed.