From 575b0d96d753f446c130f87821dce3fbdefcb2ec Mon Sep 17 00:00:00 2001 From: Vidush SInghal Date: Thu, 28 Jul 2022 14:33:25 -0400 Subject: [PATCH] edits --- include/torch-mlir/Dialect/Torch/Utils/TorchUpstream.h | 4 ++-- lib/Conversion/TorchToLinalg/IndirectDataMovement.cpp | 10 ++++------ lib/Conversion/TorchToMhlo/GatherOp.cpp | 9 +++++---- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/include/torch-mlir/Dialect/Torch/Utils/TorchUpstream.h b/include/torch-mlir/Dialect/Torch/Utils/TorchUpstream.h index 9f002a7282d3..d6bc0a699172 100644 --- a/include/torch-mlir/Dialect/Torch/Utils/TorchUpstream.h +++ b/include/torch-mlir/Dialect/Torch/Utils/TorchUpstream.h @@ -154,8 +154,8 @@ enum MemoryFormat { enum Layout { Strided, Sparse, SparseCsr, Mkldnn, NumOptions }; //===----------------------------------------------------------------------===// -// Possible value for `EmbeddingBag Mode` argument for Embedding bag ops. -// Source: +// Possible value for `EmbeddingBag Mode` argument for Embedding bag ops. +// Source: // https://github.com/llvm/torch-mlir/blob/main/include/torch-mlir/Dialect/Torch/Utils/TorchUpstream.h //===-----------------------------------------------------------------------===// enum EmbeddingBagMode { MODE_SUM, MODE_MEAN, MODE_MAX }; diff --git a/lib/Conversion/TorchToLinalg/IndirectDataMovement.cpp b/lib/Conversion/TorchToLinalg/IndirectDataMovement.cpp index 2c4d874d5a56..45b6710af4a0 100644 --- a/lib/Conversion/TorchToLinalg/IndirectDataMovement.cpp +++ b/lib/Conversion/TorchToLinalg/IndirectDataMovement.cpp @@ -308,8 +308,8 @@ class ConvertAtenEmbeddingBagPaddingIdxOp indicesLength = getDimOp(rewriter, loc, indices, 0); } else { return rewriter.notifyMatchFailure( - op,"Unimplemented: include last offset is not yet " - "supported for EmbeddingBag."); + op, "Unimplemented: include last offset is not yet " + "supported for EmbeddingBag."); } Value embeddingBagResult = @@ -423,12 +423,10 @@ class ConvertAtenEmbeddingBagPaddingIdxOp "Unimplemented: Mean mode is not supported yet for EmbeddingBag."); } else if (modeInt == torch_upstream::EmbeddingBagMode::MODE_MAX) { return rewriter.notifyMatchFailure( - op, - "Unimplemented: Max mode is not supported yet for EmbeddingBag."); + op, "Unimplemented: Max mode is not supported yet for EmbeddingBag."); } else { return rewriter.notifyMatchFailure( - op, - "Unimplemented: Unknown mode encountered for EmbeddingBag."); + op, "Unimplemented: Unknown mode encountered for EmbeddingBag."); } } }; diff --git a/lib/Conversion/TorchToMhlo/GatherOp.cpp b/lib/Conversion/TorchToMhlo/GatherOp.cpp index 05b38b9cca3d..c93de54ebd20 100644 --- a/lib/Conversion/TorchToMhlo/GatherOp.cpp +++ b/lib/Conversion/TorchToMhlo/GatherOp.cpp @@ -109,11 +109,12 @@ class ConvertAtenOp : public OpConversionPattern { ConversionPatternRewriter &rewriter) const override; }; -// Ref: https://pytorch.org/docs/stable/generated/torch.nn.functional.embedding.html +// Ref: +// https://pytorch.org/docs/stable/generated/torch.nn.functional.embedding.html // padding_idx (int, optional) -// – If specified, the entries at padding_idx do not contribute to the gradient; -// therefore, the embedding vector at padding_idx is not updated during training, -// i.e. it remains as a fixed “pad”. +// – If specified, the entries at padding_idx do not contribute to the +// gradient; therefore, the embedding vector at padding_idx is not updated +// during training, i.e. it remains as a fixed “pad”. // scale_grad_by_freq (boolean, optional) // – If given, this will scale gradients by the inverse of frequency of the // words in the mini-batch. Default False.