Return the number of vectors for an array
the number of vectors for an array
@param arr the array to calculate the number of vectors for
@return the number of vectors for the given array
766865
public static long numVectors(INDArray arr) {
        if (arr.rank() == 1)
            return 1;
        else if (arr.rank() == 2)
            return arr.size(0);
        else {
            int prod = 1;
            for (int i = 0; i < arr.rank() - 1; i++) {
                prod *= arr.size(i);
            }

            return prod;
        }
    }
412778
public static boolean wholeArrayDimension(int... arr) {
        return arr == null || arr.length == 0 || (arr.length == 1 && arr[0] == Integer.MAX_VALUE);
    }
1073832
function needRecurseArray(arr) {
  for (var i = 0; i < arr.length; i++) {
    var el = arr[i]
    if (typeof el !== 'number' && typeof el !== 'string' && el != null) return true
  }
  return false
}
241155
public static int createDims(FlatBufferBuilder bufferBuilder,INDArray arr) {
        int[] tensorDimOffsets = new int[arr.rank()];
        int[] nameOffset = new int[arr.rank()];
        for(int i = 0; i < tensorDimOffsets.length; i++) {
            nameOffset[i] = bufferBuilder.createString("");
            tensorDimOffsets[i] = TensorDim.createTensorDim(bufferBuilder,arr.size(i),nameOffset[i]);
        }

        return Tensor.createShapeVector(bufferBuilder,tensorDimOffsets);
    }
1115487
public double[][] getArray()
    {
        double[][] result = new double[getM()][];
        
        for ( int m = 0; m < getM(); m++ )
        {
           result[m] = new double[ getN() ];

           for ( int n = 0; n < getN(); n++ )
           {               
               result[m][n] = getReal(m,n);
           }
        }
        return result;
    }
70724
function(attr) {
			var newArr = [];

			if (this.arr.length === undefined) {
				// The wrapped array is a JSON object
				for (var key in arr) {
					newArr.push(this.arr[key][attr]);
				}
			} else {
				// The wrapped array is an array
				for (var i = 0, l = this.arr.length; i < l; i++) {
					newArr.push(this.arr[i][attr]);
				}
			}

			return stats(newArr);
		}
631912
public static List<String> strArrayToList(String[] arr) {
		List<String> result = new ArrayList<String>();
		if (arr == null || arr.length == 0)
			return result;
		for (String str : arr)
			result.add(str);
		return result;
	}
29281
public static function arrayContainsArrayItems($arr)
    {
        if (!self::isValidArray($arr)) {
            return false;
        }

        foreach ($arr as $item) {
            if (self::isValidArray($item)) {
                return true;
            }
        }

        return false;
    }
1287873
private static int getBytesSize(ArrayList<String> arr) {
        int count=0;
        
        for (String str : arr) {
            count = count + str.length();
        }
        return count;
    }
668306
function array_sum (arr) {
		var ans = 0;
		for (k = 0; k < arr.length; k++) {
			ans += arr[k];
		}
		return ans;
	}
108060
public static int countTrueElements(boolean[] arra) {

        int count = 0;

        for (int i = 0; i < arra.length; i++) {
            if (arra[i]) {
                count++;
            }
        }

        return count;
    }
553451
public static long matricesPerSlice(INDArray arr) {
        if (arr.rank() == 3) {
            return 1;
        } else if (arr.rank() > 3) {
            int ret = 1;
            for (int i = 1; i < arr.rank() - 2; i++) {
                ret *= arr.size(i);
            }
            return ret;
        }
        return arr.size(-2);
    }
806785
public static Boolean[] toObjectArray(boolean arr[]){
        if(arr==null)
            return null;
        
        Boolean result[] = new Boolean[arr.length];
        for(int i=arr.length-1; i>=0; i--)
            result[i] = arr[i];
        return result;
    }
661108
public static String[] appendStrArray(String[] arr, String str) {
		String[] newArr = new String[arr.length + 1];
		System.arraycopy(arr, 0, newArr, 0, arr.length);
		newArr[arr.length] = str;
		return newArr;
	}
1246229
def arr_to_vector(arr):
    
    dim = array_dim(arr)
    tmp_arr = []
    for n in range(len(dim) - 1):
        for inner in arr:
            for i in inner:
                tmp_arr.append(i)
        arr = tmp_arr
        tmp_arr = []
    return arr
493333
private int[] findArrayDimensions(List<?> list, Class<?> arrayType) {
        List<int[]> elementDims = new LinkedList<int[]>();
        int dimCount = 0;
        for (Object o : list) {
            if (o != null && o.getClass().isArray() && 
                isAssignableFromArray(arrayType, o.getClass().getComponentType())) {
                final int[] dimensions = findArrayDimensions(o);
                elementDims.add(dimensions);
                dimCount = Math.max(dimCount, dimensions.length);
            }
        }

        int[] dimsArr = new int[dimCount + 1];
        // First dimension length is always size of given list
        dimsArr[0] = list.size();
        // Find the max length of each additional dimension
        for (int[] childDim : elementDims) {
            for (int i = 0; i < childDim.length; i++) {
                dimsArr[i + 1] = Math.max(dimsArr[i + 1], childDim[i]);
            }
        }
        return dimsArr;
    }
36189
function count(arr) {
                var c = 0;
                for (var i = 0; i < arr.length; i++) {
                    c += creator[arr[i] & 0xff] + creator[(arr[i] >> 8) & 0xff] + creator[(arr[i] >> 16) & 0xff] + creator[(arr[i] >> 24) & 0xff];
                }
                return c;
            }