@Test
public void insertSpatial() {

	for( boolean subtensor : new boolean[]{false,true}) {
		int C = 3;
		int H = 10;
		int W = 15;
		Tensor_F32 src = TensorFactory_F32.random(rand, subtensor, C, H, W);
		Tensor_F32 dst = TensorFactory_F32.random(rand, subtensor, C, H, W);
		int[] coorSrc = new int[3];
		int[] coorDst = new int[3];
		TensorOps_F32.insertSpatial(src, coorSrc, dst, coorDst);
		checkSpatial(src, coorSrc, dst, coorDst);
		// increase the dimensions in dst
		dst = TensorFactory_F32.random(rand, subtensor, 10, C, H, W);
		coorDst = new int[]{5, 0, 0, 0};
		TensorOps_F32.insertSpatial(src, coorSrc, dst, coorDst);
		checkSpatial(src, coorSrc, dst, coorDst);
		// increase the dimension in src
		src = TensorFactory_F32.random(rand, subtensor, 4, C, H, W);
		coorSrc = new int[]{1, 0, 0, 0};
		TensorOps_F32.insertSpatial(src, coorSrc, dst, coorDst);
		checkSpatial(src, coorSrc, dst, coorDst);
		// paste it inside dst, which is now larger than src
		dst = TensorFactory_F32.random(rand, subtensor, 10, C, H+4, W+6);
		coorDst = new int[]{5, 0, 1, 2};
		TensorOps_F32.insertSpatial(src, coorSrc, dst, coorDst);
		checkSpatial(src, coorSrc, dst, coorDst);
		// Swap width and height
		src = TensorFactory_F32.random(rand, subtensor, C, W, H);
		dst = TensorFactory_F32.random(rand, subtensor, 10, C, W+6, H+4);
		coorSrc = new int[3];
		coorDst = new int[]{5, 0, 1, 2};
		TensorOps_F32.insertSpatial(src, coorSrc, dst, coorDst);
		checkSpatial(src, coorSrc, dst, coorDst);
	}
}