### Question:
TensorOps_F64 { public static void elementAdd(Tensor_F64 A , Tensor_F64 B , Tensor_F64 output ) { int indexA = A.startIndex; int endA = indexA + A.length(); int indexB = B.startIndex; if( A != output && B != output ) { int indexOut = output.startIndex; while (indexA < endA) { output.d[indexOut++] = A.d[indexA++] + B.d[indexB++]; } } else if( B == output ) { while (indexA < endA) { B.d[indexB++] += A.d[indexA++]; } } else { while (indexA < endA) { A.d[indexA++] += B.d[indexB++]; } } }  static void elementMult(Tensor_F64 tensor , double value  ); static void elementMult(Tensor_F64 input , double value , Tensor_F64 output ); static void elementMult(Tensor_F64 A , Tensor_F64 B , Tensor_F64 output ); static void elementAdd(Tensor_F64 A , Tensor_F64 B , Tensor_F64 output ); static double elementSum( Tensor_F64 tensor ); static void insertSubChannel( Tensor_F64 src , int srcStartIndex , int srcStride ,
										 Tensor_F64 dst , int dstStartIndex , int dstStride ,
										 int rows , int columns ); static void insertSpatial(Tensor_F64 src , int []srcCoor,
									 Tensor_F64 dst , int []dstCoor ); static void fillSpatialBorder(Tensor_F64 tensor , int[] coor ,
										 int borderY0 , int borderX0 , int borderY1 , int borderX1 ,
										 double value ); static void printSpatial( Tensor_F64 tensor , int batch , int channel ); static void fill( Tensor_F64 tensor , double value );  }### Answer:
@Test public void elementAdd_tensor() { List<int[]> shapes = new ArrayList<>(); shapes.add(new int[]{5}); shapes.add(new int[]{2,3,4}); for( boolean subtensor : new boolean[]{false,true}) { for( int[] shape : shapes ) { Tensor_F64 A = TensorFactory_F64.random(rand, subtensor, shape); Tensor_F64 B = TensorFactory_F64.random(rand, subtensor, shape); Tensor_F64 found = TensorFactory_F64.random(rand, subtensor, shape); Tensor_F64 expected = new Tensor_F64(shape); for (int i = 0; i < A.length(); i++) { expected.d[expected.startIndex+i] = A.d[A.startIndex+i] + B.d[B.startIndex+i]; } TensorOps_F64.elementAdd(A,B,found); DeepUnitTest.assertEquals(expected,found,DeepBoofConstants.TEST_TOL_F64); } } }