Skip to content

Commit

Permalink
work-around upstream pytorch changing fromDLPack to take non-const po…
Browse files Browse the repository at this point in the history
…inter
  • Loading branch information
jeffdaily authored and Ted Themistokleous committed Jan 2, 2025
1 parent 51b7d1f commit c5b2940
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ struct ATenOperator {
c10::IValue i_value;
// Create the torch tensor from this DLPack no matter we need it or not below,
// so that the dlpack's deleter will be triggered when torch tensor is out of scope.
at::Tensor tensor = at::fromDLPack(dlpack);
// work-around upstream pytorch changing fromDLPack to take non-const pointer
at::Tensor tensor = at::fromDLPack(const_cast<DLManagedTensor*>(dlpack));
switch (elem_kinds[index]) {
case c10::TypeKind::TensorType: {
i_value = is_optional ? c10::IValue(c10::optional<at::Tensor>(tensor)) : c10::IValue(tensor);
Expand Down

0 comments on commit c5b2940

Please sign in to comment.