Arithmetic module
- class nnodely.layers.arithmetic.Add(*args, **kwargs)[source]
Implement the addition function between two tensors. (it is also possible to use the classical math operator ‘+’)
See also
Official PyTorch Add documentation: torch.add
- Parameters:
input1 – the first element of the addition
input2 – the second element of the addition
Example:
add = Add(relation1, relation2) # or add = relation1 + relation2
- class nnodely.layers.arithmetic.Sub(*args, **kwargs)[source]
Implement the subtraction function between two tensors. (it is also possible to use the classical math operator ‘-‘)
- Parameters:
input1 – the first element of the subtraction
input2 – the second element of the subtraction
Example:
sub = Sub(relation1, relation2) # or sub = relation1 - relation2
- class nnodely.layers.arithmetic.Mul(*args, **kwargs)[source]
Implement the multiplication function between two tensors. (it is also possible to use the classical math operator ‘*’)
- Parameters:
input1 – the first element of the multiplication
input2 – the second element of the multiplication
Example:
mul = Mul(relation1, relation2) # or mul = relation1 * relation2
- class nnodely.layers.arithmetic.Div(*args, **kwargs)[source]
Implement the division function between two tensors. (it is also possible to use the classical math operator ‘/’)
- Parameters:
input1 – the numerator of the division
input2 – the denominator of the division
Example:
div = Div(relation1, relation2) # or div = relation1 / relation2
- class nnodely.layers.arithmetic.Pow(*args, **kwargs)[source]
Implement the power function given an input and an exponent. (it is also possible to use the classical math operator ‘**’)
See also
Official PyTorch pow documentation: torch.pow
- Parameters:
input – the base of the power function
exp – the exponent of the power function
Example:
pow = Pow(relation, exp) # or pow = relation1 ** relation2