The number looks a lot like -6 mod 2**32, so it might be signedness issue.
Maybe the change to feeding negative numbers to permute in
  
      github.com/pytorch/pytorch
  
  
    
  
    
  

  
    
      [pytorch] Expand PixelShuffle to support any number of batch dims 2
    

    
      pytorch:master ← jbschlosser:export-D25399058
    

    
      
        opened 
        
          
        
        Dec 10, 2020
      
      

      
        
          
          jbschlosser
        
      

      
        
          +107
          -38
        
      
    

  


  
  
    
    
  
  


didn’t go well.
To make things specific, -something.size() seems very dubious in C++:

  
      github.com
  
  
    pytorch/pytorch/blob/603097be18824a33069addec7b8f14ba5c3bc67a/aten/src/ATen/native/PixelShuffle.cpp#L103

      self.sizes().begin(), self_sizes_batch_end);
  added_dims_shape.insert(
      added_dims_shape.end(), {c, oh, downscale_factor, ow, downscale_factor});
  const auto input_reshaped = self.reshape(added_dims_shape);

  // Next, unshuffle by permuting the downscale_factor dims alongside the channel dim.
  std::vector<int64_t> permutation(self.sizes().begin(), self_sizes_batch_end);
  // std::iota is used to maintain the batch dims within the permutation.
  // Since 2 dims were added, the correct batch dim offsets are now:
  // -added_dims_shape.size(), ..., -7, -6.
  std::iota(permutation.begin(), permutation.end(), -added_dims_shape.size());
  permutation.insert(permutation.end(), {-5 /* c */, -3 /* 1st downscale_factor */, -1 /*2nd downscale_factor */,
                                         -4 /* oh */, -2 /* ow */});
  const auto input_permuted = input_reshaped.permute(permutation);

  // Finally, downscale by collapsing (c, downscale_factor, downscale_factor) -> a single dim (oc),
  // resulting in height=oh and width=ow.
  std::vector<int64_t> final_shape(self.sizes().begin(), self_sizes_batch_end);
  final_shape.insert(final_shape.end(), {oc, oh, ow});
  return input_permuted.reshape(final_shape);
}



  
  
    
    
  
  


@jbschlosser , what do you think?
Best regards
Thomas