Commit cb93c5d
Clean up float32 defaults in Sobol utils & test functions (#2346)
Summary:
Pull Request resolved: #2346
We recommend using double/float64 in BoTorch but seem to default to float32 in some Sobol utilities and test function code. I searched through the code base and updated float32 defaults in a few ways:
- Either removed them and left them to use whatever default torch sees fit.
- Set them to `torch.get_default_dtype`, to explicitly match the dtype used by torch.
- Updated them to use the dtype of another tensor from the same class.
Some added `dtype=torch.get_default_dtype()` is unnecessarily verbose, as torch will default to it whenever the input is `List[Union[int, float]]` or `List[float]` -- but it will default to `torch.long` if the input is `List[int]`. I think being verbose here helps avoid confusion.
Found while investigating #2264.
Also made some minor updates in these files to make pyre happier (or less upset, whichever fits).
Reviewed By: Balandat
Differential Revision: D57473132
fbshipit-source-id: cf98b792f8f34abf20d8e4b7bbf714fdc73b764e1 parent 425b1db commit cb93c5d
File tree
7 files changed
+142
-130
lines changed- botorch
- sampling
- test_functions
- utils
7 files changed
+142
-130
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
62 | 65 | | |
63 | 66 | | |
64 | 67 | | |
| |||
67 | 70 | | |
68 | 71 | | |
69 | 72 | | |
| 73 | + | |
70 | 74 | | |
71 | 75 | | |
72 | 76 | | |
73 | 77 | | |
| 78 | + | |
74 | 79 | | |
75 | 80 | | |
76 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
| |||
146 | 145 | | |
147 | 146 | | |
148 | 147 | | |
149 | | - | |
150 | | - | |
| 148 | + | |
| 149 | + | |
151 | 150 | | |
152 | 151 | | |
153 | 152 | | |
154 | 153 | | |
155 | 154 | | |
156 | 155 | | |
157 | 156 | | |
158 | | - | |
| 157 | + | |
159 | 158 | | |
160 | 159 | | |
161 | 160 | | |
| |||
176 | 175 | | |
177 | 176 | | |
178 | 177 | | |
179 | | - | |
| 178 | + | |
180 | 179 | | |
181 | 180 | | |
182 | 181 | | |
183 | 182 | | |
184 | 183 | | |
185 | 184 | | |
186 | | - | |
| 185 | + | |
187 | 186 | | |
188 | | - | |
| 187 | + | |
189 | 188 | | |
190 | 189 | | |
191 | 190 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
| 96 | + | |
97 | 97 | | |
98 | | - | |
99 | | - | |
| 98 | + | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
| 104 | + | |
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
151 | | - | |
| 150 | + | |
| 151 | + | |
152 | 152 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
173 | | - | |
| 173 | + | |
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
289 | | - | |
| 289 | + | |
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
| |||
1078 | 1078 | | |
1079 | 1079 | | |
1080 | 1080 | | |
1081 | | - | |
| 1081 | + | |
1082 | 1082 | | |
1083 | 1083 | | |
1084 | 1084 | | |
| |||
1195 | 1195 | | |
1196 | 1196 | | |
1197 | 1197 | | |
1198 | | - | |
| 1198 | + | |
1199 | 1199 | | |
1200 | 1200 | | |
1201 | 1201 | | |
1202 | | - | |
1203 | | - | |
| 1202 | + | |
| 1203 | + | |
1204 | 1204 | | |
1205 | 1205 | | |
1206 | 1206 | | |
| |||
1256 | 1256 | | |
1257 | 1257 | | |
1258 | 1258 | | |
1259 | | - | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
1260 | 1262 | | |
1261 | 1263 | | |
1262 | 1264 | | |
| |||
1373 | 1375 | | |
1374 | 1376 | | |
1375 | 1377 | | |
1376 | | - | |
| 1378 | + | |
1377 | 1379 | | |
1378 | 1380 | | |
1379 | 1381 | | |
| |||
1420 | 1422 | | |
1421 | 1423 | | |
1422 | 1424 | | |
1423 | | - | |
1424 | | - | |
1425 | | - | |
1426 | | - | |
1427 | | - | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
1428 | 1430 | | |
1429 | | - | |
| 1431 | + | |
1430 | 1432 | | |
1431 | 1433 | | |
1432 | 1434 | | |
1433 | 1435 | | |
1434 | 1436 | | |
1435 | 1437 | | |
1436 | 1438 | | |
1437 | | - | |
1438 | | - | |
| 1439 | + | |
| 1440 | + | |
1439 | 1441 | | |
1440 | 1442 | | |
1441 | 1443 | | |
| |||
1453 | 1455 | | |
1454 | 1456 | | |
1455 | 1457 | | |
1456 | | - | |
1457 | | - | |
| 1458 | + | |
| 1459 | + | |
1458 | 1460 | | |
1459 | 1461 | | |
1460 | 1462 | | |
1461 | | - | |
| 1463 | + | |
1462 | 1464 | | |
1463 | 1465 | | |
1464 | 1466 | | |
| |||
1490 | 1492 | | |
1491 | 1493 | | |
1492 | 1494 | | |
1493 | | - | |
1494 | | - | |
| 1495 | + | |
| 1496 | + | |
1495 | 1497 | | |
1496 | 1498 | | |
1497 | 1499 | | |
| |||
1509 | 1511 | | |
1510 | 1512 | | |
1511 | 1513 | | |
1512 | | - | |
| 1514 | + | |
1513 | 1515 | | |
1514 | 1516 | | |
1515 | 1517 | | |
1516 | | - | |
| 1518 | + | |
1517 | 1519 | | |
1518 | 1520 | | |
1519 | | - | |
1520 | | - | |
| 1521 | + | |
| 1522 | + | |
1521 | 1523 | | |
1522 | | - | |
| 1524 | + | |
1523 | 1525 | | |
1524 | 1526 | | |
1525 | 1527 | | |
| |||
0 commit comments