@@ -581,55 +581,6 @@ const phi::DDim &GetValueDims(Value value) {
581
581
}
582
582
}
583
583
584
- #define OVERRIDE_OPERATOR (operator, api, other_type ) \
585
- value.def(#operator , [](Value self, other_type other) { \
586
- return paddle::dialect::api (self, other); \
587
- });
588
-
589
- #define OVERRIDE_OPERATOR_WITH_SCALE (operator , \
590
- other_type, \
591
- scale_value, \
592
- bias_value, \
593
- bias_after_scale) \
594
- value.def(#operator , [](Value self, other_type other) { \
595
- return paddle::dialect::scale ( \
596
- self, scale_value, bias_value, bias_after_scale); \
597
- });
598
-
599
- #define OVERRIDE_OPERATOR_FOR_EACH (operator , \
600
- api, \
601
- scale_value, \
602
- bias_value, \
603
- bias_after_scale) \
604
- OVERRIDE_OPERATOR (operator , api, Value) \
605
- OVERRIDE_OPERATOR_WITH_SCALE (operator , \
606
- int , \
607
- scale_value, \
608
- bias_value, \
609
- bias_after_scale) \
610
- OVERRIDE_OPERATOR_WITH_SCALE (operator , \
611
- float , \
612
- scale_value, \
613
- bias_value, \
614
- bias_after_scale) \
615
- OVERRIDE_OPERATOR_WITH_SCALE (operator , \
616
- double , \
617
- scale_value, \
618
- bias_value, \
619
- bias_after_scale)
620
-
621
- #define OVERRIDE_COMPARE_OP_WITH_FULL (operator, api, other_type ) \
622
- value.def(#operator , [](Value self, other_type other) { \
623
- auto rhs = \
624
- paddle::dialect::full (/* shape=*/ {}, other, GetValueDtype (self)); \
625
- return paddle::dialect::api (self, rhs); \
626
- });
627
-
628
- #define OVERRIDE_COMPARE_OP_FOR_EACH (operator, api ) \
629
- OVERRIDE_OPERATOR (operator , api, Value) \
630
- OVERRIDE_COMPARE_OP_WITH_FULL (operator , api, int ) \
631
- OVERRIDE_COMPARE_OP_WITH_FULL (operator , api, float ) \
632
- OVERRIDE_COMPARE_OP_WITH_FULL (operator , api, double )
633
584
void BindValue (py::module *m) {
634
585
py::class_<Value> value (*m, " Value" , R"DOC(
635
586
Value class represents the SSA value in the IR system. It is a directed edge
@@ -787,23 +738,9 @@ void BindValue(py::module *m) {
787
738
print_stream << " )" ;
788
739
return print_stream.str ();
789
740
})
790
- .def (" __neg__" ,
791
- [](Value self) {
792
- return paddle::dialect::scale (self, -1.0 , 0.0 , true );
793
- })
794
741
.def (" is_same" , &Value::operator ==)
795
742
.def (" hash" , [](Value self) { return std::hash<pir::Value>{}(self); })
796
743
.def (" __repr__" , &Value2String);
797
- // For basaic operators
798
- OVERRIDE_OPERATOR_FOR_EACH (__add__, add, 1.0 , other, true );
799
- OVERRIDE_OPERATOR_FOR_EACH (__sub__, subtract, 1.0 , -1.0 * other, true );
800
- OVERRIDE_OPERATOR_FOR_EACH (__mul__, multiply, other, 0.0 , false );
801
- OVERRIDE_OPERATOR_FOR_EACH (__truediv__, divide, 1.0 / other, 0.0 , false );
802
- // For compare opeartors
803
- OVERRIDE_COMPARE_OP_FOR_EACH (__lt__, less_than);
804
- OVERRIDE_COMPARE_OP_FOR_EACH (__le__, less_equal);
805
- OVERRIDE_COMPARE_OP_FOR_EACH (__gt__, greater_than);
806
- OVERRIDE_COMPARE_OP_FOR_EACH (__ge__, greater_equal);
807
744
}
808
745
809
746
void BindOpOperand (py::module *m) {
0 commit comments