Skip to content

Commit

Permalink
Use none as a default for optional tensors rather than an empty tensor.
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentMazare committed Sep 11, 2024
1 parent 8647136 commit 51b966b
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 51b966b

Please sign in to comment.