How to change the shape of type returned by `value.getType()`;
Open
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 736
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 15
Description
I'm adding a new Op to torch-mlir and i want to set a new shape for the result type which is a torch.vtensor() in build method. But it seems i can't change it. Is there any way to do this? Thanks a lot!
void MyOp::build(::mlir::OpBuilder& odsBuilder, ::mlir::OperationState& odsState,
Value input0, Value input1, Value weight0, Value weight1){
odsState.addOperands(input0);
odsState.addOperands(input1);
odsState.addOperands(weight0);
odsState.addOperands(weight1);
auto type = input0.getType();
// *** I want to change the shape of `type` here which is a torch.vtensor(). ***
odsState.addTypes(type);
odsState.addTypes(type);
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the MyOp::build method shown in the issue and inspect the MLIR/Torch type APIs used by input0.getType(). Determine how a result type with the requested torch.vtensor shape should be represented; done means both added result types have that intended shape.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, pytorch
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100