TensorOps_F32 { public static void fill( Tensor_F32 tensor , float value ) { Arrays.fill(tensor.d,tensor.startIndex,tensor.startIndex+tensor.length(),value); }  static void elementMult(Tensor_F32 tensor , float value  ); static void elementMult(Tensor_F32 input , float value , Tensor_F32 output ); static void elementMult(Tensor_F32 A , Tensor_F32 B , Tensor_F32 output ); static void elementAdd(Tensor_F32 A , Tensor_F32 B , Tensor_F32 output ); static float elementSum( Tensor_F32 tensor ); static void insertSubChannel( Tensor_F32 src , int srcStartIndex , int srcStride ,
										 Tensor_F32 dst , int dstStartIndex , int dstStride ,
										 int rows , int columns ); static void insertSpatial(Tensor_F32 src , int []srcCoor,
									 Tensor_F32 dst , int []dstCoor ); static void fillSpatialBorder(Tensor_F32 tensor , int[] coor ,
										 int borderY0 , int borderX0 , int borderY1 , int borderX1 ,
										 float value ); static void printSpatial( Tensor_F32 tensor , int batch , int channel ); static void fill( Tensor_F32 tensor , float value );  }
@Test public void fill() { Tensor_F32 a = new Tensor_F32(1,2,3,4); TensorOps_F32.fill(a,2.0f); for (int i = 0; i < a.d.length; i++) { assertEquals(2.0f,a.d[i], DeepBoofConstants.TEST_TOL_F32); } a = a.subtensor(5,new int[]{4}); TensorOps_F32.fill(a,3.0f); for (int i = 0; i < 5; i++) { assertEquals(2.0f,a.d[i], DeepBoofConstants.TEST_TOL_F32); } for (int i = 0; i < 4; i++) { assertEquals(3.0f,a.d[a.startIndex+i], DeepBoofConstants.TEST_TOL_F32); } }