Got it.
Sir, one more question.
As my data are tensor type, I have defined 54 signals in total. Now I want to insert them into a CNN network, which requires (target, label)
. In my case the target is in definition my data, however, its data has no labels as identifiers, this is my major problem. In fact, I want to assign to each data a label, to compile the designed network. I first enumerate each data as a label of each data, unfortunately, an error is raised ValueError: only one element tensors can be converted to Python scalars
. I proceeded like the codes below, but in vain.
def create_data_loader(train_data, batch_size):
train_dataloader = DataLoader(train_data, batch_size=batch_size)
print(train_dataloader)
return train_dataloader
for jj, y in enumerate(storage_data, index):
# print(jj, ". ", y)
train_data = (jj, y)
index += 1
print("My signals are : ", '\n', train_data, '\n')
So, how to label my data and make the training of my network? Here is an example listed below (the 54
denotes the listing of the last data). Thanks in advance.
(54, tensor([[[ 6.7071e-49+9.6242e-67j, -5.7732e-53-1.1452e-50j,
1.0942e-50+1.2945e-51j, ...,
7.2834e-52-4.2107e-51j, 5.7082e-51-3.9200e-51j,
-4.9956e-51+6.2307e-51j],
[-5.7732e-53+1.1452e-50j, 6.6808e-49+8.0598e-67j,
-5.2926e-53-1.1456e-50j, ...,
3.8010e-51+2.0603e-51j, 7.3626e-52-4.2001e-51j,
5.6491e-51-3.8731e-51j],
[ 1.0942e-50-1.2945e-51j, -5.2926e-53+1.1456e-50j,
6.6689e-49+6.7971e-68j, ...,
5.4084e-51-6.5998e-51j, 3.7788e-51+1.9931e-51j,
7.7121e-52-4.1535e-51j],
...,
[ 7.2834e-52+4.2107e-51j, 3.8010e-51-2.0603e-51j,
5.4084e-51+6.5998e-51j, ...,
5.7495e-49+1.8567e-67j, -1.5623e-51-2.1687e-52j,
6.8474e-51-3.8617e-52j],
[ 5.7082e-51+3.9200e-51j, 7.3626e-52+4.2001e-51j,
3.7788e-51-1.9931e-51j, ...,
-1.5623e-51+2.1687e-52j, 5.7503e-49+2.4958e-67j,
-1.6490e-51-6.3735e-53j],
[-4.9956e-51-6.2307e-51j, 5.6491e-51+3.8731e-51j,
7.7121e-52+4.1535e-51j, ...,
6.8474e-51+3.8617e-52j, -1.6490e-51+6.3735e-53j,
5.7527e-49-5.1433e-67j]],
[[ 5.7611e-49-3.0056e-67j, -1.6267e-51+1.7540e-52j,
6.8346e-51-5.1263e-52j, ...,
-2.2249e-52-4.9047e-51j, 5.2019e-51-2.8803e-51j,
-6.4842e-51+6.2802e-51j],
[-1.6267e-51-1.7540e-52j, 5.7591e-49-1.2227e-67j,
-1.7296e-51+3.3187e-52j, ...,
4.2446e-51+3.1161e-51j, -2.9077e-52-4.8340e-51j,
5.2237e-51-2.8507e-51j],
[ 6.8346e-51+5.1263e-52j, -1.7296e-51-3.3187e-52j,
5.7666e-49-4.0239e-67j, ...,
4.7945e-51-7.9020e-51j, 4.3089e-51+3.1792e-51j,
-2.3726e-52-4.8676e-51j],
...,
[-2.2249e-52+4.9047e-51j, 4.2446e-51-3.1161e-51j,
4.7945e-51+7.9020e-51j, ...,
7.2150e-49+5.8171e-67j, -3.9169e-51+1.2124e-50j,
5.8248e-51-3.1926e-51j],
[ 5.2019e-51+2.8803e-51j, -2.9077e-52+4.8340e-51j,
4.3089e-51-3.1792e-51j, ...,
-3.9169e-51-1.2124e-50j, 7.2353e-49-4.0999e-67j,
-3.9812e-51+1.2184e-50j],
[-6.4842e-51-6.2802e-51j, 5.2237e-51+2.8507e-51j,
-2.3726e-52+4.8676e-51j, ...,
5.8248e-51+3.1926e-51j, -3.9812e-51-1.2184e-50j,
7.2597e-49+2.2527e-67j]]], dtype=torch.complex128))