FlowerClient

class FlowerClient<X : Any, Y : Any>(tfliteFileBuffer: MappedByteBuffer, val layersSizes: IntArray, val spec: SampleSpec<X, Y>) : AutoCloseable

Flower client that handles TensorFlow Lite model Interpreter and sample data.

Parameters

tfliteFileBuffer

TensorFlow Lite model file.

layersSizes

Sizes of model parameters layers in bytes.

spec

Specification for the samples, see SampleSpec.

Constructors

Link copied to clipboard
constructor(tfliteFileBuffer: MappedByteBuffer, layersSizes: IntArray, spec: SampleSpec<X, Y>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun addSample(bottleneck: X, label: Y, isTraining: Boolean)

Add one sample point (bottleneck, label) for training or testing later. Thread-safe.

Link copied to clipboard
open override fun close()
Link copied to clipboard

Evaluate model loss and accuracy using testSamples and spec.

Link copied to clipboard
fun fit(epochs: Int = 1, batchSize: Int = 32, lossCallback: (List<Float>) -> Unit? = null): List<Double>

Fit the local model using trainingSamples for epochs epochs with batch size batchSize.

Link copied to clipboard

Obtain the model parameters from interpreter.

Link copied to clipboard
fun inference(x: Array<X>): Array<Y>

Run inference on x using interpreter and return the result.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Update the model parameters in interpreter with parameters.