predictor module
Full Documentation for hippynn.graphs.predictor
module.
Click here for a summary page.
Predictor object which builds a graph for predictions with a simple user interface.
- class Predictor(inputs, outputs, return_device=device(type='cpu'), model_device=None, requires_grad=False, name=None)[source]
Bases:
object
The predictor is a dressed-up GraphModule which gives access to the outputs of individual nodes.
In many cases you may simply want to use the
from_graph
method to generate a predictor.The predictor will take the model graph, convert the output nodes into a padded index state, and build a new graph for these operations.
- apply_to_database(db, **kwargs)[source]
Note: kwargs are passed to self.__call__, e.g. the
batch_size
parameter.
- classmethod from_graph(graph, additional_outputs=None, **kwargs)[source]
Construct a new predictor from an existing GraphModule.
- Parameters:
graph – graph to create predictor for. The predictor makes a shallow copy of this graph. e.g. it may move parameters from that graph to the model_device.
additional_outputs – List of additional nodes to include in outputs
kwargs – passed to
__init__
- Returns:
predictor instance
- property inputs
- property model_device
- property outputs