Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vector out of bounds error #2

Open
unnikrishnan-anil opened this issue May 2, 2024 · 0 comments
Open

Vector out of bounds error #2

unnikrishnan-anil opened this issue May 2, 2024 · 0 comments

Comments

@unnikrishnan-anil
Copy link

unnikrishnan-anil commented May 2, 2024

I was trying to run the code and I'm getting a vector out of bounds error in the following method in RayUtils.h:

inline torch::Tensor GetDirections(const int h, const int w, torch::Tensor k)
{
	auto device = k.device();
	//pytorch's meshgrid has indexing='ij'
	std::vector<torch::Tensor> ij = torch::meshgrid({ torch::linspace(0, w - 1, w), torch::linspace(0, h - 1, h) });
	auto i = ij[0].to(device).t();
	auto j = ij[1].to(device).t();
	torch::Tensor dirs = torch::stack({ (i - k[0][2]) / k[0][0], -(j - k[1][2]) / k[1][1], -torch::ones_like(i) }, -1);
	return dirs;
}

Seems to be on:

auto i = ij[0].to(device).t();

I am running this on a RTX 2080Ti. Do you think I'm running out of memory or something along those lines?

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant