def preserve_channel_dim(func):
@wraps(func)<EOL>def wrapped_function(img, *args, **kwargs):<EOL><INDENT>shape = img.shape<EOL>result = func(img, *args, **kwargs)<EOL>if len(shape) == <NUM_LIT:3> and shape[-<NUM_LIT:1>] == <NUM_LIT:1> and len(result.shape) == <NUM_LIT:2>:<EOL><INDENT>result = np.expand_dims(result, axis=-<NUM_LIT:1>)<EOL><DEDENT>return result<EOL><DEDENT>return wrapped_function<EOL>
Preserve dummy channel dim.