Performs avg pooling on the input.
193245
def global_avgpooling(attrs, inputs, proto_obj):
    """"""
    new_attrs = translation_utils._add_extra_attributes(attrs, {'global_pool': True,
                                                                'kernel': (1, 1),
                                                                'pool_type': 'avg'})
    return 'Pooling', new_attrs, inputs
651546
def MaxPooling(
        inputs,
        pool_size,
        strides=None,
        padding='valid',
        data_format='channels_last'):
    
    if strides is None:
        strides = pool_size
    layer = tf.layers.MaxPooling2D(pool_size, strides, padding=padding, data_format=data_format)
    ret = layer.apply(inputs, scope=tf.get_variable_scope())
    return tf.identity(ret, name='output')
915404
public static double avg( List<SimpleFeature> features, String field ) {
        double sum = 0;
        int count = 0;
        for( SimpleFeature feature : features ) {
            Object attribute = feature.getAttribute(field);
            if (attribute instanceof Number) {
                sum = sum + ((Number) attribute).doubleValue();
                count++;
            }
        }
        double avg = sum / count;
        return avg;
    }
609617
@Override
    public INDArray average(INDArray target, INDArray[] arrays) {
        if (arrays == null || arrays.length == 0)
            throw new RuntimeException("Input arrays are missing");

        if (arrays.length == 1) {
            //Edge case - average 1 array - no op
            if(target == null){
                return null;
            }
            return target.assign(arrays[0]);
        }

        long len = target != null ? target.lengthLong() : arrays[0].length();

        PointerPointer dataPointers = new PointerPointer(arrays.length);
        val firstType = arrays[0].dataType();

        for (int i = 0; i < arrays.length; i++) {
            Nd4j.getCompressor().autoDecompress(arrays[i]);

            Preconditions.checkArgument(arrays[i].dataType() == firstType, "All arrays must have the same data type");

            if (arrays[i].elementWiseStride() != 1)
                throw new ND4JIllegalStateException("Native averaging is applicable only to continuous INDArrays");

            if (arrays[i].lengthLong() != len)
                throw new ND4JIllegalStateException("All arrays should have equal length for averaging");

            dataPointers.put(i, arrays[i].data().addressPointer());
        }


        nativeOps.average(null,
                dataPointers, (LongPointer) arrays[0].shapeInfoDataBuffer().addressPointer(),
                null, null,
                target == null ? null : target.data().addressPointer(), target == null ? null : (LongPointer) target.shapeInfoDataBuffer().addressPointer(),
                null, null,
                arrays.length,
                    len,
                true);

        return target;
    }
689220
function avg(arr) {
    arr = arr || [];
    if (arr.length) {
        var total = sum(arr);
        if (number.isNumber(total)) {
            return total / arr.length;
        } else {
            throw new Error("Cannot average an array of non numbers.");
        }
    } else {
        return 0;
    }
}
1357904
def _pooling_general(inputs, reducer, init_val, rescaler=None,
                     pool_size=(2, 2), strides=None, padding='VALID'):
  """"""
  spatial_strides = strides or (1,) * len(pool_size)
  rescale = rescaler(pool_size, spatial_strides, padding) if rescaler else None
  dims = (1,) + pool_size + (1,)  # NHWC
  strides = (1,) + spatial_strides + (1,)
  out = lax.reduce_window(inputs, init_val, reducer, dims, strides, padding)
  return rescale(out, inputs) if rescale else out
1358863
def avg_bp_from_range(self, bp):
        

        try:
            if '-' in bp:
                maxlen = float(bp.split("-",1)[1])
                minlen = float(bp.split("-",1)[0])
                bp = ((maxlen - minlen)/2) + minlen
        except TypeError:
            pass
        return(int(bp))
235608
def moving_avg_conv(a, length):
    
    boxcar = np.ones(length)/length
    return np.convolve(a, boxcar, mode="same")
529832
function avgCpuLoad (span, cb) {
  if (typeof span !== 'number' || span < 0) span = 100
  var start = os.cpus()

  setTimeout(function avgCpuLoadCompare () {
    var totals = os.cpus().reduce(function (totals, end, i) {
      var busy = end.times.user + end.times.sys - start[i].times.user - start[i].times.sys
      totals.total += busy + end.times.idle - start[i].times.idle
      totals.busy += busy
      return totals
    }, {busy: 0, total: 0})

    cb(totals.busy / totals.total)
  }, span)
}
8761
public void accumulate(Object workingMemoryContext,
                           Object context,
                           Tuple leftTuple,
                           InternalFactHandle handle,
                           Declaration[] declarations,
                           Declaration[] innerDeclarations,
                           WorkingMemory workingMemory) throws Exception {
        Object value = this.unwrapHandle ? ((LeftTuple) handle.getObject()).getFactHandle().getObject() : handle.getObject();
        ((CollectContext) context).result.add( value );
    }
586094
def avg(self, vars_list: List[str]) -> 'TensorFluent':
        '''
        '''
        operand = self
        if operand.dtype == tf.bool:
            operand = operand.cast(tf.float32)
        return self._aggregation_op(tf.reduce_mean, operand, vars_list)
105584
def mpool(self,
              k_height,
              k_width,
              d_height=2,
              d_width=2,
              mode="VALID",
              input_layer=None,
              num_channels_in=None):
        """"""
        return self._pool("mpool", pooling_layers.max_pooling2d, k_height,
                          k_width, d_height, d_width, mode, input_layer,
                          num_channels_in)
512135
def average(self, default=None):
        
        return numpy.asscalar(numpy.average(self.values)) if self.values else default
1016289
def compute(self, inputs, outputs):
    
    if len(self.queue) > 0:
      # Take the top element of the data queue
      data = self.queue.pop()
    else:
      raise Exception("RawValues: No data: queue is empty ")

    # Copy data into output vectors
    outputs["resetOut"][0] = data["reset"]
    outputs["dataOut"][:] = data["dataOut"]
1099677
public static double avg(Array array) throws ExpressionException {
	if (array.size() == 0) return 0;
	return sum(array) / array.size();
    }
523678
@Override
	public AverageClusteringCoefficient<K, VV, EV> run(Graph<K, VV, EV> input)
			throws Exception {
		super.run(input);

		DataSet<LocalClusteringCoefficient.Result<K>> localClusteringCoefficient = input
			.run(new LocalClusteringCoefficient<K, VV, EV>()
				.setParallelism(parallelism));

		averageClusteringCoefficientHelper = new AverageClusteringCoefficientHelper<>();

		localClusteringCoefficient
			.output(averageClusteringCoefficientHelper)
				.name("Average clustering coefficient");

		return this;
	}
906435
public SDVariable maxPooling3d(SDVariable input, Pooling3DConfig pooling3DConfig) {
        pooling3DConfig.setType(Pooling3D.Pooling3DType.MAX);
        return pooling3d(input, pooling3DConfig);
    }