import time import numpy as np start = time.perf_counter() b = np.random.rand(512,256).astype(np.float32) c = np.tile(b[np.newaxis,:,:,np.newaxis], [100,1,1,3]) print(time.perf_counter() - start) start = time.perf_counter() e = np.random.rand(512,256).astype(np.float32) f = np.ones((100,512,256,3)) * b[np.newaxis,:,:,np.newaxis] print(time.perf_counter() - start) print() # start = time.perf_counter() # a = a * b[np.newaxis,:,:,np.newaxis] # print(time.perf_counter() - start) # start = time.perf_counter() # d = a * b[np.newaxis,:,:,np.newaxis] # print(time.perf_counter() - start) # start = time.perf_counter() # a *= c # print(time.perf_counter() - start)