Totoro97 / f2-nerf

Fast neural radiance field training with free camera trajectories
https://totoro97.github.io/projects/f2-nerf/
Apache License 2.0
933 stars 69 forks source link

check failed: input.n() % BATCH_SIZE_GRANULARITY == 0 #120

Open zZH1222hui opened 10 months ago

zZH1222hui commented 10 months ago

I met an error Do you have any ideas?

terminate called after throwing an instance of 'std::runtime_error' ))J_9WKB`EL(QCA0UUF @LQ what(): /home/lab/NeRF/f2-nerf/External/tiny-cuda-nn/include/tiny-cuda-nn/object.h:130 check failed: input.n() % BATCH_SIZE_GRANULARITY == 0

xiao1874 commented 4 months ago

hi,I'm having the same problem, how can you fix it? thx!

kakukakujirori commented 2 months ago

The following worked for me:

--- a/src/Field/TCNNWP.cpp
+++ b/src/Field/TCNNWP.cpp
@@ -103,7 +103,7 @@ Tensor TCNNWP::Query(const Tensor& pts) {
   auto info = torch::make_intrusive<TCNNWPInfo>();

   int batch_size = pts.size(0);
-  int batch_size_al = (batch_size + 127) / 128 * 128;
+  int batch_size_al = (batch_size + 255) / 256 * 256;
   auto pad_opt = torch::nn::functional::PadFuncOptions({ 0LL, 0LL, 0LL, (long long) (batch_size_al - batch_size)});
   Tensor input = torch::nn::functional::pad(pts, pad_opt);