phygnn.utilities.tf_utilities.mean_fill
- mean_fill(x)[source]
Fill NaN values in the input tensor with the mean of the non-NaN. If all values are NaN, fill with 0. This is assumed to be either a 4D or 5D tensor, with the trailing feature channel included.
- Parameters:
x (tf.Tensor) – Tensor with NaNs and shape (n_obs, spatial_1, spatial_2, n_features) or (n_obs, spatial_1, spatial_2, n_temporal, n_features)
- Returns:
x_filled (tf.Tensor) – Input tensor with NaN values filled with the mean of the non-NaN values or 0 if all values are NaN.
mask (tf.Tensor) – Mask of the input tensor where 1 is not NaN and 0 is NaN.