Tensor extends BaseTensor { public void setTo( T original ) { reshape(original.getShape()); System.arraycopy(original.getData(), original.startIndex, getData(), startIndex, length()); }  abstract double getDouble( int ...coordinate ); abstract Object getData(); abstract void setData( Object data ); void reshape(int... shape); void reshape( int length0 ); void reshape( int length1 , int length0); void reshape( int length2 , int length1 , int length0 ); void reshape( int length3 , int length2 , int length1 , int length0 ); void reshape( int length4 , int length3 , int length2 , int length1 , int length0 ); void reshape(); int idx(int ...coordinate ); int idx(int axis0 ); int idx(int axis1, int axis0 ); int idx(int axis2, int axis1 , int axis0 ); int idx(int axis3, int axis2 , int axis1 , int axis0 ); int idx(int axis4, int axis3 , int axis2 , int axis1 , int axis0 ); void computeStrides(); int stride( int index ); void copyShape( int shape[] ); int length(int dimension ); int length(); abstract T create( int ...shape ); T createLike(); int[] createCoor(); int[] indexToCoor( int index , int []storage ); void setTo( T original ); abstract void zero(); T copy(); boolean isSub(); T subtensor(int startIndex, int[] shape); public int startIndex; public boolean subtensor; public int strides; }
@Test public void setTo() { Dummy tensor = new Dummy(); tensor.reshape(3,2,4); tensor.data[5] = 7; Dummy found = new Dummy(); found.reshape(3,2,4); found.setTo(tensor); assertTrue(tensor.isShape(found.getShape())); assertTrue(7 == found.data[5]); }