tensorflow/mlir-hlo

Clarify pad legality

jpienaar opened this issue · 3 comments

Is

func.func public @main(%arg0: tensor<2x3xi8> loc(unknown), %arg1: tensor<i8> loc(unknown)) -> tensor<2x1xi8> {
    %0 = "mhlo.pad"(%arg0, %arg1) {edge_padding_high = dense<[0, -1]> : tensor<2xi64>, edge_padding_low = dense<[0, -1]> : tensor<2xi64>, interior_padding = dense<0> : tensor<2xi64>} : (tensor<2x3xi8>, tensor<i8>) -> tensor<2x1xi8> loc(#loc1)
    return %0 : tensor<2x1xi8> loc(#loc0)
  }

legal pad?

Came up in iree-org/iree#9296

@jpienaar
I am assuming that we are talking about the negative value of the padding. From MHLO's perpective, that seems legal: the absolute value indicates the number of elements to remove from the specified dimension.

Could you document it on the op?

Sorry that is not documented. Sure, I will do that.