Crashes on inputs with numel == 0
See original GitHub issueHi, thanks so much for providing this package–it’s very useful. I am running torch 1.0.1.post2
on Ubuntu 16.04 with NVIDIA Quadro P4000 and with torch_scatter
installed recently via pip. Please see my minimum working example below which demonstrates what I feel is a bug. Notice that num_vals == 0
.
import torch
from torch_scatter import scatter_mean, scatter_max
num_vals = 0
m, n, k = 4, 5, 6
src = torch.zeros((m, n, num_vals)).cuda()
index = torch.zeros((m, n, num_vals)).long().cuda()
kwargs = dict(src=src, index=index, dim=2, dim_size=k)
for _ in range(2):
out = scatter_mean(**kwargs)
for _ in range(2):
out, argmax = scatter_max(**kwargs)
-
scatter_mean
, which I understand is mostly just a wrapper fortorch.scatter_add_
, handles thetensor.numel() == 0
case gracefully. -
But
scatter_max
fails withRuntimeError: cuda runtime error (9) : invalid configuration argument at /.../aten/src/THC/generic/THCTensorMath.cu:14
.
I guess the culprit is #define BLOCKS(N) (N + THREADS - 1) / THREADS
in scatter_kernel.cu
which doesn’t work so well for N == 0
.
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
Let users enter integer, warn them if they enter anything else
From the documentation of input: "The response to the input prompt can be any MATLAB expression, which is evaluated using the variables in...
Read more >unexpected crash when overloading subsasgn
It seems that Matlab crashes after the call to numel.m but before it enters the overloaded subasgn.m. ... [obj.field(1)] = deal(0) % SEGMENTATION...
Read more >Code debugging in MATLAB
This error occurs when you are calling a function but did not enter the correct entries. For example, the function should take 4...
Read more >Source code for deepspeed.runtime.zero.stage3
For more details please see ZeRO: Memory Optimization Towards Training A ... 0 for tensor in tensors: tensor_numel = tensor.numel() # move the...
Read more >Program crashes on large inputs (C) - Stack Overflow
#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int i, n, q = 0, k, *array2; printf("Geben Sie eine natuerliche ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Fixed in master 😃
Great! Fixed in master 😃