I have this piece of code, part of a Spikingjelly neural network training functionality, which gets some errors on this line after running. I'm not quite experienced in Python, and I don't understand what class initialization type this is.
The class definition and the __init__ looks like this:
class DVS128Gesture(sjds.NeuromorphicDatasetFolder):
def __init__(
self,
root: str,
train: bool = None,
data_type: str = 'event',
frames_number: int = None,
split_by: str = None,
duration: int = None,
custom_integrate_function: Callable = None,
custom_integrated_frames_dir_name: str = None,
transform: Optional[Callable] = None,
target_transform: Optional[Callable] = None,
) -> None:
And the intialization:
train_data_loader = torch.utils.data.DataLoader(
dataset=DVS128Gesture(dataset_dir, train=True, use_frame=True, frames_num=T,
split_by=split_by, normalization=normalization),
batch_size=batch_size,
shuffle=True,
num_workers=4,
drop_last=True,
pin_memory=True)
test_data_loader = torch.utils.data.DataLoader(
dataset=DVS128Gesture(dataset_dir, train=False, use_frame=True, frames_num=T,
split_by=split_by, normalization=normalization),
batch_size=batch_size,
shuffle=False,
num_workers=4,
drop_last=False,
pin_memory=True)
For example, class DVS128Gesture expects:
A string (root) as the address of the dataset
A bool (train) variable (which is not our interest right now)
A string
An integer value allocated to frames_number
The problem:
However, the initialization (at the bottom of the picture) is not according to that sequence; for example, useframe=True is used as the 3rd parameter while the class's 3rd parameter was datatype: str = 'event' .
Questions:
Is the problem I mentioned above, really an error by the author? or my misunderstanding of something?
What's the meaning of a variable assignment during a class initialization? For example, the 4th parameter of class initialization is written
framesnum=T. Why not write 'T' directly? and why it was usedframesnuminstead of the originalframes_numberwritten in class definition?
I traced the mentioned variables the their declaration and classes they were used in and as much as I can understand, there is no other variables with the same name.
**kwargsargument to catch all the non specified keyword argumentsframes_numversusframes_numberseems an error to me.