function permute(tensor, axes) {
    const [permutedData, shape] = permute_data(tensor.data, tensor.dims, axes);
    return new Tensor(tensor.type, permutedData, shape);
}
Permutes a tensor according to the provided axes.
@param {any} tensor The input tensor to permute.
@param {Array} axes The axes to permute the tensor along.
@returns {Tensor} The permuted tensor.