Skip to content

Commit

Permalink
Add c10:: namespace in front of optional
Browse files Browse the repository at this point in the history
Prep change for moving the codebase to C++17 standard

Was part of #85969
  • Loading branch information
malfet committed Nov 23, 2022
1 parent 7c98e70 commit a3bdcfd
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions aten/src/ATen/mps/MPSGuardImpl.h
Expand Up @@ -109,12 +109,12 @@ struct TORCH_API MPSGuardImpl final : public c10::impl::DeviceGuardImplInterface
struct OptionalMPSGuard {
explicit OptionalMPSGuard() : guard_() {}

explicit OptionalMPSGuard(optional<Device> device_opt)
explicit OptionalMPSGuard(c10::optional<Device> device_opt)
: guard_(device_opt) {}

/// Set the current MPS device to the passed device index, if it is not
/// nullopt
explicit OptionalMPSGuard(optional<DeviceIndex> device_index_opt)
explicit OptionalMPSGuard(c10::optional<DeviceIndex> device_index_opt)
: guard_(device_index_opt) {}

// Copy is not allowed
Expand Down Expand Up @@ -144,14 +144,14 @@ struct OptionalMPSGuard {

/// Returns the device that was set immediately prior to initialization of the
/// guard, or nullopt if the guard is uninitialized.
optional<Device> original_device() const {
c10::optional<Device> original_device() const {
return guard_.original_device();
}

/// Returns the most recent device that was set using this device guard,
/// either from construction, or via set_device, if the guard is initialized,
/// or nullopt if the guard is uninitialized.
optional<Device> current_device() const {
c10::optional<Device> current_device() const {
return guard_.current_device();
}

Expand Down
2 changes: 1 addition & 1 deletion aten/src/ATen/native/ReduceOpsUtils.h
Expand Up @@ -102,7 +102,7 @@ static inline void check_scalar_type_device_layout_equal(const Tensor& out, cons
OPTION_TYPE_EQUALITY_CHECK(layout, out.options(), self.options());
}

static inline Tensor integer_upcast(const Tensor& self, optional<ScalarType> dtype) {
static inline Tensor integer_upcast(const Tensor& self, c10::optional<ScalarType> dtype) {
ScalarType scalarType = self.scalar_type();
ScalarType upcast_scalarType = dtype.value_or(at::isIntegralType(scalarType, /*includeBool=*/true) ? ScalarType::Long : scalarType);
return self.toType(upcast_scalarType);
Expand Down
2 changes: 1 addition & 1 deletion aten/src/ATen/native/mps/operations/Distributions.mm
Expand Up @@ -271,7 +271,7 @@ Tensor normal_mps(const Tensor& mean, const Tensor& std, c10::optional<Generator
}

// random_.from
Tensor& random_mps_(Tensor& self, int64_t from, optional<int64_t> to_opt, c10::optional<Generator> gen) {
Tensor& random_mps_(Tensor& self, int64_t from, c10::optional<int64_t> to_opt, c10::optional<Generator> gen) {
auto input_dtype = self.scalar_type();
int64_t to = 0;

Expand Down
2 changes: 1 addition & 1 deletion aten/src/ATen/native/mps/operations/ReduceOps.mm
Expand Up @@ -301,7 +301,7 @@ void set_axes_and_shapes(const Tensor& input_t,
// Taken from ReduceOps.cpp
inline ScalarType get_dtype_from_self(
const Tensor& self,
const optional<ScalarType>& dtype,
const c10::optional<ScalarType>& dtype,
bool promote_integers) {
if (dtype.has_value()) {
return dtype.value();
Expand Down
2 changes: 1 addition & 1 deletion aten/src/ATen/native/mps/operations/View.mm
Expand Up @@ -274,7 +274,7 @@ Tensor gatherViewTensor(const at::Tensor& src, at::Tensor& dst)
} // namespace mps

// implementation of as_strided() op
Tensor as_strided_tensorimpl_mps(const Tensor& self, IntArrayRef size, IntArrayRef stride, optional<int64_t> storage_offset_)
Tensor as_strided_tensorimpl_mps(const Tensor& self, IntArrayRef size, IntArrayRef stride, c10::optional<int64_t> storage_offset_)
{
auto storage_offset = storage_offset_.value_or(self.storage_offset());
auto result = detail::make_tensor<TensorImpl>(c10::TensorImpl::VIEW, Storage(self.storage()), self.key_set(), self.dtype());
Expand Down

0 comments on commit a3bdcfd

Please sign in to comment.