Skip to main content

tensorlogic_infer/
ops.rs

1//! Operation type enumerations.
2
3#[derive(Clone, Copy, Debug)]
4pub enum ElemOp {
5    // Activation functions
6    Relu,
7    Sigmoid,
8
9    // Unary operations
10    OneMinus,
11
12    // Arithmetic binary operations
13    Add,
14    Subtract,
15    Multiply,
16    Divide,
17    Min, // Element-wise minimum
18    Max, // Element-wise maximum
19
20    // Comparison operations (return 0.0 or 1.0)
21    Eq,  // Equal
22    Lt,  // Less than
23    Gt,  // Greater than
24    Lte, // Less than or equal
25    Gte, // Greater than or equal
26
27    // Extended logical operations
28    OrMax,     // OR using max(a, b)
29    OrProbSum, // OR using probabilistic sum: 1 - (1-a)(1-b) = a + b - ab
30    Nand,      // NAND: 1 - (a * b)
31    Nor,       // NOR: 1 - max(a, b)
32    Xor,       // XOR: |a - b| or (a + b) - 2*a*b for soft version
33}
34
35#[derive(Clone, Copy, Debug)]
36pub enum ReduceOp {
37    Sum,
38    Max,
39    Mean,
40    Min,
41    Product, // Product reduction for FORALL quantifier
42}