Similar to :func:`_pull_out_perm_lhs` but on the RHS of a series
    product self-feedback.
487286
def _pull_out_perm_rhs(rest, rhs, out_port, in_port):
    """"""
    in_im, rhs_red = rhs._factor_rhs(in_port)
    return (Feedback.create(
                SeriesProduct.create(*rest),
                out_port=out_port, in_port=in_im) << rhs_red)
770333
def annealing_linear(start:Number, end:Number, pct:float)->Number:
    ""
    return start + pct * (end-start)
864361
def _product(*args, **kwds):
    

    pools = map(tuple, args) * kwds.get('repeat', 1)
    result = [[]]
    for pool in pools:
        result = [x+[y] for x in result for y in pool]
    return result
385370
def _backward_sampling_ON2(self, M, idx):
        
        for m in range(M):
            for t in reversed(range(self.T - 1)):
                lwm = (self.wgt[t].lw + self.model.logpt(t + 1, self.X[t],
                                                     self.X[t + 1][idx[t + 1, m]]))
                idx[t, m] = rs.multinomial_once(rs.exp_and_normalise(lwm))
582196
def feedforward(self):
    
    m = self._numInputs
    n = self._numColumns
    W = np.zeros((n, m))
    for i in range(self._numColumns):
        self.getPermanence(i, W[i, :])

    return W
754983
def rhochange(self):
        """"""

        if self.opt['HighMemSolve'] and self.cri.Cd == 1:
            self.c = sl.solvedbd_sm_c(
                self.Df, np.conj(self.Df),
                (self.mu / self.rho) * self.GHGf + 1.0, self.cri.axisM)
450563
def on_backward_end(self, **kwargs):
        ""
        if (self.acc_batches % self.n_step) == 0:
            for p in (self.learn.model.parameters()):
                if p.requires_grad: p.grad.div_(self.acc_samples)
            self.acc_samples = 0
        else: return {'skip_step':True, 'skip_zero':True}
1059134
def from_series(series):
        
        result = PercentRankTransform()
        result.cdf = series.values
        result.bin_edges = series.index.values[1:-1]
        return result
1105208
def _series_expand_combine_prod(c1, c2, order):
    
    from qnet.algebra.core.scalar_algebra import Zero
    res = []
    c1 = list(c1)
    c2 = list(c2)
    for n in range(order + 1):
        summands = []
        for k in range(n + 1):
            if c1[k].is_zero or c2[n-k].is_zero:
                summands.append(Zero)
            else:
                summands.append(c1[k] * c2[n - k])
        sum = summands[0]
        for summand in summands[1:]:
            if summand != 0:
                sum += summand
        res.append(sum)
    return tuple(res)
336146
def on_backward_begin(self, last_loss:Rank0Tensor, **kwargs:Any) -> Rank0Tensor:
        ""
        #To avoid gradient underflow, we scale the gradients
        ret_loss = last_loss * self.loss_scale
        return {'last_loss': ret_loss}
1372857
def _prod(group_idx, a, size, fill_value, dtype=None):
    """"""
    dtype = minimum_dtype_scalar(fill_value, dtype, a)
    ret = np.full(size, fill_value, dtype=dtype)
    if fill_value != 1:
        ret[group_idx] = 1  # product should start from 1
    np.multiply.at(ret, group_idx, a)
    return ret
572857
def product(sequence, initial=1):
    """"""
    if not isinstance(sequence, collections.Iterable):
        raise TypeError("'{}' object is not iterable".format(type(sequence).__name__))

    return reduce(operator.mul, sequence, initial)
1352692
def batch_per(hyps: Sequence[Sequence[T]],
              refs: Sequence[Sequence[T]]) -> float:
    

    macro_per = 0.0
    for i in range(len(hyps)):
        ref = [phn_i for phn_i in refs[i] if phn_i != 0]
        hyp = [phn_i for phn_i in hyps[i] if phn_i != 0]
        macro_per += distance.edit_distance(ref, hyp)/len(ref)
    return macro_per/len(hyps)
563224
def rhochange(self):
        """"""

        self.lu, self.piv = sl.cho_factor(self.D, self.rho)
        self.lu = np.asarray(self.lu, dtype=self.dtype)
409493
def standartDeviation(self, series, start, limit):
        '''
        
        '''
        return float(np.std(series[start:limit]))
529613
def _expand_dims(x, input_shape, output_shape):
  
  verify_no_new_dims([output_shape], input_shape)
  if input_shape == output_shape or input_shape.ndims == 0:
    return x
  perm = [input_shape.dims.index(d) for d in output_shape.dims
          if d in input_shape.dims]
  x = tf.transpose(x, perm)
  for i, d in enumerate(output_shape.dims):
    if d not in input_shape.dims:
      x = tf.expand_dims(x, i)
  return x
378267
def _build_rhs(p, q, deriv):
    """"""

    b = [0 for _ in range(p+q+1)]
    b[deriv] = math.factorial(deriv)
    return np.array(b)