Skip to content

Commit

Permalink
Merge pull request #891 from LaurentMazare/opt-tensor-fix
Browse files Browse the repository at this point in the history
Use none as a default for optional tensors rather than an empty tensor.
  • Loading branch information
LaurentMazare committed Sep 12, 2024
2 parents 10ef423 + 51b966b commit 2687871
Show file tree
Hide file tree
Showing 2 changed files with 197 additions and 197 deletions.
2 changes: 1 addition & 1 deletion gen/gen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ module Func = struct
c10::optional<at::Layout>(static_cast<at::Layout>(%s)))"
arg_name
arg_name
| TensorOption -> Printf.sprintf "(%s ? *%s : torch::Tensor())" arg_name arg_name
| TensorOption -> Printf.sprintf "(%s ? ::std::optional<at::Tensor>(*%s) : ::std::nullopt)" arg_name arg_name
| Bool -> "(bool)" ^ arg_name
| IntList -> Printf.sprintf "torch::IntArrayRef(%s_data, %s_len)" arg_name arg_name
| IntListOption ->
Expand Down
Loading

0 comments on commit 2687871

Please sign in to comment.