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

Using nn.Padding throws luajit: C++ exception #1309

Open
tastyminerals opened this issue Mar 12, 2018 · 0 comments
Open

Using nn.Padding throws luajit: C++ exception #1309

tastyminerals opened this issue Mar 12, 2018 · 0 comments

Comments

@tastyminerals
Copy link
Contributor

tastyminerals commented Mar 12, 2018

I am using nn.Padding during training and whenever the sequence length is less than 25 we pad the inputs and targets inside nn.SequenceLoader the following way:

function SequenceLoader:sub(start, stop, inputs, targets)
  local seqlen = stop - start + 1

  inputs = inputs or self.data.new()
  targets = targets or inputs.new()

  if self.bidirectional then
    assert(stop <= self.data:size(1))
    inputs:set(self.data:sub(start, stop))
    targets:set(inputs)
  else
    assert(stop < self.data:size(1))
    inputs:set(self.data:sub(start, stop))
    targets:set(self.data:sub(start+1, stop+1))
  end

  -- add padding
  if inputs:size()[1] ~= 25 then
    local pad = nn.Padding(0, 11, 0)
    return pad:forward(inputs), pad:forward(targets)
  end

  return inputs, targets
end

Unfortunately during training this throws numerous assertion errors

...
/home/pavel/torch/extra/cutorch/lib/THC/THCTensorIndex.cu:321: void indexSelectLargeIndex(TensorInfo<T, IndexType>, TensorInfo<T, IndexType>, TensorInfo<long, IndexType>, int, int, IndexType, IndexType, long) [with T = float, IndexType = unsigned int, DstDim = 2, SrcDim = 2, IdxDim = -2]: block: [49,0,0], thread: [125,0,0] Assertion `srcIndex < srcSelectDimSize` failed.
/home/pavel/torch/extra/cutorch/lib/THC/THCTensorIndex.cu:321: void indexSelectLargeIndex(TensorInfo<T, IndexType>, TensorInfo<T, IndexType>, TensorInfo<long, IndexType>, int, int, IndexType, IndexType, long) [with T = float, IndexType = unsigned int, DstDim = 2, SrcDim = 2, IdxDim = -2]: block: [49,0,0], thread: [126,0,0] Assertion `srcIndex < srcSelectDimSize` failed.
/home/pavel/torch/extra/cutorch/lib/THC/THCTensorIndex.cu:321: void indexSelectLargeIndex(TensorInfo<T, IndexType>, TensorInfo<T, IndexType>, TensorInfo<long, IndexType>, int, int, IndexType, IndexType, long) [with T = float, IndexType = unsigned int, DstDim = 2, SrcDim = 2, IdxDim = -2]: block: [49,0,0], thread: [127,0,0] Assertion `srcIndex < srcSelectDimSize` failed.
/home/pavel/torch/install/bin/luajit: C++ exception

What does the error mean?

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