I believe this should work for the _copy (at assignment) warning :

  
    
    
    Unable to convert PyTorch model to onnx deployment
  
  
    Hello. I have some troubles in converting my yolo model to onnx format. 
I have next errors: 
C:\Users\1\PycharmProjects\untitled\my_utils.py:145: TracerWarning: There are 3 live references to the data region being modified when tracing in-place operator copy_ (possibly due to an assignment). This might cause the trace to be incorrect, because all other views that also reference this data will not reflect this change in the trace! On the other hand, if all other views use the same memory chunk, …
  



There cannot be any in-place assignment, like:

pred[:, :, 0] = torch.sigmoid(pred[:, :, 0])

I think that you need to modify it as:


pred = torch.cat((torch.sigmoid(pred[:, :, 0:1]), pred[:, :, 1:]), dim=2)


Anyway, slicing cannot occur on the left side of “=”

But how do I fix
TracerWarning: There are 2 live references to the data region being modified when tracing in-place operator clamp_. This might cause the trace to be incorrect, because all other views that also reference this data will not reflect this change in the trace! On the other hand, if all other views use the same memory chunk, but are disjoint (e.g. are outputs of torch.split), this might still be safe.
boxes[i,:,3::4].clamp_(0, im_shape[i, 0]-1)