Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions aten/src/ATen/core/ivalue.h
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,11 @@ struct CAFFE2_API WeakIValue final {
std::swap(tag, rhs.tag);
}

bool isSameIdentity(const WeakIValue& rhs) const {
return payload.as_int == rhs.payload.as_int && tag == rhs.tag &&
is_intrusive_ptr == rhs.is_intrusive_ptr;
}

IValue lock() const {
if (!is_intrusive_ptr) {
return IValue(payload, tag, false);
Expand Down
2 changes: 1 addition & 1 deletion torch/csrc/jit/tracer.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ struct TORCH_API TracingState

struct WeakIValueEq {
bool operator()(const WeakIValue& t1, const WeakIValue& t2) const {
return t1.lock().isSameIdentity(t2.lock());
return t1.isSameIdentity(t2);
}
};

Expand Down