Skip to content

Commit

Permalink
Fix lifetime issue (#55)
Browse files Browse the repository at this point in the history
Fixed lifetime issue with regards to std::optional
  • Loading branch information
josel-amd authored Jun 20, 2024
1 parent c528161 commit bb0b929
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/Conversion/XTenNNToTorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,14 @@ std::optional<ValueRange> resizeToTorch(ResizeOp op, ResizeOp::Adaptor adaptor,

auto scalesAttr = adaptor.getScales();
// Create a constant for the scales
auto denseScales = DenseElementsAttr::get(RankedTensorType::get({(long)scalesAttr.size()}, rewriter.getF32Type()), scalesAttr);
auto scalesConst = rewriter.create<Torch::ValueTensorLiteralOp>(loc,
Torch::ValueTensorType::get(op->getContext(), {scalesAttr.size()}, rewriter.getF32Type()),
denseScales);
auto shape =
llvm::SmallVector<int64_t>{static_cast<int64_t>(scalesAttr.size())};
auto denseScales = DenseElementsAttr::get(
RankedTensorType::get(shape, rewriter.getF32Type()), scalesAttr);
auto valueTensorType = Torch::ValueTensorType::get(op->getContext(), shape,
rewriter.getF32Type());
auto scalesConst = rewriter.create<Torch::ValueTensorLiteralOp>(
loc, valueTensorType, denseScales);

// Operands in order : X - roi - scales - sizes
// roi and sizes are None because they are not supported by the xten representation of resize
Expand Down

0 comments on commit bb0b929

Please sign in to comment.