Skip to content

Commit

Permalink
fix_pad2d
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxiaohehe001 committed Jan 11, 2022
1 parent 63c4c0e commit 7449cf1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
4 changes: 2 additions & 2 deletions lite/backends/metal/metal_kernel/texture/Pad2d.metal
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ kernel void pad2d(texture2d_array<ftype, access::read> inTexture[[texture(0)]],
if (gid.x >= outTexture.get_width() || gid.y >= outTexture.get_height() ||
gid.z >= outTexture.get_array_size())
return;
uint x = gid.x - pm.paddingLeft;
uint y = gid.y - pm.paddingTop;
int x = gid.x - pm.paddingLeft;
int y = gid.y - pm.paddingTop;
if (pm.mode == 0) {
if (x < 0 || y < 0 || x >= inTexture.get_width() || y >= inTexture.get_height()) {
outTexture.write(ftype4(pm.padValue), uint2(gid.xy), gid.z);
Expand Down
11 changes: 1 addition & 10 deletions lite/tests/unittest_py/op/test_pad2d_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,7 @@ def sample_predictor_configs(self):
return self.get_predictor_configs(), ["pad2d"], (atol, rtol)

def add_ignore_pass_case(self):
def teller1(program_config, predictor_config):
mode = program_config.ops[0].attrs["mode"]
if predictor_config.target() == TargetType.Metal:
if mode == "reflect" or mode == "edge":
return True

self.add_ignore_check_case(
teller1, IgnoreReasons.ACCURACY_ERROR,
"The op output has diff in a specific case. We need to fix it as soon as possible."
)
pass

def test(self, *args, **kwargs):
self.run_and_statis(quant=False, max_examples=25)
Expand Down

0 comments on commit 7449cf1

Please sign in to comment.