gorgonia.org/gorgonia@v0.9.17/api_gen.go (about) 1 package gorgonia 2 3 // Code generated by genapi, which is a API generation tool for Gorgonia. DO NOT EDIT. 4 5 // Abs performs a pointwise abs. 6 func Abs(a *Node) (*Node, error) { return unaryOpNode(newElemUnaryOp(absOpType, a), a) } 7 8 // Sign performs a pointwise sign. 9 func Sign(a *Node) (*Node, error) { return unaryOpNode(newElemUnaryOp(signOpType, a), a) } 10 11 // Ceil performs a pointwise ceil. 12 func Ceil(a *Node) (*Node, error) { return unaryOpNode(newElemUnaryOp(ceilOpType, a), a) } 13 14 // Floor performs a pointwise floor. 15 func Floor(a *Node) (*Node, error) { return unaryOpNode(newElemUnaryOp(floorOpType, a), a) } 16 17 // Sin performs a pointwise sin. 18 func Sin(a *Node) (*Node, error) { return unaryOpNode(newElemUnaryOp(sinOpType, a), a) } 19 20 // Cos performs a pointwise cos. 21 func Cos(a *Node) (*Node, error) { return unaryOpNode(newElemUnaryOp(cosOpType, a), a) } 22 23 // Exp performs a pointwise exp. 24 func Exp(a *Node) (*Node, error) { return unaryOpNode(newElemUnaryOp(expOpType, a), a) } 25 26 // Log performs a pointwise log. 27 func Log(a *Node) (*Node, error) { return unaryOpNode(newElemUnaryOp(lnOpType, a), a) } 28 29 // Log2 performs a pointwise log2. 30 func Log2(a *Node) (*Node, error) { return unaryOpNode(newElemUnaryOp(log2OpType, a), a) } 31 32 // Neg performs a pointwise neg. 33 func Neg(a *Node) (*Node, error) { return unaryOpNode(newElemUnaryOp(negOpType, a), a) } 34 35 // Square performs a pointwise square. 36 func Square(a *Node) (*Node, error) { return unaryOpNode(newElemUnaryOp(squareOpType, a), a) } 37 38 // Sqrt performs a pointwise sqrt. 39 func Sqrt(a *Node) (*Node, error) { return unaryOpNode(newElemUnaryOp(sqrtOpType, a), a) } 40 41 // Inverse performs a pointwise inverse. 42 func Inverse(a *Node) (*Node, error) { return unaryOpNode(newElemUnaryOp(inverseOpType, a), a) } 43 44 // InverseSqrt performs a pointwise inversesqrt. 45 func InverseSqrt(a *Node) (*Node, error) { return unaryOpNode(newElemUnaryOp(inverseSqrtOpType, a), a) } 46 47 // Cube performs a pointwise cube. 48 func Cube(a *Node) (*Node, error) { return unaryOpNode(newElemUnaryOp(cubeOpType, a), a) } 49 50 // Tanh performs a pointwise tanh. 51 func Tanh(a *Node) (*Node, error) { return unaryOpNode(newElemUnaryOp(tanhOpType, a), a) } 52 53 // Sigmoid performs a pointwise sigmoid. 54 func Sigmoid(a *Node) (*Node, error) { return unaryOpNode(newElemUnaryOp(sigmoidOpType, a), a) } 55 56 // Log1p performs a pointwise log1p. 57 func Log1p(a *Node) (*Node, error) { return unaryOpNode(newElemUnaryOp(log1pOpType, a), a) } 58 59 // Expm1 performs a pointwise expm1. 60 func Expm1(a *Node) (*Node, error) { return unaryOpNode(newElemUnaryOp(expm1OpType, a), a) } 61 62 // Softplus performs a pointwise softplus. 63 func Softplus(a *Node) (*Node, error) { return unaryOpNode(newElemUnaryOp(softplusOpType, a), a) } 64 65 // Add performs a pointwise add operation. 66 func Add(a, b *Node) (*Node, error) { return binOpNode(newElemBinOp(addOpType, a, b), a, b) } 67 68 // Sub performs a pointwise sub operation. 69 func Sub(a, b *Node) (*Node, error) { return binOpNode(newElemBinOp(subOpType, a, b), a, b) } 70 71 // HadamardProd performs a pointwise hadamardprod operation. 72 func HadamardProd(a, b *Node) (*Node, error) { return binOpNode(newElemBinOp(mulOpType, a, b), a, b) } 73 74 // HadamardDiv performs a pointwise hadamarddiv operation. 75 func HadamardDiv(a, b *Node) (*Node, error) { return binOpNode(newElemBinOp(divOpType, a, b), a, b) } 76 77 // Pow performs a pointwise pow operation. 78 func Pow(a, b *Node) (*Node, error) { return binOpNode(newElemBinOp(powOpType, a, b), a, b) } 79 80 // Lt performs a pointwise lt operation. 81 // retSame indicates if the data type of the return value should be the same as the input data type. It defaults to Bool otherwise. 82 func Lt(a, b *Node, retSame bool) (*Node, error) { 83 op := newElemBinOp(ltOpType, a, b) 84 op.retSame = retSame 85 return binOpNode(op, a, b) 86 } 87 88 // Gt performs a pointwise gt operation. 89 // retSame indicates if the data type of the return value should be the same as the input data type. It defaults to Bool otherwise. 90 func Gt(a, b *Node, retSame bool) (*Node, error) { 91 op := newElemBinOp(gtOpType, a, b) 92 op.retSame = retSame 93 return binOpNode(op, a, b) 94 } 95 96 // Lte performs a pointwise lte operation. 97 // retSame indicates if the data type of the return value should be the same as the input data type. It defaults to Bool otherwise. 98 func Lte(a, b *Node, retSame bool) (*Node, error) { 99 op := newElemBinOp(lteOpType, a, b) 100 op.retSame = retSame 101 return binOpNode(op, a, b) 102 } 103 104 // Gte performs a pointwise gte operation. 105 // retSame indicates if the data type of the return value should be the same as the input data type. It defaults to Bool otherwise. 106 func Gte(a, b *Node, retSame bool) (*Node, error) { 107 op := newElemBinOp(gteOpType, a, b) 108 op.retSame = retSame 109 return binOpNode(op, a, b) 110 } 111 112 // Eq performs a pointwise eq operation. 113 // retSame indicates if the data type of the return value should be the same as the input data type. It defaults to Bool otherwise. 114 func Eq(a, b *Node, retSame bool) (*Node, error) { 115 op := newElemBinOp(eqOpType, a, b) 116 op.retSame = retSame 117 return binOpNode(op, a, b) 118 } 119 120 // Ne performs a pointwise ne operation. 121 // retSame indicates if the data type of the return value should be the same as the input data type. It defaults to Bool otherwise. 122 func Ne(a, b *Node, retSame bool) (*Node, error) { 123 op := newElemBinOp(neOpType, a, b) 124 op.retSame = retSame 125 return binOpNode(op, a, b) 126 } 127 128 //Add performs a add. The operation is precomposed with a broadcast such that the shapes matches before operations commence. 129 func BroadcastAdd(a, b *Node, leftPattern, rightPattern []byte) (*Node, error) { 130 a2, b2, err := Broadcast(a, b, NewBroadcastPattern(leftPattern, rightPattern)) 131 if err != nil { 132 return nil, err 133 } 134 return Add(a2, b2) 135 } 136 137 //Sub performs a sub. The operation is precomposed with a broadcast such that the shapes matches before operations commence. 138 func BroadcastSub(a, b *Node, leftPattern, rightPattern []byte) (*Node, error) { 139 a2, b2, err := Broadcast(a, b, NewBroadcastPattern(leftPattern, rightPattern)) 140 if err != nil { 141 return nil, err 142 } 143 return Sub(a2, b2) 144 } 145 146 //HadamardProd performs a hadamardprod. The operation is precomposed with a broadcast such that the shapes matches before operations commence. 147 func BroadcastHadamardProd(a, b *Node, leftPattern, rightPattern []byte) (*Node, error) { 148 a2, b2, err := Broadcast(a, b, NewBroadcastPattern(leftPattern, rightPattern)) 149 if err != nil { 150 return nil, err 151 } 152 return HadamardProd(a2, b2) 153 } 154 155 //HadamardDiv performs a hadamarddiv. The operation is precomposed with a broadcast such that the shapes matches before operations commence. 156 func BroadcastHadamardDiv(a, b *Node, leftPattern, rightPattern []byte) (*Node, error) { 157 a2, b2, err := Broadcast(a, b, NewBroadcastPattern(leftPattern, rightPattern)) 158 if err != nil { 159 return nil, err 160 } 161 return HadamardDiv(a2, b2) 162 } 163 164 //Pow performs a pow. The operation is precomposed with a broadcast such that the shapes matches before operations commence. 165 func BroadcastPow(a, b *Node, leftPattern, rightPattern []byte) (*Node, error) { 166 a2, b2, err := Broadcast(a, b, NewBroadcastPattern(leftPattern, rightPattern)) 167 if err != nil { 168 return nil, err 169 } 170 return Pow(a2, b2) 171 } 172 173 //Lt performs a lt. The operation is precomposed with a broadcast such that the shapes matches before operations commence. 174 func BroadcastLt(a, b *Node, retSame bool, leftPattern, rightPattern []byte) (*Node, error) { 175 a2, b2, err := Broadcast(a, b, NewBroadcastPattern(leftPattern, rightPattern)) 176 if err != nil { 177 return nil, err 178 } 179 return Lt(a2, b2, retSame) 180 } 181 182 //Gt performs a gt. The operation is precomposed with a broadcast such that the shapes matches before operations commence. 183 func BroadcastGt(a, b *Node, retSame bool, leftPattern, rightPattern []byte) (*Node, error) { 184 a2, b2, err := Broadcast(a, b, NewBroadcastPattern(leftPattern, rightPattern)) 185 if err != nil { 186 return nil, err 187 } 188 return Gt(a2, b2, retSame) 189 } 190 191 //Lte performs a lte. The operation is precomposed with a broadcast such that the shapes matches before operations commence. 192 func BroadcastLte(a, b *Node, retSame bool, leftPattern, rightPattern []byte) (*Node, error) { 193 a2, b2, err := Broadcast(a, b, NewBroadcastPattern(leftPattern, rightPattern)) 194 if err != nil { 195 return nil, err 196 } 197 return Lte(a2, b2, retSame) 198 } 199 200 //Gte performs a gte. The operation is precomposed with a broadcast such that the shapes matches before operations commence. 201 func BroadcastGte(a, b *Node, retSame bool, leftPattern, rightPattern []byte) (*Node, error) { 202 a2, b2, err := Broadcast(a, b, NewBroadcastPattern(leftPattern, rightPattern)) 203 if err != nil { 204 return nil, err 205 } 206 return Gte(a2, b2, retSame) 207 } 208 209 //Eq performs a eq. The operation is precomposed with a broadcast such that the shapes matches before operations commence. 210 func BroadcastEq(a, b *Node, retSame bool, leftPattern, rightPattern []byte) (*Node, error) { 211 a2, b2, err := Broadcast(a, b, NewBroadcastPattern(leftPattern, rightPattern)) 212 if err != nil { 213 return nil, err 214 } 215 return Eq(a2, b2, retSame) 216 } 217 218 //Ne performs a ne. The operation is precomposed with a broadcast such that the shapes matches before operations commence. 219 func BroadcastNe(a, b *Node, retSame bool, leftPattern, rightPattern []byte) (*Node, error) { 220 a2, b2, err := Broadcast(a, b, NewBroadcastPattern(leftPattern, rightPattern)) 221 if err != nil { 222 return nil, err 223 } 224 return Ne(a2, b2, retSame) 225 }