jactorch.nn.neural_logic.modules.neural_logic#

Classes

Class NeuralLogicInference

class NeuralLogicInference[source]#

Bases: NeuralLogicInferenceBase

__init__(model, input_dim, output_dim, hidden_dim, activation='sigmoid')[source]#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(input)#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

get_output_dim(input_dim)#

Class NeuralLogicInferenceBase

class NeuralLogicInferenceBase[source]#

Bases: Module

__init__(model, input_dim, output_dim, hidden_dim)[source]#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(input)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

get_output_dim(input_dim)[source]#

Class NeuralLogicInferenceMethod

class NeuralLogicInferenceMethod[source]#

Bases: JacEnum

__new__(value)#
classmethod assert_valid(value)#

Assert if the value is a valid choice.

classmethod choice_names()#

Returns the list of the name of all possible choices.

classmethod choice_objs()#

Returns the list of the object of all possible choices.

classmethod choice_values()#

Returns the list of the value of all possible choices.

classmethod from_string(value)#
Parameters:

value (str | JacEnum)

Return type:

JacEnum

classmethod is_valid(value)#

Check if the value is a valid choice.

classmethod type_name()#

Return the type name of the enum.

MLP = 'mlp'#
SKIP = 'skip'#

Class NeuralLogitsInference

class NeuralLogitsInference[source]#

Bases: NeuralLogicInferenceBase

__init__(model, input_dim, output_dim, hidden_dim)#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(input)#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

get_output_dim(input_dim)#