Google I / O kehrt vom 18. bis 20. Mai zurück! Reservieren Sie Platz und erstellen Sie Ihren Zeitplan Registrieren Sie sich jetzt

tff.framework.ExecutorFactory

Interface defining executor factories.

ExecutorFactory should be considered to own the executors it creates; it is responsible for their instantiation and management.

ExecutorFactory exposes two methods, create_executor and clean_up_executors. There is a particular coupling between these two methods; any executor returned by create_executor should not be used after clean_up_executors has been called without reinitialization. That is, create_executor should be called again, and ExecutorFactory will ensure that the returned executor is safe for use.

Methods

clean_up_executors

View source

Releases any resources held by the factory.

Note that calling this method may invalidate the state of any executors which have previously been returned by the factory; create_executor should be called again if a new executor which is safe to use is desired.

create_executor

View source

Abstract method to construct instance of executor_base.Executor.

create_executor must accept a dict mapping placement_literals.PlacementLiterals to ints, and return an executor_base.Executor.

Args
cardinalities a dict mapping instances of placement_literals.PlacementLiteral to ints, specifying the population size at each placement.

Returns
Instance of executor_base.Executor.