snorkel.classification.Operation

class snorkel.classification.Operation(module_name, inputs, name=None)[source]

Bases: object

A single operation (forward pass of a module) to execute in a Task.

See Task for more detail on the usage and semantics of an Operation.

Parameters
  • name (Optional[str]) – The name of this operation (defaults to module_name since for most workflows, each module is only used once per forward pass)

  • module_name (str) – The name of the module in the module pool that this operation uses

  • inputs (Sequence[Union[str, Tuple[str, str]]]) – The inputs that the specified module expects, given as a list of names of previous operations (or optionally a tuple of the operation name and a key if the output of that module is a dict instead of a Tensor). Note that the original input to the model can be referred to as “_input_”.

Example

>>> op1 = Operation(module_name="linear1", inputs=[("_input_", "features")])
>>> op2 = Operation(module_name="linear2", inputs=["linear1"])
>>> op_sequence = [op1, op2]
name[source]

See above

module_name[source]

See above

inputs[source]

See above

__init__(module_name, inputs, name=None)[source]

Initialize self. See help(type(self)) for accurate signature.

Return type

None

Methods

__init__(module_name, inputs[, name])

Initialize self.