Numworkers AttributeError: 'TTree' object has no attribute 'x'

Hi All,

I have an issue when trying to set num_workers above 0 in my DataLoader.

class MyDataSet(Dataset):
    def __init__(self,TTree):
        self.TTree = TTree

    def __getitem__(self,idx):


        return self.TTree.X 

    def __len__(self):
        return self.TTree.GetEntries()

Resulting in:

AttributeError: 'TTree' object has no attribute 'X'

I am using ROOT framework by cern for my data.

TTree.GetEntry(idx) sets the address of the variable X corresponding to the index. It work’s perfectly fine when I have num_workers=0, but it seems that when I increase this number, that it loses track of the address somewhere.

Is there an easy fix for this?