How to convert numpy array into image and add it to images inside bpy
Here is example TestImg to which we write numpy array (in this example it is all zeros). Thing to remember if image size is 100px width 100px height, and 4 channels then numpy array size must be 100*100*4. eg:

numpy.zeroes((100,100,4), dtype = float16)


Example

if "TestImg.png" not in bpy.data.images.keys():
    bpy.data.images.new("TestImg.png", width=128, height=128, alpha=True, float_buffer=False)
outputImg = bpy.data.images["TestImg.png"] 
input_res = int(math.sqrt(outputImg.size[0]))
np_out_img = np.zeros((input_res,input_res,4), dtype = np.float16)
outputImg.pixels = np_out_img.ravel()  #flatten the array to 1 dimension and write it to testImg pixels