-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix issue #278 in relax.op.masked_fill #279
Conversation
MLC local ci setup.
This PR adds CI for Windows and macOS building, which may take 90-100 mins. Co-authored-by: Siyuan Feng <Hzfengsy@sjtu.edu.cn>
- Enable `groups` as parameters of `conv1d` - Update the output shape of conv2d.
This PR introduces Conv1dTranspose to relax. --------- Co-authored-by: Ubuntu <ubuntu@ip-172-31-15-248.us-west-2.compute.internal>
adding dtype argument when calling _ffi_api.full_like
python/tvm/relax/op/mask.py
Outdated
@@ -34,5 +34,5 @@ def masked_fill(x: Expr, mask: Expr, value: Expr): | |||
result : relax.Expr | |||
The filled tensor. | |||
""" | |||
values = _ffi_api.full_like(x, value) # type: ignore | |||
values = _ffi_api.full_like(x, value, x.struct_info.dtype) # type: ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here it’s better to use the Python interface of full_like
than the FFI interface, because the Python interface has clear semantics on the dtype, and the dtype can be None, which means being the same as the input dtype.
relax/python/tvm/relax/op/create.py
Lines 56 to 79 in 8ee979d
def full_like(x: Expr, fill_value: Expr, dtype: Optional[Union[str, DataType]] = None) -> Expr: | |
"""Construct a tensor such that | |
- its shape is the same as the input data tensor's shape, | |
- its value is filled with the input scalar fill value. | |
Parameters | |
---------- | |
x : relax.Expr | |
The input tensor, which provides the shape, and dtype | |
when the `dtype` field is not specified. | |
fill_value : relax.Expr | |
The value to fill. Must be a scalar tensor. | |
dtype : Optional[Union[str, DataType]] | |
The data type of the created tensor. | |
If dtype is not given, it will by default use the dtype of the input tensor. | |
Returns | |
------- | |
result : relax.Expr | |
The result tensor. | |
""" | |
return _ffi_api.full_like(x, fill_value, dtype) # type: ignore |
So here we can do from .create import full_like
, and use values = full_like(x, value)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your suggestion, please check the update.
Thanks @sbwww for the fix! Just merged the corresponding PR in apache/tvm. We have a routine-based synchronization with TVM Unity branch, and will bring that commit to this repo in the next round of sync. So please allow me to close this PR :-) |
It has now been brought in. |
adding dtype argument when calling _ffi_api.full_like