mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 12:54:11 +08:00
[codemod] c10:optional
-> std::optional
(#126135)
Generated by running the following from PyTorch root: ``` find . -regex ".*\.\(cpp\|h\|cu\|hpp\|cc\|cxx\)$" | grep -v "build/" | xargs -n 50 -P 4 perl -pi -e 's/c10::optional/std::optional/' ``` `c10::optional` is just an alias for `std::optional`. This removes usages of that alias in preparation for eliminating it entirely. Pull Request resolved: https://github.com/pytorch/pytorch/pull/126135 Approved by: https://github.com/Skylion007, https://github.com/malfet, https://github.com/albanD, https://github.com/aaronenyeshi
This commit is contained in:
committed by
PyTorch MergeBot
parent
b55f57b7af
commit
ed327876f5
@ -60,7 +60,7 @@ inline vec_scalar_t<scalar_t> init_value() {
|
||||
}
|
||||
|
||||
template <typename scalar_t, ReductionType reduce>
|
||||
inline vec_scalar_t<scalar_t> init_value(const c10::optional<Scalar>& initial) {
|
||||
inline vec_scalar_t<scalar_t> init_value(const std::optional<Scalar>& initial) {
|
||||
using acc_t = vec_scalar_t<scalar_t>;
|
||||
if (initial.has_value()) {
|
||||
return initial.value().to<acc_t>();
|
||||
@ -80,7 +80,7 @@ inline void init(scalar_t* out, int64_t size, const vec_scalar_t<scalar_t>& val)
|
||||
}
|
||||
|
||||
template <typename scalar_t, ReductionType reduce>
|
||||
inline void init(scalar_t* out, int64_t size, const c10::optional<Scalar>& initial) {
|
||||
inline void init(scalar_t* out, int64_t size, const std::optional<Scalar>& initial) {
|
||||
using acc_t = vec_scalar_t<scalar_t>;
|
||||
acc_t val = init_value<scalar_t, reduce>(initial);
|
||||
init(out, size, val);
|
||||
|
Reference in New Issue
Block a user