def target_mask_op(data, pad_val=<NUM_LIT:0>):  
data_shape_size = data.get_shape().ndims<EOL>if data_shape_size == <NUM_LIT:3>:<EOL><INDENT>return tf.cast(tf.reduce_any(tf.not_equal(data, pad_val), axis=<NUM_LIT:2>), dtype=tf.int32)<EOL><DEDENT>elif data_shape_size == <NUM_LIT:2>:<EOL><INDENT>return tf.cast(tf.not_equal(data, pad_val), dtype=tf.int32)<EOL><DEDENT>elif data_shape_size == <NUM_LIT:1>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>" % (data_shape_size))<EOL><DEDENT>
Return tensor for mask, if input is ``tf.string``.