Commit 157469a
committed
Cast mean operand to output dtype before reduce_mean
torch.mean(x, dtype=...) on an integer tensor crashed during conversion
(ValueError: mean[0]: dtype si32 vs f32): replace_mean_default and
replace_mean_dim never honored the dtype kwarg, so reduce_mean ran on the
int operand and produced a result whose type mismatched the node's declared
float output. Cast the operand to the node's output element type before
reducing, mirroring replace_sum_dim_intlist. Adds integer-operand coverage
for aten.mean.default and aten.mean.dim across float32/float16 targets.1 parent 698f11a commit 157469a
2 files changed
Lines changed: 70 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2247 | 2247 | | |
2248 | 2248 | | |
2249 | 2249 | | |
| 2250 | + | |
| 2251 | + | |
| 2252 | + | |
2250 | 2253 | | |
2251 | 2254 | | |
2252 | 2255 | | |
| |||
2256 | 2259 | | |
2257 | 2260 | | |
2258 | 2261 | | |
| 2262 | + | |
| 2263 | + | |
| 2264 | + | |
2259 | 2265 | | |
2260 | 2266 | | |
2261 | 2267 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2917 | 2917 | | |
2918 | 2918 | | |
2919 | 2919 | | |
| 2920 | + | |
| 2921 | + | |
| 2922 | + | |
| 2923 | + | |
| 2924 | + | |
| 2925 | + | |
| 2926 | + | |
| 2927 | + | |
| 2928 | + | |
| 2929 | + | |
| 2930 | + | |
| 2931 | + | |
| 2932 | + | |
| 2933 | + | |
| 2934 | + | |
| 2935 | + | |
| 2936 | + | |
| 2937 | + | |
| 2938 | + | |
| 2939 | + | |
| 2940 | + | |
| 2941 | + | |
| 2942 | + | |
| 2943 | + | |
| 2944 | + | |
| 2945 | + | |
| 2946 | + | |
| 2947 | + | |
| 2948 | + | |
| 2949 | + | |
| 2950 | + | |
| 2951 | + | |
| 2952 | + | |
| 2953 | + | |
| 2954 | + | |
| 2955 | + | |
| 2956 | + | |
| 2957 | + | |
| 2958 | + | |
| 2959 | + | |
| 2960 | + | |
| 2961 | + | |
| 2962 | + | |
| 2963 | + | |
| 2964 | + | |
| 2965 | + | |
| 2966 | + | |
| 2967 | + | |
| 2968 | + | |
| 2969 | + | |
| 2970 | + | |
| 2971 | + | |
| 2972 | + | |
| 2973 | + | |
| 2974 | + | |
| 2975 | + | |
| 2976 | + | |
| 2977 | + | |
| 2978 | + | |
| 2979 | + | |
| 2980 | + | |
| 2981 | + | |
| 2982 | + | |
| 2983 | + | |
2920 | 2984 | | |
2921 | 2985 | | |
2922 | 2986 | | |
| |||
0 commit comments