Reputation:
I see something like the following in the examples on Github. How can I see the type of this data (shape and the other properties)?
train_data = MyDataset(int(1e3), length=50)
train_iterator = DataLoader(train_data, batch_size=1000, shuffle=True)
Upvotes: 5
Views: 10145
Reputation: 190
You can inspect the data with following statements:
data = train_iterator.dataset.data
shape = train_iterator.dataset.data.shape
datatype = train_iterator.dataset.data.dtype
You can iterate the data and feed to a network as:
for nth_batch, (batch,_) in enumerate(train_iterator):
feedable = Variable(batch)
#here goes neural nets part
As Ivan stated in comments Variable is deprecated (although it still works fine) and Tensor itself now supports autograd, so the batch can be used in neural net.
for nth_batch, (batch,_) in enumerate(train_iterator):
#feedforward the batch
Upvotes: 8