From 8f3f1e2accc84b2d59a0d9e54c88d99292bcd2a0 Mon Sep 17 00:00:00 2001 From: Vinayak Dev <104419489+vinayakdsci@users.noreply.github.com> Date: Tue, 8 Oct 2024 22:10:19 +0530 Subject: [PATCH] [docs] Remove call to `t()` in external param example. (#18706) Fixes https://github.com/iree-org/iree/issues/18564. The example in https://iree.dev/guides/ml-frameworks/pytorch/#using-external-parameters has an erroneous call to `t()` that actually transposes the underlying tensor instead of accessing it unmodified. This patch fixes this error, and the example now outputs a numerical match with the torch output. --- docs/website/docs/guides/ml-frameworks/pytorch.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/website/docs/guides/ml-frameworks/pytorch.md b/docs/website/docs/guides/ml-frameworks/pytorch.md index e80dec9e852d..54efe6ef2c58 100644 --- a/docs/website/docs/guides/ml-frameworks/pytorch.md +++ b/docs/website/docs/guides/ml-frameworks/pytorch.md @@ -355,8 +355,8 @@ linear_module = LinearModule(4,3) # Create a params dictionary. Note that the keys here match LinearModule's # attributes. We will use the saved safetensor file for use from the command # line. -wt = linear_module.weight.t().contiguous() -bias = linear_module.bias.t().contiguous() +wt = linear_module.weight.data.contiguous() +bias = linear_module.bias.data.contiguous() params = { "weight": wt, "bias": bias } save_file(params, "params.safetensors")