Skip to content

Onehot and optional<int64_t> for JIT#15235

Closed
zasdfgbnm wants to merge 13 commits intopytorch:masterfrom
zasdfgbnm:onehot-jit
Closed

Onehot and optional<int64_t> for JIT#15235
zasdfgbnm wants to merge 13 commits intopytorch:masterfrom
zasdfgbnm:onehot-jit

Conversation

@zasdfgbnm
Copy link
Collaborator

cc: @zou3519
Follow up of: #15208

@facebook-github-bot facebook-github-bot added the oncall: jit Add this issue/PR to JIT oncall triage queue label Dec 14, 2018
@zasdfgbnm zasdfgbnm closed this Dec 15, 2018
@zasdfgbnm
Copy link
Collaborator Author

Close this and in favor of #15256

facebook-github-bot pushed a commit that referenced this pull request Jan 21, 2019
Summary:
This PR does three things:

~~Allow `int64_t?` in function schema,  which provide an elegant way of implementing null-able int arguments, as discussed in #15208 (review)

~~Originally implemented in #15235

~~Example:~~

```yaml
- func: myop(Tensor self, int64_t? dim=None) -> Tensor
  variants: function
```

~~cc: zou3519~~

Edit: implemented in #15234

Previously tried in #12064. There was a problem that C++ does not have kwarg support, which makes it confusing to know whether `unique(t, 1)` actually means `unique(t, dim=1)` or `unique(t, sorted=1)`.

Now I think I have a better idea on how to implement this: there are two ATen operators: `unique` and `unique_dim`. `unique` has the same signature as in python, and exported to both python and C++. `unique_dim` has signature `unique_dim(tensor, dim, sorted=False, return_inverse=False)`, and only exported to C++, which could be used more naturally for a C++ user.

Differential Revision: D13540278

Pulled By: wanchaol

fbshipit-source-id: 3768c76a90b0881f565a1f890459ebccbdfe6ecd
zdevito pushed a commit to zdevito/ATen that referenced this pull request Jan 21, 2019
Summary:
This PR does three things:

~~Allow `int64_t?` in function schema,  which provide an elegant way of implementing null-able int arguments, as discussed in pytorch/pytorch#15208 (review)

~~Originally implemented in pytorch/pytorch#15235

~~Example:~~

```yaml
- func: myop(Tensor self, int64_t? dim=None) -> Tensor
  variants: function
```

~~cc: zou3519~~

Edit: implemented in pytorch/pytorch#15234

Previously tried in pytorch/pytorch#12064. There was a problem that C++ does not have kwarg support, which makes it confusing to know whether `unique(t, 1)` actually means `unique(t, dim=1)` or `unique(t, sorted=1)`.

Now I think I have a better idea on how to implement this: there are two ATen operators: `unique` and `unique_dim`. `unique` has the same signature as in python, and exported to both python and C++. `unique_dim` has signature `unique_dim(tensor, dim, sorted=False, return_inverse=False)`, and only exported to C++, which could be used more naturally for a C++ user.

Differential Revision: D13540278

Pulled By: wanchaol

fbshipit-source-id: 3768c76a90b0881f565a1f890459ebccbdfe6ecd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

oncall: jit Add this issue/PR to JIT oncall triage queue open source

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants