def _prelu_pattern(x): # MIL operation takes named inputs (instead of positional inputs). # Here `name` argument is MANDATORY. neg = mb.mul(x=x, y=-1, name="neg") relu1 = mb.relu(x=neg, name="relu1") # use any constant here to match, rank and shape will be verified in "is_var_constraint_satisifed" method mul = mb.mul(x=relu1, y=np.random.rand(2, 2, 2, 2), name="alpha_mul") relu2 = mb.relu(x=x, name="relu2") out = mb.add(x=relu2, y=mul, name="out_op") return out
def prog(x): x = mb.relu(x=x, name="relu") x = mb.transpose(x=x, perm=[0, 3, 1, 2], name="transpose") x = mb.reduce_mean(x=x, axes=[2, 3], keep_dims=False, name="reduce") x = mb.log(x=x, name="log") y = mb.add(x=1, y=2) return x
def relu_prog(input): out = mb.relu(x=input, name="output") return out