Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aten/src/TH/generic/THTensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ void THTensor_(catArray)(THTensor *result, THTensor **inputs, int numInputs, int
if (!should_skip(inputs[j])) {
THTensor* input0 = inputs[j];
scalar_t* input0_data = THStorage_(data)(THTensor_getStoragePtr(input0)) + input0->storage_offset();
int local_inner = inner * input0->size(dimension);
int64_t local_inner = inner * input0->size(dimension);
if (local_inner != 0) {
memcpy(result_data + offset, input0_data + o*local_inner, local_inner*sizeof(scalar_t));
} // input0_size != 0
Expand Down
10 changes: 10 additions & 0 deletions test/test_torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -4948,6 +4948,16 @@ def _test_cat_empty(self, use_cuda=False):
def test_cat_empty(self):
self._test_cat_empty(self)

@slowTest
def test_cat_big(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this test be marked as slow or something like that? Also, how much memory does it need, > 2GB?

Copy link
Contributor Author

@umanwizard umanwizard Jun 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fmassa The test needs 5 GB and takes about 8 seconds on my machine. Do you know if there is a good way to mark tests as not running in memory-constrained environments?

Alternatively we can just land this without the test. What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should have the test. Maybe at some point in the future we might consider adding a flag for memory intensive tests, both on the cpu and you

SIZE1 = 6500
SIZE2 = 4500
concat_list = []
concat_list.append(torch.ones((SIZE1, 1024 * 512), dtype=torch.uint8))
concat_list.append(torch.ones((SIZE2, 1024 * 512), dtype=torch.uint8))
result = torch.cat(concat_list)
self.assertEqual(result.size(0), SIZE1 + SIZE2)

def test_narrow(self):
x = torch.Tensor([[0, 1, 2], [3, 4, 5], [6, 7, 8]])
self.assertEqual(x.narrow(0, 0, 1), torch.Tensor([[0, 1, 2]]))
Expand Down