Как отметил Susmit в комментариях, можно использовать свертки.
import torch
import torch.nn.functional as F
import numpy as np
def dilute(data, order=1):
size = 1 + order * 2
weights = torch.ones((1, 1, size, size, size)) / (size ** 3)
weights = weights.to(torch.float32)
data = np.pad(data, order, mode='reflect')
data = torch.tensor(data, dtype=torch.float32)
data = data.view((1, 1, *data.shape))
data = F.conv3d(data, weights, stride=1)
return data