MCPcopy Create free account
hub / github.com/apache/tvm / conv1d

Method conv1d

tests/python/relax/test_transform_legalize_ops_nn.py:49–65  ·  view source on GitHub ↗
(A: T.Buffer((T.int64(2), T.int64(128), T.int64(28)), "float32"), B: T.Buffer((T.int64(64), T.int64(16), T.int64(3)), "float32"), group_conv1d_ncw: T.Buffer((T.int64(2), T.int64(64), T.int64(13)), "float32"))

Source from the content-addressed store, hash-verified

47
48 @T.prim_func(private=True, s_tir=True)
49 def conv1d(A: T.Buffer((T.int64(2), T.int64(128), T.int64(28)), "float32"), B: T.Buffer((T.int64(64), T.int64(16), T.int64(3)), "float32"), group_conv1d_ncw: T.Buffer((T.int64(2), T.int64(64), T.int64(13)), "float32")):
50 T.func_attr({"tirx.noalias": True})
51 pad_temp = T.sblock_alloc_buffer((T.int64(2), T.int64(128), T.int64(30)))
52 for i0, i1, i2 in T.grid(T.int64(2), T.int64(128), T.int64(30)):
53 with T.sblock("pad_temp"):
54 v_i0, v_i1, v_i2 = T.axis.remap("SSS", [i0, i1, i2])
55 T.reads(A[v_i0, v_i1, v_i2 - T.int64(1)])
56 T.writes(pad_temp[v_i0, v_i1, v_i2])
57 pad_temp[v_i0, v_i1, v_i2] = T.if_then_else(T.int64(1) <= v_i2 and v_i2 < T.int64(29), A[v_i0, v_i1, v_i2 - T.int64(1)], T.float32(0))
58 for nn, ff, yy, rc, ry in T.grid(T.int64(2), T.int64(64), T.int64(13), T.int64(16), T.int64(3)):
59 with T.sblock("group_conv1d_ncw"):
60 v_nn, v_ff, v_yy, v_rc, v_ry = T.axis.remap("SSSRR", [nn, ff, yy, rc, ry])
61 T.reads(pad_temp[v_nn, v_ff // T.int64(8) * T.int64(16) + v_rc, v_yy * T.int64(2) + v_ry * T.int64(2)], B[v_ff, v_rc, v_ry])
62 T.writes(group_conv1d_ncw[v_nn, v_ff, v_yy])
63 with T.init():
64 group_conv1d_ncw[v_nn, v_ff, v_yy] = T.float32(0)
65 group_conv1d_ncw[v_nn, v_ff, v_yy] = group_conv1d_ncw[v_nn, v_ff, v_yy] + pad_temp[v_nn, v_ff // T.int64(8) * T.int64(16) + v_rc, v_yy * T.int64(2) + v_ry * T.int64(2)] * B[v_ff, v_rc, v_ry]
66 # fmt: on
67
68 mod = LegalizeOps()(Conv1d)

Callers 15

_conv1d_implMethod · 0.80
conv1dFunction · 0.80
forwardMethod · 0.80
conv1dFunction · 0.80
forwardMethod · 0.80
mainMethod · 0.80
mainMethod · 0.80
mainMethod · 0.80
forwardMethod · 0.80
mainMethod · 0.80
mainMethod · 0.80
forwardFunction · 0.80

Calls 2

remapMethod · 0.80
initMethod · 0.45

Tested by

no test coverage detected