I am trying to write my own custom transform that will be applied after batch. I’m trying to read some other DisplayTransform’s that have been used for after_batch such as Normalize and IntToFloatTensor. I noticed that they both have an order variable declared at the top. What does that mean? How does it get used?
class IntToFloatTensor(DisplayedTransform):
"Transform image to float tensor, optionally dividing by 255 (e.g. for images)."
order = 10 #Need to run after PIL transforms on the GPU
def __init__(self, div=255., div_mask=1): store_attr()
def encodes(self, o:TensorImage): return o.float().div_(self.div)
def encodes(self, o:TensorMask ): return o.long() // self.div_mask
def decodes(self, o:TensorImage): return ((o.clamp(0., 1.) * self.div).long()) if self.div else o