Skip to content

Commit

Permalink
[docs] Remove call to t() in external param example. (#18706)
Browse files Browse the repository at this point in the history
Fixes #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.
  • Loading branch information
vinayakdsci authored Oct 8, 2024
1 parent e8ab5f8 commit 8f3f1e2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/website/docs/guides/ml-frameworks/pytorch.md
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit 8f3f1e2

Please sign in to comment.