Skip to content

Commit

Permalink
c10::optional -> std::optional in aiplatform/distributed_inference/py…
Browse files Browse the repository at this point in the history
…torch/ops/tests/distributed_inference_operators_test_fixture.h +20 (facebookincubator#1007)

Summary:
Pull Request resolved: facebookincubator#1007

`c10::optional` was switched to be `std::optional` after PyTorch moved to C++17. Let's eliminate `c10::optional`, if we can.

Reviewed By: albanD, swolchok

Differential Revision: D57294299

fbshipit-source-id: 7637845c1195ec8a321a833942505122ff53baee
  • Loading branch information
r-barnes authored and facebook-github-bot committed May 14, 2024
1 parent d158982 commit d594370
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions fx2ait/fx2ait/csrc/AITModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ static auto registerAITModel =
std::string,
std::vector<std::string>,
std::vector<std::string>,
c10::optional<at::ScalarType>,
c10::optional<at::ScalarType>,
std::optional<at::ScalarType>,
std::optional<at::ScalarType>,
int64_t>())
.def("forward", &AITModel::forward)
.def("profile", &AITModel::profile)
Expand Down
4 changes: 2 additions & 2 deletions fx2ait/fx2ait/csrc/AITModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class AITModel : public torch::CustomClassHolder {
const std::string& model_path,
std::vector<std::string> input_names,
std::vector<std::string> output_names,
c10::optional<at::ScalarType> input_dtype,
c10::optional<at::ScalarType> output_dtype,
std::optional<at::ScalarType> input_dtype,
std::optional<at::ScalarType> output_dtype,
int64_t num_runtimes = 2,
bool use_cuda_graph = false)
: aitModelImpl_(
Expand Down
4 changes: 2 additions & 2 deletions fx2ait/fx2ait/csrc/AITModelImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ AITModelImpl::AITModelImpl(
const std::string& model_path,
std::vector<std::string> input_names,
std::vector<std::string> output_names,
c10::optional<at::ScalarType> input_dtype,
c10::optional<at::ScalarType> output_dtype,
std::optional<at::ScalarType> input_dtype,
std::optional<at::ScalarType> output_dtype,
int64_t num_runtimes,
bool use_cuda_graph)
: handle_(dlopen(model_path.c_str(), RTLD_NOW | RTLD_LOCAL)),
Expand Down
12 changes: 6 additions & 6 deletions fx2ait/fx2ait/csrc/AITModelImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class AITModelImpl {
const std::string& model_path,
std::vector<std::string> input_names,
std::vector<std::string> output_names,
c10::optional<at::ScalarType> input_dtype,
c10::optional<at::ScalarType> output_dtype,
std::optional<at::ScalarType> input_dtype,
std::optional<at::ScalarType> output_dtype,
int64_t num_runtimes = 2,
bool use_cuda_graph = false);

Expand Down Expand Up @@ -102,11 +102,11 @@ class AITModelImpl {
return output_names_;
}

const c10::optional<at::ScalarType> floatingPointInputDtype() const {
const std::optional<at::ScalarType> floatingPointInputDtype() const {
return floating_point_input_dtype_;
}

const c10::optional<at::ScalarType> floatingPointOutputDtype() const {
const std::optional<at::ScalarType> floatingPointOutputDtype() const {
return floating_point_output_dtype_;
}

Expand Down Expand Up @@ -182,8 +182,8 @@ class AITModelImpl {
const std::string library_path_;
const std::vector<std::string> input_names_;
const std::vector<std::string> output_names_;
const c10::optional<at::ScalarType> floating_point_input_dtype_;
const c10::optional<at::ScalarType> floating_point_output_dtype_;
const std::optional<at::ScalarType> floating_point_input_dtype_;
const std::optional<at::ScalarType> floating_point_output_dtype_;
#ifdef FBCODE_AIT
folly::F14FastMap<const char*, size_t> input_name_to_index_;
folly::F14FastMap<const char*, size_t> output_name_to_index_;
Expand Down

0 comments on commit d594370

Please sign in to comment.