MCPcopy Index your code
hub / github.com/apache/tvm / get_mod

Function get_mod

tests/python/relax/test_codegen_cutlass.py:1050–1080  ·  view source on GitHub ↗
(residual_batch)

Source from the content-addressed store, hash-verified

1048 dtype = "float16"
1049
1050 def get_mod(residual_batch):
1051 with IRBuilder() as builder:
1052 with relax_builder.function():
1053 R.func_name("main")
1054 data = R.arg("data", R.Tensor(data_shape, dtype))
1055 weight = R.arg("weight", R.Tensor(weight_shape, dtype))
1056 bias = R.arg("bias", R.Tensor((1, 1, weight_shape[0]), dtype))
1057 residual = R.arg(
1058 "residual", R.Tensor((residual_batch, 1, 1, weight_shape[0]), dtype)
1059 )
1060
1061 with R.dataflow() as frame:
1062 output = R.emit(
1063 R.nn.conv2d(
1064 data,
1065 weight,
1066 out_dtype=dtype,
1067 padding=(1, 1),
1068 data_layout="NHWC",
1069 kernel_layout="OHWI",
1070 )
1071 )
1072 output = R.emit(output + bias)
1073 output = R.emit(R.nn.relu(output))
1074 output = R.emit(R.add(output, residual))
1075 R.output(output)
1076
1077 R.func_ret_value(frame.output_vars[0])
1078
1079 func = builder.get()
1080 return tvm.IRModule({"main": func})
1081
1082 low = -1
1083 high = 1

Callers 2

test_layer_normFunction · 0.70

Calls 11

IRBuilderClass · 0.90
TensorMethod · 0.80
dataflowMethod · 0.80
outputMethod · 0.80
functionMethod · 0.45
emitMethod · 0.45
conv2dMethod · 0.45
reluMethod · 0.45
addMethod · 0.45
getMethod · 0.45
layer_normMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…