-1

I currently have the following data:

f_map, inputs, s_bias = ml_dataset.dataset_for_s_bias()

where f_map is a tensor of matrices, inputs is a tensor of floats, and s_bias is a tensor of floats. The first two, f_map and inputs, are the inputs to my ML regression algorithm, and s_bias is the expected output. The reason there are two kinds of inputs is because f_map is processed using a CNN, and the CNN turns each matrix in f_map into a float, which is concatenated with the inputs tensor, and the resulting tensor is inputted into an MLP to get a prediction for s_bias.

I don’t know how to split f_map, inputs and s_bias into batches. I tried using a dataloader, but this causes me problems in my CNN which expects a tensor (I have an unsqueeze operation in my CNN, but dataloader is incompatible with unsqueeze). I need f_map, inputs, and s_bias to be split the same way and preserve the order. What is the best way to do this?

  • 1
    I'm confused by the question above. CNN turns f_map matrix into floats. But in general you inputs and weights should be of same data type and a matrix can be floattensor, longtensor or so on. coming to splitting into batches __getitem__() returns a single output of f_map, inputs, s_bias every time it is iterated. Next, i havent seen any where that dataloader is incompatible with unsqueeze operation. unsqueeze just modifies the size of tensor. Posting your could could help you get answers yo are looking for. – Nivesh Gadipudi Apr 24 '21 at 11:01

1 Answers1

0

I figured it out. When I was using the dataloader originally, I assumed that the dataloader itself was one batch. However, I needed to iterate over the dataloader to access the batches within. Those batches have the correct type (tensor).

  • This answer, while it seems that you have solved your issue, is not exactly for the question you asked. As it seems that the problem was a minor misunderstading, feel free to delete the question if you want. – Berriel Apr 23 '21 at 00:05