Remove unneeded std::make_optional (#141567)

Fixes #ISSUE_NUMBER

Pull Request resolved: https://github.com/pytorch/pytorch/pull/141567
Approved by: https://github.com/albanD
This commit is contained in:
cyy
2024-11-28 00:05:21 +00:00
committed by PyTorch MergeBot
parent fea771dcce
commit 45ed7c13fa
35 changed files with 112 additions and 118 deletions

View File

@ -344,7 +344,7 @@ bool isResurrectable(THPVariable* self) {
// Check if this is hermetic. If it is, no resurrection.
if (tensor.unsafeGetTensorImpl()->pyobj_slot()->check_pyobj(
getPyInterpreter(), /*ignore_hermetic_tls=*/false) !=
std::make_optional((PyObject*)self)) {
(PyObject*)self) {
return false;
}
return true;
@ -452,7 +452,7 @@ static int THPVariable_subclass_clear(THPVariable* self) {
if (!self->cdata.unsafeIsBorrowed() &&
tensor.unsafeGetTensorImpl()->pyobj_slot()->check_pyobj(
getPyInterpreter(), /*ignore_hermetic_tls=*/false) ==
std::make_optional((PyObject*)self)) {
(PyObject*)self) {
// TODO: empirically, on OS X this assert appears to be untrue
// In test_py_tensors_multi_async_call - ProcessGroupRpcTestWithSpawn
// distributed/rpc/test_process_group_agent.py