Skip to content

Commit

Permalink
clang format, part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Liddell committed Feb 5, 2024
1 parent cef72c9 commit b826bec
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/Dialect/Torch/IR/TorchOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2763,13 +2763,15 @@ void AtenDeviceWithIndexOp::getCanonicalizationPatterns(
//===----------------------------------------------------------------------===//

OpFoldResult AtenTensorOp::fold(FoldAdaptor adaptor) {
// If a torch.aten.tensor op is initialized by a list with a constant, single element, fold it into a torch.vtensor.literal
// If a torch.aten.tensor op is initialized by a list with a constant, single
// element, fold it into a torch.vtensor.literal
auto resultTy = dyn_cast<ValueTensorType>(getType());
Type eTy = resultTy.getDtype();
ShapedType shapedTy = resultTy.toBuiltinTensor().clone(eTy);

SmallVector<int64_t> data;
if (matchPattern(getData(), m_TorchListOfConstantInts(data)) && data.size() == 1) {
if (matchPattern(getData(), m_TorchListOfConstantInts(data)) &&
data.size() == 1) {
Attribute attribute = IntegerAttr::get(eTy, data[0]);
return DenseElementsAttr::get(shapedTy, attribute);
}
Expand Down

0 comments on commit b826bec

Please sign in to comment.