Following the recent changes in HLO->Linalg lowering, I’m able to almost fully bufferize a rather complex specification such as resnet without using code of my own.

However, one operation remains unconverted: `linalg.tensor_reshape`

(which is always applied in a trivial way, e.g. `tensor<1x112x112x64xf32> into tensor<112x112x64xf32>`

).

Here is an example of generated code where tensors subsist:

```
%536 = memref.tensor_load %535 : memref<1x112x112x64xf32>
%537 = linalg.tensor_reshape %536 [#map1, #map2, #map3] : tensor<1x112x112x64xf32> into tensor<112x112x64xf32>
%539 = memref.buffer_cast %537 : memref<112x112x64xf32>
```

Ideally, this should be replaced with:

```
%539 = memref.reshape %535 : memref<1x112x112x64xf32> into tensor<112x112x64xf32>
```

Is there some automated way of converting it, too?

I’m currently using a combination of `tf-opt --linalg-bufferize`

, which does almost all the work and `iree-opt --iree-codegen-hlo-to-linalg-on-tensors --iree-linalg-on-tensors-path`

to remove `linalg.pad_tensor`

. I’ve also tried `tf-opt --linalg-detensorize`

(it didn’t seem to do much).

D.