MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / tensor__ge__method

Function tensor__ge__method

paddle/fluid/pybind/eager_math_op_patch.cc:1001–1092  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

999 }
1000 }
1001
1002 // 3. calculation
1003 VLOG(6) << "Calling divide_ad_func in tensor__rdiv__method";
1004 {
1005 eager_gil_scoped_release guard;
1006 ret = divide_ad_func(other_tensor, self_tensor);
1007 }
1008 return ToPyObject(ret);
1009 }
1010 EAGER_CATCH_AND_THROW_RETURN_NULL
1011}
1012
1013static PyObject* tensor__gt__method(TensorObject* self,
1014 PyObject* args,
1015 PyObject* kwargs) {
1016 phi::RecordEvent pythonc_record_event(
1017 "__gt__ pybind_patch_func", phi::TracerEventType::UserDefined, 1);
1018
1019 EAGER_TRY
1020 VLOG(4) << "Running Eager tensor__gt__method";
1021
1022 SetPythonStack();
1023
1024 // Set Device ID
1025 auto place = egr::Controller::Instance().GetExpectedPlace();
1026 SetDevice(place);
1027
1028 Tensor ret;
1029 Tensor self_tensor = self->tensor;
1030 PyObject* other_obj = PyTuple_GET_ITEM(args, 0);
1031
1032 // 1. scalar exists cases
1033 // there is no scalar function for __gt__ now
1034 if (PyFloat_Check(other_obj) || PyCheckInteger(other_obj) ||
1035 IsNumpyType(other_obj)) {
1036 if (PyFloat_Check(other_obj)) {
1037 if (_supported_int_dtype_.find(self_tensor.dtype()) !=
1038 _supported_int_dtype_.end()) {
1039 eager_gil_scoped_release guard;
1040 self_tensor = cast_ad_func(self_tensor, DataType::FLOAT32);
1041 }
1042 } else if (PyCheckInteger(other_obj) &&
1043 self_tensor.dtype() == DataType::BOOL) {
1044 eager_gil_scoped_release guard;
1045 self_tensor = cast_ad_func(self_tensor, DataType::INT64);
1046 }
1047 } else if (PyComplex_Check(other_obj)) {
1048 if (is_support_complex(self_tensor.dtype()) == false) {
1049 eager_gil_scoped_release guard;
1050 self_tensor = cast_ad_func(
1051 self_tensor, promoteTypes(self_tensor.dtype(), DataType::COMPLEX64));
1052 }
1053 }
1054
1055 // 2. create or get tensor for other_obj
1056 Tensor other_tensor;
1057 if (PyCheckTensor(other_obj)) {
1058 auto& self_tensor_ref_addr = self->tensor;

Callers

nothing calls this directly

Calls 15

SetPythonStackFunction · 0.85
InstanceFunction · 0.85
is_support_complexFunction · 0.85
promoteTypesFunction · 0.85
PyCheckTensorFunction · 0.85
InputsContainDistTensorFunction · 0.85
CastPyArg2ScalarFunction · 0.85
GetExpectedPlaceMethod · 0.80
SetDeviceFunction · 0.70
PyCheckIntegerFunction · 0.70
IsNumpyTypeFunction · 0.70

Tested by

no test coverage detected