Can i have sex

Patient: So I had a baby on feb 24 that did not make it I was 5 months. When I delivered him he was 11oz 12inches long is it safe to have anal or vaginal sex and its been 3 weeks. It was a natural birth with no rips or tears can I have sex