Skip to content

custom dataset error when second epoch ? #2418

Answered by frankfliu
iamuspace asked this question in Q&A
Discussion options

You must be logged in to vote

@iamuspace
In your [AndGetDataset.get(NDManager manager, long index)](public Record get(NDManager manager, long index)) function, you returned the NDArray of the dataset directly.

The NDArray returned from this function will be closed automatically after being used. That's why you see the exception in 2nd epoch.

There are two ways to resolve this issue:

  1. duplicate the NDArray before add to Record
  2. Create a wrapper class, override close() method to prevent DataIterator to close it.

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@iamuspace
Comment options

Comment options

You must be logged in to vote
1 reply
@iamuspace
Comment options

Comment options

You must be logged in to vote
1 reply
@iamuspace
Comment options

Answer selected by iamuspace
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants