nvflare.app_common.decomposers.common_decomposers module

Decomposers for types from app_common and Machine Learning libraries.

class CtxPropReqDecomposer[source]

Bases: Decomposer

decompose(target: _CtxPropReq) Any[source]

Decompose the target into types supported by msgpack or classes with decomposers registered.

Msgpack supports primitives, bytes, memoryview, lists, dicts.

Parameters

target – The instance to be serialized

Returns

The decomposed serializable objects

recompose(data: Any) _CtxPropReq[source]

Reconstruct the object from decomposed components.

Parameters

data – The decomposed components

Returns

The reconstructed object

static supported_type()[source]

Returns the type/class supported by this decomposer.

Returns

The class (not instance) of supported type

class EventReqDecomposer[source]

Bases: Decomposer

decompose(target: _EventReq) Any[source]

Decompose the target into types supported by msgpack or classes with decomposers registered.

Msgpack supports primitives, bytes, memoryview, lists, dicts.

Parameters

target – The instance to be serialized

Returns

The decomposed serializable objects

recompose(data: Any) _EventReq[source]

Reconstruct the object from decomposed components.

Parameters

data – The decomposed components

Returns

The reconstructed object

static supported_type()[source]

Returns the type/class supported by this decomposer.

Returns

The class (not instance) of supported type

class EventStatsDecomposer[source]

Bases: Decomposer

decompose(target: _EventStats) Any[source]

Decompose the target into types supported by msgpack or classes with decomposers registered.

Msgpack supports primitives, bytes, memoryview, lists, dicts.

Parameters

target – The instance to be serialized

Returns

The decomposed serializable objects

recompose(data: Any) _EventStats[source]

Reconstruct the object from decomposed components.

Parameters

data – The decomposed components

Returns

The reconstructed object

static supported_type()[source]

Returns the type/class supported by this decomposer.

Returns

The class (not instance) of supported type

class Float32ScalarDecomposer[source]

Bases: NumpyScalarDecomposer

static supported_type()[source]

Returns the type/class supported by this decomposer.

Returns

The class (not instance) of supported type

class Float64ScalarDecomposer[source]

Bases: NumpyScalarDecomposer

static supported_type()[source]

Returns the type/class supported by this decomposer.

Returns

The class (not instance) of supported type

class Int32ScalarDecomposer[source]

Bases: NumpyScalarDecomposer

static supported_type()[source]

Returns the type/class supported by this decomposer.

Returns

The class (not instance) of supported type

class Int64ScalarDecomposer[source]

Bases: NumpyScalarDecomposer

static supported_type()[source]

Returns the type/class supported by this decomposer.

Returns

The class (not instance) of supported type

class LearnableDecomposer[source]

Bases: Decomposer

decompose(target: Learnable) Any[source]

Decompose the target into types supported by msgpack or classes with decomposers registered.

Msgpack supports primitives, bytes, memoryview, lists, dicts.

Parameters

target – The instance to be serialized

Returns

The decomposed serializable objects

recompose(data: Any) Learnable[source]

Reconstruct the object from decomposed components.

Parameters

data – The decomposed components

Returns

The reconstructed object

static supported_type()[source]

Returns the type/class supported by this decomposer.

Returns

The class (not instance) of supported type

class NumpyArrayDecomposer[source]

Bases: Decomposer

decompose(target: ndarray) Any[source]

Decompose the target into types supported by msgpack or classes with decomposers registered.

Msgpack supports primitives, bytes, memoryview, lists, dicts.

Parameters

target – The instance to be serialized

Returns

The decomposed serializable objects

recompose(data: Any) ndarray[source]

Reconstruct the object from decomposed components.

Parameters

data – The decomposed components

Returns

The reconstructed object

static supported_type()[source]

Returns the type/class supported by this decomposer.

Returns

The class (not instance) of supported type

class NumpyScalarDecomposer[source]

Bases: Decomposer, ABC

Decomposer base class for all numpy types with item method.

decompose(target: Any) Any[source]

Decompose the target into types supported by msgpack or classes with decomposers registered.

Msgpack supports primitives, bytes, memoryview, lists, dicts.

Parameters

target – The instance to be serialized

Returns

The decomposed serializable objects

recompose(data: Any) ndarray[source]

Reconstruct the object from decomposed components.

Parameters

data – The decomposed components

Returns

The reconstructed object

register()[source]