Skip to content

Commit

Permalink
width/height mismatch fix, cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
pierotofy committed Mar 20, 2024
1 parent b46fd3a commit 17211cc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 1 addition & 3 deletions model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ torch::Tensor Model::forward(Camera& cam, int step){
conics = p[3];
numTilesHit = p[4];
#else
throw std::runtime_error("GPU support not built");
throw std::runtime_error("GPU support not built, use --cpu");
#endif
}

Expand All @@ -143,7 +143,6 @@ torch::Tensor Model::forward(Camera& cam, int step){
int degreesToUse = (std::min<int>)(step / shDegreeInterval, shDegree);
torch::Tensor rgbs;

std::cerr << "HERE";
if (device == torch::kCPU){
rgbs = SphericalHarmonicsCPU::apply(degreesToUse, viewDirs, colors);
}else{
Expand All @@ -152,7 +151,6 @@ torch::Tensor Model::forward(Camera& cam, int step){
#endif
}

std::cerr << "THERE" << camDepths;
rgbs = torch::clamp_min(rgbs + 0.5f, 0.0f);


Expand Down
4 changes: 3 additions & 1 deletion opensplat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,12 @@ int main(int argc, char *argv[]){
const float splitScreenSize = result["split-screen-size"].as<float>();

torch::Device device = torch::kCPU;
int displayStep = 1;

if (torch::cuda::is_available() && result.count("cpu") == 0) {
std::cout << "Using CUDA" << std::endl;
device = torch::kCUDA;
displayStep = 10;
}else{
std::cout << "Using CPU" << std::endl;
}
Expand Down Expand Up @@ -120,7 +122,7 @@ int main(int argc, char *argv[]){
torch::Tensor mainLoss = model.mainLoss(rgb, gt, ssimWeight);
mainLoss.backward();

if (step % 10 == 0) std::cout << "Step " << step << ": " << mainLoss.item<float>() << std::endl;
if (step % displayStep == 0) std::cout << "Step " << step << ": " << mainLoss.item<float>() << std::endl;

model.optimizersStep();
model.schedulersStep(step);
Expand Down
4 changes: 2 additions & 2 deletions simple_trainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ int main(int argc, char **argv){
height / 2,
height,
width);

outImg = RasterizeGaussiansCPU::apply(
p[0], // xys
p[1], // radii,
Expand Down Expand Up @@ -182,7 +182,7 @@ int main(int argc, char **argv){
width,
background);
#else
throw std::runtime_error("GPU support not built");
throw std::runtime_error("GPU support not built, use --cpu");
#endif
}

Expand Down
4 changes: 2 additions & 2 deletions vendor/gsplat-cpu/gsplat_cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ std::tuple<
}

// Background
for (int i = 0; i < width; i++){
for (int j = 0; j < height; j++){
for (int i = 0; i < height; i++){
for (int j = 0; j < width; j++){
size_t pixIdx = (i * width + j);
float T = pFinalTs[pixIdx];

Expand Down

0 comments on commit 17211cc

Please sign in to comment.