Skip to content

Commit

Permalink
fix tensors on different devices
Browse files Browse the repository at this point in the history
  • Loading branch information
luisa-mao committed May 29, 2024
1 parent 1898366 commit 41892f7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config/navigation_spot_icl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ end

NavigationParameters = {
laser_topic = "velodyne_2dscan_highbeams";
odom_topic = "/odometry/filtered";
odom_topic = "/odom";
localization_topic = "localization";
image_topic = "/bev/single/compressed";
init_topic = "initialpose";
Expand Down
6 changes: 3 additions & 3 deletions src/navigation/terrain_evaluator2.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ class CustomTerrainEvaluator : public TerrainEvaluator {


std::vector<torch::jit::IValue> inputs;
inputs.push_back(context_tensor_);
inputs.push_back(img_tensor);
inputs.push_back(context_tensor_.to(torch_device_));
inputs.push_back(img_tensor.to(torch_device_));

torch::NoGradGuard no_grad;

// Run the model with the inputs
auto output = cost_model_.forward(inputs).toTensor();
auto output = cost_model_.forward(inputs).toTensor().to(torch::kCPU);
// auto output = cost_model_.run_method("forward_w_encoded_patches", inputs).toTensor();

// apply sigmoid to the output
Expand Down

0 comments on commit 41892f7

Please sign in to comment.