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 committed Mar 28, 2024
1 parent c0256d4 commit e04065c
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,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 e04065c

Please sign in to comment.