I couldnt get the scatter_ to work. As a work around I managed to create my target using a thesholding method:
where_ones = torch.ones(target.shape, dtype=torch.long) 
where_zeros = torch.zeros(target.shape, dtype=torch.long)
target_ = torch.where(target > 0.1, where_ones, where_zeros)
target = torch.unsqueeze(target_, 0).float()

This works and gives the loss output but I’m not sure if this is the preferred method.
Is what what I am doing equivalent to the output produced by scatter_?
I read in one of the docs that for target is is advised to use the scatter_ method as this was the tensor is differentiable and autograd  can be utilized. Or was this the case for previous versions of pytorch?