Will this MAPE implementation work for multidimensional output? I'm currently working on a CNN problem where the output is a 60x59 array of numerical values. I want to verify if the mean absolute percentage error (MAPE) function I'm employing will properly consider the error by matching each corresponding point to the true value, as opposed to unexpected behaviour. Will this formulation work?

def percent_mean_absolute_error(y_true, y_pred):
    if not K.is_tensor(y_pred):
        y_pred = K.constant(y_pred)
    y_true = K.cast(y_true, y_pred.dtype)
    diff = K.mean(K.abs((y_pred - y_true)) / K.mean(K.clip(K.abs(y_true),
                                                           K.epsilon(),
                                                           None)))
    return 100. * K.mean(diff)


K here is keras.backend. All I want to know is if this function properly considers the error by mapping the function properly from point to point from the input to the output?
You can either directly use the mean absolute percentage error (MAPE) function in Keras API for TensorFlow or use that function to test your custom function. 

tf.keras.losses.MAPE code is avaible in the TensorFlow GitHub repo:

def mean_absolute_percentage_error(y_true, y_pred):  
  y_pred = ops.convert_to_tensor(y_pred)
  y_true = math_ops.cast(y_true, y_pred.dtype)
  diff = math_ops.abs(
      (y_true - y_pred) / K.maximum(math_ops.abs(y_true), K.epsilon()))
  return 100. * K.mean(diff, axis=-1)