#ifndef PD_OPS #define PD_OPS include "mlir/Interfaces/InferTypeOpInterface.td" include "mlir/Interfaces/LoopLikeInterface.td" include "mlir/IR/OpBase.td" include "paddle/infrt/dialect/pd_op_base.td" def PD_FeedOp : PD_Op<"feed", [NoSideEffect]> { let summary = "Feed Op"; let description = [{ Feed a tensor into the model. }]; let arguments = (ins); let results = (outs PD_Tensor:$out); let assemblyFormat = [{ `(` `)` attr-dict `:` type($out) }]; } def PD_FetchOp : PD_Op<"fetch", [Terminator]> { let summary = "fetch Op"; let description = [{ Fetch tensor from the graph. }]; let arguments = (ins Variadic:$inputs); } def PD_GraphOp : PD_Op<"graph", [SingleBlockImplicitTerminator<"FetchOp">]> { let summary = "paddle graph Op"; let description = [{ Describe a paddle graph or subgraph. }]; let regions = (region SizedRegion<1>:$body); let arguments = (ins Variadic:$inputs); let results = (outs Variadic:$outputs); } def PD_ConstantOp : PD_Op<"Constant", [NoSideEffect, ConstantLike, DeclareOpInterfaceMethods, AllTypesMatch<["value", "output"]>]> { let summary = "constant Op"; let description = [{}]; let arguments = (ins ElementsAttr:$value); let results = (outs PD_Tensor:$output); let hasFolder = 1; let builders = [ OpBuilder<"OpBuilder &builder, OperationState &state, Attribute value">, ]; } def PD_AbsOp : PD_Op<"Abs", [NoSideEffect, SameOperandsAndResultType]> { let summary = "Computes the absolute value of a tensor"; let description = [{ }]; let arguments = (ins PD_Tensor:$x); let results = (outs PD_Tensor:$y); } def PD_SqrtOp : PD_Op<"sqrt", [NoSideEffect, SameOperandsAndResultType]> { let summary = "Computes the sqrt value of a tensor"; let description = [{ }]; let arguments = (ins PD_Tensor:$x); let results = (outs PD_Tensor:$y); } def PD_ReluOp : PD_Op<"Relu", [NoSideEffect, SameOperandsAndResultType]> { let summary = "Computes the Relu of a tensor"; let description = [{ }]; let arguments = (ins PD_Tensor:$x); let results = (outs PD_Tensor:$y); let hasCanonicalizer = 1; } def PD_Relu6Op : PD_Op<"Relu6", [NoSideEffect, SameOperandsAndResultType]> { let summary = "Computes the Relu6 of a tensor"; let description = [{ }]; let arguments = (ins PD_Tensor:$x); let results = (outs PD_Tensor:$y); } def PD_ElementwiseAdd : PD_Op<"ElementwiseAdd", [NoSideEffect, Commutative, DeclareOpInterfaceMethods]> { let summary = "ElementwiseAdd Op"; let description = [{ }]; let arguments = (ins PD_Tensor:$x, PD_Tensor:$y, DefaultValuedAttr:$axis); let results = (outs PD_Tensor:$out); let hasCanonicalizer = 1; let hasFolder = 1; } def PD_ElementwiseSub : PD_Op<"ElementwiseSub", [NoSideEffect, DeclareOpInterfaceMethods]> { let summary = "ElementwiseSub Op"; let description = [{ }]; let arguments = (ins PD_Tensor:$x, PD_Tensor:$y, DefaultValuedAttr:$axis); let results = (outs PD_Tensor:$out); } def PD_ElementwiseMul : PD_Op<"ElementwiseMul", [NoSideEffect, Commutative, DeclareOpInterfaceMethods]> { let summary = "ElementwiseMul Op"; let description = [{ }]; let arguments = (ins PD_Tensor:$x, PD_Tensor:$y, DefaultValuedAttr:$axis); let results = (outs PD_Tensor:$out); } def PD_ElementwiseDiv : PD_Op<"ElementwiseDiv", [NoSideEffect, DeclareOpInterfaceMethods]> { let summary = "ElementwiseDiv Op"; let description = [{ }]; let arguments = (ins PD_Tensor:$x, PD_Tensor:$y, DefaultValuedAttr:$axis); let results = (outs PD_Tensor:$out); } def PD_MatmulOp : PD_Op<"Matmul", [NoSideEffect]> { let summary = "Computes the matrix mulplication result of two tensors"; let description = [{ }]; let arguments = (ins PD_Tensor:$x, PD_Tensor:$y, DefaultValuedAttr:$transpose_x, DefaultValuedAttr:$transpose_y, DefaultValuedAttr:$alpha); let results = (outs PD_Tensor:$out); //let hasCanonicalizer = 1; } def PD_MulOp : PD_Op<"mul", [NoSideEffect, DeclareOpInterfaceMethods]> { let summary = "paddle mul op"; let description = [{}]; let arguments = (ins PD_Tensor:$x, PD_Tensor:$y); let results = (outs PD_Tensor:$out); //let hasCanonicalizer = 1; } def PD_Conv2dOp : PD_Op<"conv2d", [NoSideEffect]> { let summary = "paddle conv2d operation"; let description = [{ }]; let arguments = (ins PD_Tensor:$Input, PD_Tensor:$Filter, PD_Tensor:$Bias); let results = (outs PD_Tensor:$Output); //let hasCanonicalizer = 1; } def PD_BatchNormOp : PD_Op<"batch_norm", [NoSideEffect]> { let summary = "paddle batch_norm operation"; let description = [{ }]; let arguments = (ins PD_Tensor:$X, PD_Tensor:$Scale, PD_Tensor:$Bias, PD_Tensor:$Mean, PD_Tensor:$Variance, DefaultValuedAttr:$epsilon); let results = (outs PD_Tensor:$Y); let hasCanonicalizer = 1; } def PD_FusedFC : PD_Op<"FC", [NoSideEffect]> { let summary = "Computes the Fully Connected result of two tensors"; let description = [{ }]; let arguments = (ins PD_Tensor:$input, PD_Tensor:$w, PD_Tensor:$bias, DefaultValuedAttr:$in_num_col_dims); let results = (outs PD_Tensor:$out); } def PD_FusedRepeatedFCRelu : PD_Op<"RepeatedFCRelu", [SameVariadicOperandSize, NoSideEffect]> { let summary = ""; let description = [{ }]; let arguments = (ins PD_Tensor:$input, Variadic:$w, Variadic:$bias); let results = (outs PD_Tensor:$out); let hasCanonicalizer = 1; } #endif // PD_OPS