Performance issue with Explorer, Nx, and their combination

These are the versions used in this test:

Mix.install(
  [
    {:explorer, "~>0.5.6"},
    {:nx, "~> 0.5.2"},
    {:exla, "~> 0.5.2"},
    {:benchee, "~> 1.1.0"}
  ],
  system_env: [
    XLA_TARGET: "cuda118"
  ]
)

Before I was using Explorer 0.5.2 and Nx 0.5.1 and the results were very similar.

The inputs are random tensors or a random series.

rand_tensor_s16
#Nx.Tensor<
  s16[1000000]
  EXLA.Backend<cuda:0, 0.3848215277.360316982.67444>
  [6899, 2127, 2266, 5280, 6570, 4454, 9774, 5811, 2073, 391, 4742, 0, 5959, 535, 5421, 4487, 6503, 9878, 136, 3112, 7397, 4534, 9984, 4255, 7582, 4878, 3731, 840, 1090, 1739, 9907, 2214, 4650, 1645, 3259, 7433, 2875, 1216, 6472, 9170, 4651, 2634, 8160, 8559, 9748, 7056, 1912, 218, 5767, 4991, ...]
>
rand_series
#Explorer.Series<
  Polars[1000000]
  integer [593, 67, 63, 147, 3108, 143, 4173, 2146, 5643, 7, 1282, 47740, 502, 12066, 24226, 3866,
   1551, 16989, 2352, 640, 1419, 35244, 16448, 19726, 474, 9537, 6013, 6554, 13, 6, 93, 71, 200,
   1831, 27114, 35652, 562, 1252, 350, 8696, 1376, 146, 84409, 88, 232, 140230, 257, 1633, 2373,
   129, ...]
>

This is the tensor after convertion from series:

Explorer.Series.to_tensor(rand_series)
#Nx.Tensor<
  s64[1000000]
  EXLA.Backend<cuda:0, 0.3848215277.360316982.67467>
  [593, 67, 63, 147, 3108, 143, 4173, 2146, 5643, 7, 1282, 47740, 502, 12066, 24226, 3866, 1551, 16989, 2352, 640, 1419, 35244, 16448, 19726, 474, 9537, 6013, 6554, 13, 6, 93, 71, 200, 1831, 27114, 35652, 562, 1252, 350, 8696, 1376, 146, 84409, 88, 232, 140230, 257, 1633, 2373, 129, ...]
>

Results increasing warmup and time to 5 sec.

Operating System: Linux
CPU Information: AMD Ryzen 9 3900X 12-Core Processor
Number of Available Cores: 24
Available memory: 31.24 GB
Elixir 1.14.2
Erlang 25.2

Benchmark suite executing with the following configuration:
warmup: 5 s
time: 5 s
memory time: 0 ns
reduction time: 0 ns
parallel: 1
inputs: none specified
Estimated total run time: 1.33 min

Benchmarking converting_series_to_nx ...
Benchmarking explorer_mean ...
Benchmarking nx_mean_of_series ...
Benchmarking nx_mean_s16 ...
Benchmarking nx_mean_s32 ...
Benchmarking nx_mean_s64 ...
Benchmarking nx_series_with_deftransform ...
Benchmarking pre_converting_series_to_nx_nx_mean ...

Name                                          ips        average  deviation         median         99th %
converting_series_to_nx                   74.30 K       13.46 μs    ±44.85%       13.56 μs       15.17 μs
nx_mean_s16                                6.96 K      143.59 μs    ±25.35%      138.99 μs      184.70 μs
nx_mean_s32                                6.09 K      164.33 μs    ±21.69%      161.64 μs      212.03 μs
nx_mean_s64                                5.02 K      199.06 μs    ±20.14%      188.72 μs      267.11 μs
explorer_mean                              1.31 K      763.56 μs     ±0.53%      762.62 μs      770.92 μs
pre_converting_series_to_nx_nx_mean      0.0110 K    90947.54 μs    ±13.22%    94835.72 μs   104831.06 μs
nx_series_with_deftransform              0.0109 K    91932.58 μs    ±12.77%   100133.80 μs   103927.18 μs
nx_mean_of_series                        0.0103 K    97187.90 μs    ±11.27%   101938.17 μs   105582.17 μs

Comparison: 
converting_series_to_nx                   74.30 K
nx_mean_s16                                6.96 K - 10.67x slower +130.13 μs
nx_mean_s32                                6.09 K - 12.21x slower +150.87 μs
nx_mean_s64                                5.02 K - 14.79x slower +185.60 μs
explorer_mean                              1.31 K - 56.73x slower +750.10 μs
pre_converting_series_to_nx_nx_mean      0.0110 K - 6757.24x slower +90934.08 μs
nx_series_with_deftransform              0.0109 K - 6830.42x slower +91919.12 μs
nx_mean_of_series                        0.0103 K - 7220.88x slower +97174.44 μs