Skip to content

Undefined reference in _create_buffer(x::BatchView) #205

@aksuhton

Description

@aksuhton

The function linked below references A, which is not defined.

function _create_buffer(x::BatchView)
    obsindices = _batchrange(x, 1)
    return [getobs(A.data, idx) for idx in enumerate(obsindices)]
end

https://github.com/JuliaML/MLUtils.jl/blob/f778831de729e3918601fc92ff7b14e3416c0195/src/dataloader.jl#L236C1-L239C4

I encountered this when using a custom collate function together with buffer.

  function shift_pair(X)
      inputs = map(X) do x
          T = size(x, 4)
          return selectdim(x, 4, 1:(T-1))
      end 
      targets = map(X) do x
          T = size(x, 4)
          return selectdim(x, 4, 2:T)
      end 
      return (stack(inputs), stack(targets))
  end
  trajectory = randn(Float32, 32, 32, 4, 3, 5); 
  loader = DataLoader(
      trajectory;
      batchsize=2,
      partial=false,
      buffer=true,
      collate = shift_pair,
  )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions