numpy.floor

Here are the examples of the python api numpy.floor taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1569 Examples 7

3 Source : dataset.py
with GNU General Public License v3.0
from AaltoVision

    def __len__(self):

        return np.floor((self.limits[-1]-1)/100)
    
    # read a sample of 100 measurements, avoiding the edges of the diferent captures.
    def __getitem__(self, idx):

3 Source : nn.py
with GNU General Public License v3.0
from acamero

    def __len__(self):
        """Number of batch in the Sequence.
        # Returns
            The number of batches in the Sequence.
        """
        # We round to the floor, therefore we "skip" some data.
        # As a work around, the remainder is added to the last batch
        return int(np.floor(
            (self.df.shape[0] - self.look_back) / self.batch_size))

    def on_epoch_end(self):

3 Source : nn.py
with GNU General Public License v3.0
from acamero

    def __len__(self):
        """Number of batch in the Sequence.
        # Returns
            The number of batches in the Sequence.
        """
        # We round to the floor, therefore we "skip" some data.
        # As a work around, the remainder is added to the last batch
        return int(np.floor(
            (len(self.tokens_sequence) - self.look_back) / self.batch_size))

    def on_epoch_end(self):

3 Source : step_decay_schedule.py
with MIT License
from ad71

def step_decay_schedule(lr=1e-3, lr_decay=0.75, step_size=10):
	''' Simple step-decay scheduler '''
	def schedule(epoch):
		return lr * (lr_decay ** np.floor(epoch / step_size))

	return LearningRateScheduler(schedule)

3 Source : basic.py
with GNU General Public License v3.0
from adityaprakash-bobby

def _nonneg_int_or_fail(n, var_name, strict=True):
    try:
        if strict:
            # Raises an exception if float
            n = operator.index(n)
        elif n == floor(n):
            n = int(n)
        else:
            raise ValueError()
        if n   <   0:
            raise ValueError()
    except (ValueError, TypeError) as err:
        raise err.__class__("{} must be a non-negative integer".format(var_name))
    return n


def diric(x, n):

3 Source : basic.py
with GNU General Public License v3.0
from adityaprakash-bobby

def erf_zeros(nt):
    """Compute nt complex zeros of error function erf(z).

    References
    ----------
    .. [1] Zhang, Shanjie and Jin, Jianming. "Computation of Special
           Functions", John Wiley and Sons, 1996.
           https://people.sc.fsu.edu/~jburkardt/f_src/special_functions/special_functions.html

    """
    if (floor(nt) != nt) or (nt   <  = 0) or not isscalar(nt):
        raise ValueError("Argument must be positive scalar integer.")
    return specfun.cerzo(nt)


def fresnelc_zeros(nt):

3 Source : basic.py
with GNU General Public License v3.0
from adityaprakash-bobby

def fresnelc_zeros(nt):
    """Compute nt complex zeros of cosine Fresnel integral C(z).

    References
    ----------
    .. [1] Zhang, Shanjie and Jin, Jianming. "Computation of Special
           Functions", John Wiley and Sons, 1996.
           https://people.sc.fsu.edu/~jburkardt/f_src/special_functions/special_functions.html

    """
    if (floor(nt) != nt) or (nt   <  = 0) or not isscalar(nt):
        raise ValueError("Argument must be positive scalar integer.")
    return specfun.fcszo(1, nt)


def fresnels_zeros(nt):

3 Source : basic.py
with GNU General Public License v3.0
from adityaprakash-bobby

def fresnels_zeros(nt):
    """Compute nt complex zeros of sine Fresnel integral S(z).

    References
    ----------
    .. [1] Zhang, Shanjie and Jin, Jianming. "Computation of Special
           Functions", John Wiley and Sons, 1996.
           https://people.sc.fsu.edu/~jburkardt/f_src/special_functions/special_functions.html

    """
    if (floor(nt) != nt) or (nt   <  = 0) or not isscalar(nt):
        raise ValueError("Argument must be positive scalar integer.")
    return specfun.fcszo(2, nt)


def fresnel_zeros(nt):

3 Source : basic.py
with GNU General Public License v3.0
from adityaprakash-bobby

def fresnel_zeros(nt):
    """Compute nt complex zeros of sine and cosine Fresnel integrals S(z) and C(z).

    References
    ----------
    .. [1] Zhang, Shanjie and Jin, Jianming. "Computation of Special
           Functions", John Wiley and Sons, 1996.
           https://people.sc.fsu.edu/~jburkardt/f_src/special_functions/special_functions.html

    """
    if (floor(nt) != nt) or (nt   <  = 0) or not isscalar(nt):
        raise ValueError("Argument must be positive scalar integer.")
    return specfun.fcszo(2, nt), specfun.fcszo(1, nt)


def assoc_laguerre(x, n, k=0.0):

3 Source : basic.py
with GNU General Public License v3.0
from adityaprakash-bobby

def ber_zeros(nt):
    """Compute nt zeros of the Kelvin function ber(x).

    References
    ----------
    .. [1] Zhang, Shanjie and Jin, Jianming. "Computation of Special
           Functions", John Wiley and Sons, 1996.
           https://people.sc.fsu.edu/~jburkardt/f_src/special_functions/special_functions.html

    """
    if not isscalar(nt) or (floor(nt) != nt) or (nt   <  = 0):
        raise ValueError("nt must be positive integer scalar.")
    return specfun.klvnzo(nt, 1)


def bei_zeros(nt):

3 Source : basic.py
with GNU General Public License v3.0
from adityaprakash-bobby

def bei_zeros(nt):
    """Compute nt zeros of the Kelvin function bei(x).

    References
    ----------
    .. [1] Zhang, Shanjie and Jin, Jianming. "Computation of Special
           Functions", John Wiley and Sons, 1996.
           https://people.sc.fsu.edu/~jburkardt/f_src/special_functions/special_functions.html

    """
    if not isscalar(nt) or (floor(nt) != nt) or (nt   <  = 0):
        raise ValueError("nt must be positive integer scalar.")
    return specfun.klvnzo(nt, 2)


def ker_zeros(nt):

3 Source : basic.py
with GNU General Public License v3.0
from adityaprakash-bobby

def ker_zeros(nt):
    """Compute nt zeros of the Kelvin function ker(x).

    References
    ----------
    .. [1] Zhang, Shanjie and Jin, Jianming. "Computation of Special
           Functions", John Wiley and Sons, 1996.
           https://people.sc.fsu.edu/~jburkardt/f_src/special_functions/special_functions.html

    """
    if not isscalar(nt) or (floor(nt) != nt) or (nt   <  = 0):
        raise ValueError("nt must be positive integer scalar.")
    return specfun.klvnzo(nt, 3)


def kei_zeros(nt):

3 Source : basic.py
with GNU General Public License v3.0
from adityaprakash-bobby

def kei_zeros(nt):
    """Compute nt zeros of the Kelvin function kei(x).
    """
    if not isscalar(nt) or (floor(nt) != nt) or (nt   <  = 0):
        raise ValueError("nt must be positive integer scalar.")
    return specfun.klvnzo(nt, 4)


def berp_zeros(nt):

3 Source : basic.py
with GNU General Public License v3.0
from adityaprakash-bobby

def berp_zeros(nt):
    """Compute nt zeros of the Kelvin function ber'(x).

    References
    ----------
    .. [1] Zhang, Shanjie and Jin, Jianming. "Computation of Special
           Functions", John Wiley and Sons, 1996.
           https://people.sc.fsu.edu/~jburkardt/f_src/special_functions/special_functions.html

    """
    if not isscalar(nt) or (floor(nt) != nt) or (nt   <  = 0):
        raise ValueError("nt must be positive integer scalar.")
    return specfun.klvnzo(nt, 5)


def beip_zeros(nt):

3 Source : basic.py
with GNU General Public License v3.0
from adityaprakash-bobby

def beip_zeros(nt):
    """Compute nt zeros of the Kelvin function bei'(x).

    References
    ----------
    .. [1] Zhang, Shanjie and Jin, Jianming. "Computation of Special
           Functions", John Wiley and Sons, 1996.
           https://people.sc.fsu.edu/~jburkardt/f_src/special_functions/special_functions.html

    """
    if not isscalar(nt) or (floor(nt) != nt) or (nt   <  = 0):
        raise ValueError("nt must be positive integer scalar.")
    return specfun.klvnzo(nt, 6)


def kerp_zeros(nt):

3 Source : basic.py
with GNU General Public License v3.0
from adityaprakash-bobby

def kerp_zeros(nt):
    """Compute nt zeros of the Kelvin function ker'(x).

    References
    ----------
    .. [1] Zhang, Shanjie and Jin, Jianming. "Computation of Special
           Functions", John Wiley and Sons, 1996.
           https://people.sc.fsu.edu/~jburkardt/f_src/special_functions/special_functions.html

    """
    if not isscalar(nt) or (floor(nt) != nt) or (nt   <  = 0):
        raise ValueError("nt must be positive integer scalar.")
    return specfun.klvnzo(nt, 7)


def keip_zeros(nt):

3 Source : basic.py
with GNU General Public License v3.0
from adityaprakash-bobby

def keip_zeros(nt):
    """Compute nt zeros of the Kelvin function kei'(x).

    References
    ----------
    .. [1] Zhang, Shanjie and Jin, Jianming. "Computation of Special
           Functions", John Wiley and Sons, 1996.
           https://people.sc.fsu.edu/~jburkardt/f_src/special_functions/special_functions.html

    """
    if not isscalar(nt) or (floor(nt) != nt) or (nt   <  = 0):
        raise ValueError("nt must be positive integer scalar.")
    return specfun.klvnzo(nt, 8)


def kelvin_zeros(nt):

3 Source : test_mpmath.py
with GNU General Public License v3.0
from adityaprakash-bobby

    def test_lgam1p(self):
        def param_filter(x):
            # Filter the poles
            return np.where((np.floor(x) == x) & (x   <  = 0), False, True)

        def mp_lgam1p(z):
            # The real part of loggamma is log(|gamma(z)|)
            return mpmath.loggamma(1 + z).real

        assert_mpmath_equal(_lgam1p,
                            mp_lgam1p,
                            [Arg()], rtol=1e-13, dps=100,
                            param_filter=param_filter)

    def test_loggamma(self):

3 Source : _continuous_distns.py
with GNU General Public License v3.0
from adityaprakash-bobby

    def _argcheck(self, a):
        allint = np.all(np.floor(a) == a)
        allpos = np.all(a > 0)
        if not allint:
            # An Erlang distribution shouldn't really have a non-integer
            # shape parameter, so warn the user.
            warnings.warn(
                'The shape parameter of the erlang distribution '
                'has been given a non-integer value %r.' % (a,),
                RuntimeWarning)
        return allpos

    def _fitstart(self, data):

3 Source : _discrete_distns.py
with GNU General Public License v3.0
from adityaprakash-bobby

    def _logpmf(self, x, n, p):
        k = floor(x)
        combiln = (gamln(n+1) - (gamln(k+1) + gamln(n-k+1)))
        return combiln + special.xlogy(k, p) + special.xlog1py(n-k, -p)

    def _pmf(self, x, n, p):

3 Source : _discrete_distns.py
with GNU General Public License v3.0
from adityaprakash-bobby

    def _cdf(self, x, n, p):
        k = floor(x)
        vals = special.bdtr(k, n, p)
        return vals

    def _sf(self, x, n, p):

3 Source : _discrete_distns.py
with GNU General Public License v3.0
from adityaprakash-bobby

    def _sf_skip(self, x, n, p):
        # skip because special.nbdtrc doesn't work for 0  <  n < 1
        k = floor(x)
        return special.nbdtrc(k, n, p)

    def _ppf(self, q, n, p):

3 Source : _discrete_distns.py
with GNU General Public License v3.0
from adityaprakash-bobby

    def _cdf(self, x, a):
        k = floor(x)
        f = lambda k, a: 1.0 - exp(-a * k) / (exp(a) + 1)
        f2 = lambda k, a: exp(a * (k+1)) / (exp(a) + 1)
        return _lazywhere(k >= 0, (k, a), f=f, f2=f2)

    def _ppf(self, q, a):

3 Source : _discrete_distns.py
with GNU General Public License v3.0
from adityaprakash-bobby

    def _cdf(self, x, mu1, mu2):
        x = floor(x)
        px = np.where(x   <   0,
                _ncx2_cdf(2*mu2, -2*x, 2*mu1),
                1-_ncx2_cdf(2*mu1, 2*(x+1), 2*mu2))
        return px

    def _stats(self, mu1, mu2):

3 Source : _distn_infrastructure.py
with GNU General Public License v3.0
from adityaprakash-bobby

    def _cdf(self, x, *args):
        k = floor(x)
        return self._cdfvec(k, *args)

    # generic _logcdf, _sf, _logsf, _ppf, _isf, _rvs defined in rv_generic

    def rvs(self, *args, **kwargs):

3 Source : ssf_env.py
with GNU General Public License v3.0
from agakshat

    def reset(self):
        self.g = sf.Game(self.gametype, width=self.w, height=self.h, viewport=self.viewport, lw=self.ls, grayscale=True)
        self.max_ticks = np.floor(self.g.max_time / self.tickdur)
        self.raw_pixels = self.g.pb_pixels
        self.g.draw()
        if self.obs_type == 'image':
            self.observation_space = spaces.Box(low=0, high=255, shape=(self.g.pb_height, self.g.pb_width, 3),dtype=np.uint8)

            self.game_state = cv2.cvtColor(np.asarray(self.raw_pixels, np.uint8).reshape(self.h, self.w, 4), cv2.COLOR_RGBA2GRAY)
            self.game_gray_rgb = cv2.cvtColor(self.game_state,cv2.COLOR_GRAY2RGB)
            state = self.game_state
        else:
            self.observation_space = spaces.Box(low=-np.inf, high=np.inf, shape=self._get_features().shape,dtype=np.uint8)
            self.game_state = np.array([])
            state = self._get_features()
        return state

    def render(self, mode='human', close=False):

3 Source : utils.py
with MIT License
from ajnisbet

def base_floor(x, base=1):
    """Round number down to nearest multiple of base."""
    return base * np.floor(x / base)


def decimal_base_floor(x, base=1):

3 Source : test_utils.py
with MIT License
from ajnisbet

    def test_base_1_default(self):
        values = [-1, 0, 1, -0.6, -0.4, 0.4, 0.6, 99.91]
        for x in values:
            assert np.floor(x) == utils.base_floor(x)
            assert np.floor(x) == utils.base_floor(x, 1)

    def test_other_base(self):

3 Source : test_utils.py
with MIT License
from ajnisbet

    def test_base_1_default(self):
        values = [-1, 0, 1, -0.6, -0.4, 0.4, 0.6, 99.91]
        for x in values:
            assert np.floor(x) == utils.decimal_base_floor(x)
            assert np.floor(x) == utils.decimal_base_floor(x, 1)

    def test_other_base(self):

3 Source : spectrogram.py
with MIT License
from alakise

def stft(sig, frame_size, overlap_factor=0.5, window=np.hanning):
    win = window(frame_size)
    hop_size = int(frame_size - np.floor(overlap_factor * frame_size))

    # zeros at beginning (thus center of 1st window should be for sample nr. 0)   
    samples = np.append(np.zeros(int(np.floor(frame_size / 2.0))), sig)
    # cols for windowing
    cols = np.ceil((len(samples) - frame_size) / float(hop_size)) + 1
    # zeros at end (thus samples can be fully covered by frames)
    samples = np.append(samples, np.zeros(frame_size))

    frames = stride_tricks.as_strided(samples, shape=(int(cols), frame_size), strides=(samples.strides[0] * hop_size, samples.strides[0])).copy()
    frames *= win

    return np.fft.rfft(frames)    

def log_scale_spec(spec, sr=44100, factor=20.):

3 Source : main.py
with Apache License 2.0
from aliya-rahmani

def handle_event(pause, newGameStatus):
    running = True
    events = pygame.event.get()
    for ev in events:
        if ev.type == pygame.QUIT:
            running = False
        elif ev.type == pygame.KEYDOWN and ev.key == pygame.K_SPACE:
            pause = not pause

        mouseClick = pygame.mouse.get_pressed()
        if sum(mouseClick) > 0:
            x, y = pygame.mouse.get_pos()
            i, j = int(np.floor(x / l)), int(np.floor(y / l))
            newGameStatus[i,j] = not mouseClick[2]
    return pause, running

def game():

3 Source : cvtypes.py
with MIT License
from alkasm

    def bounding_rect(self) -> Rect:
        """returns the minimal rectangle containing the rotated rectangle"""
        pts = self.points()
        r = Rect.from_points(
            Point(np.floor(min(pt.x for pt in pts)), np.floor(min(pt.y for pt in pts))),
            Point(np.ceil(max(pt.x for pt in pts)), np.ceil(max(pt.y for pt in pts))),
        )
        return r

    def points(self) -> Tuple[Point, Point, Point, Point]:

3 Source : box_np_ops.py
with Apache License 2.0
from AllenPeng0209

def limit_period(val, offset=0.5, period=np.pi):
    """Limit the value into a period for periodic function.

    Args:
        val (np.ndarray): The value to be converted.
        offset (float, optional): Offset to set the value range. \
            Defaults to 0.5.
        period (float, optional): Period of the value. Defaults to np.pi.

    Returns:
        torch.Tensor: Value in the range of \
            [-offset * period, (1-offset) * period]
    """
    return val - np.floor(val / period + offset) * period


def create_anchors_3d_range(feature_size,

3 Source : ParticleSwarmOptimization.py
with MIT License
from AluBhorta

    def _get_new_velocity(self, particle: Particle, weight, gbest_position):
        velo_fractional = \
            self.__velo_comp_intertia(weight, particle.velocity) + \
            self.__velo_comp_cognitive(particle.pbest_position, particle.position) + \
            self.__velo_comp_social(gbest_position, particle.position)

        velo_decimal = np.array([np.floor(i).astype(int)
                                 for i in velo_fractional])
        # print(f"velo:\n{velo_decimal}")
        return velo_decimal

    def __velo_comp_intertia(self, w, V):

3 Source : axis.py
with MIT License
from alvarobartt

    def get_tick_space(self):
        ends = self.axes.transAxes.transform([[0, 0], [1, 0]])
        length = ((ends[1][0] - ends[0][0]) / self.axes.figure.dpi) * 72.0
        tick = self._get_tick(True)
        # There is a heuristic here that the aspect ratio of tick text
        # is no more than 3:1
        size = tick.label1.get_size() * 3
        if size > 0:
            return int(np.floor(length / size))
        else:
            return 2**31 - 1


class YAxis(Axis):

3 Source : axis.py
with MIT License
from alvarobartt

    def get_tick_space(self):
        ends = self.axes.transAxes.transform([[0, 0], [0, 1]])
        length = ((ends[1][1] - ends[0][1]) / self.axes.figure.dpi) * 72.0
        tick = self._get_tick(True)
        # Having a spacing of at least 2 just looks good.
        size = tick.label1.get_size() * 2.0
        if size > 0:
            return int(np.floor(length / size))
        else:
            return 2**31 - 1

3 Source : dataset.py
with GNU General Public License v3.0
from amandaberg

	def configure(self, minibatch_size, lod=0):
		lod = int(np.floor(lod))
		assert minibatch_size >= 1 and lod in self._tf_datasets
		if self._cur_minibatch != minibatch_size or self._cur_lod != lod:
			self._tf_init_ops[lod].run({self._tf_minibatch_in: minibatch_size})
			self._cur_minibatch = minibatch_size
			self._cur_lod = lod

	# Get next minibatch as TensorFlow expressions.
	def get_minibatch_tf(self): # => images, labels

3 Source : dataset.py
with GNU General Public License v3.0
from amandaberg

    def configure(self, minibatch_size, lod=0):
        lod = int(np.floor(lod))
        assert minibatch_size >= 1 and lod >= 0 and lod   <  = self.resolution_log2
        tfutil.set_vars({self._tf_minibatch_var: minibatch_size, self._tf_lod_var: lod})

    def get_minibatch_tf(self): # => images, labels

3 Source : experience_buffer.py
with MIT License
from andrew-j-levy

    def add(self, experience):
        assert len(experience) == 7, 'Experience must be of form (s, a, r, s, g, t, grip_info\')'
        assert type(experience[5]) == bool

        self.experiences.append(experience)
        self.size += 1

        # If replay buffer is filled, remove a percentage of replay buffer.  Only removing a single transition slows down performance
        if self.size >= self.max_buffer_size:
            beg_index = int(np.floor(self.max_buffer_size/6))
            self.experiences = self.experiences[beg_index:]
            self.size -= beg_index

    def get_batch(self):

3 Source : create_homemade_mask.py
with MIT License
from antonioguj

def get_indexes_canditate_inside_shape(point_center: Tuple[float, float, float],
                                       max_dist_2cen: float
                                       ) -> np.array:
    min_index_x = int(np.floor(point_center[0] - max_dist_2cen))
    max_index_x = int(np.ceil(point_center[0] + max_dist_2cen))
    min_index_y = int(np.floor(point_center[1] - max_dist_2cen))
    max_index_y = int(np.ceil(point_center[1] + max_dist_2cen))
    min_index_z = int(np.floor(point_center[2] - max_dist_2cen))
    max_index_z = int(np.ceil(point_center[2] + max_dist_2cen))
    indexes_x = np.arange(min_index_x, max_index_x + 1)
    indexes_y = np.arange(min_index_y, max_index_y + 1)
    indexes_z = np.arange(min_index_z, max_index_z + 1)
    return np.stack(np.meshgrid(indexes_x, indexes_y, indexes_z, indexing='ij'), axis=3)


def create_sphere_mask(inout_image: np.ndarray,

3 Source : sintel_io.py
with MIT License
from anuragranj

def segmentation_write(filename,segmentation):
    """ Write segmentation to file. """

    segmentation_ = segmentation.astype('int32')
    seg_r = np.floor(segmentation_ / (256**2)).astype('uint8')
    seg_g = np.floor((segmentation_ % (256**2)) / 256).astype('uint8')
    seg_b = np.floor(segmentation_ % 256).astype('uint8')

    out = np.zeros((segmentation.shape[0],segmentation.shape[1],3),dtype='uint8')
    out[:,:,0] = seg_r
    out[:,:,1] = seg_g
    out[:,:,2] = seg_b

    Image.fromarray(out,'RGB').save(filename,'PNG')


def segmentation_read(filename):

3 Source : halton.py
with Apache License 2.0
from anyoptimization

def halton_sequence_by_index(i, b):
    f = 1.0
    x = 0.0
    while i > 0:
        f /= b
        x += f * (i % b)
        i = np.floor(i / b)
    return x


def halton_sequence(n, b):

3 Source : sobol.py
with Apache License 2.0
from anyoptimization

def highest_bit(i):
    bit = 1
    while i > 0 and i % 2 != 0:
        i = np.floor(i / 2)
        bit += 1
    return bit


def parse_file(path_to_file):

3 Source : ndgrid.py
with MIT License
from argoai

    def quantize_points(self, points: NDArrayNumber) -> NDArrayInt:
        """Quantize the points to integer coordinates.

        Args:
            points: (N,D) Array of points.

        Returns:
            (N,D) The array of quantized points.
        """
        # Add half-bucket offset.
        centered_points = align_points_center(points)
        quantized_points: NDArrayInt = np.floor(centered_points).astype(int)
        return quantized_points

    def scale_and_quantize_points(self, points: NDArrayNumber) -> NDArrayInt:

3 Source : sun_position.py
with GNU General Public License v3.0
from Art-Ev

def set_to_range(var, min_interval, max_interval):
    """
    Sets a variable in range min_interval and max_interval

    :param var:
    :param min_interval:
    :param max_interval:
    :return:
    """
    var = var - max_interval * np.floor(var/max_interval)

    if var   <   min_interval:
        var = var + max_interval
    return var

3 Source : video_transforms.py
with MIT License
from artest08

    def __call__(self, poses):
        poses = poses.reshape(-1,2,self.length)
        dim1 = np.floor(poses[:,0,:] / self.space)
        dim2 = np.floor(poses[:,1,:] / self.space)
        one_hot_values = (1/self.space ) * dim1 + dim2
        one_hot_values[np.isnan(one_hot_values)] = self.one_hot_vector_length_per_joint
        one_hot_values = one_hot_values * self.onehot_multiplication + one_hot_values
        one_hot_values[np.isnan(one_hot_values)] = self.one_hot_vector_length + 1
        
        return poses
    
class pose_one_hot_decoding2(object):

3 Source : resnet_main.py
with Apache License 2.0
from artyompal

def get_lr_schedule(train_steps, num_train_images, train_batch_size):
  """learning rate schedule."""
  steps_per_epoch = np.floor(num_train_images / train_batch_size)
  train_epochs = train_steps / steps_per_epoch
  return [  # (multiplier, epoch to start) tuples
      (1.0, np.floor(5 / 90 * train_epochs)),
      (0.1, np.floor(30 / 90 * train_epochs)),
      (0.01, np.floor(60 / 90 * train_epochs)),
      (0.001, np.floor(80 / 90 * train_epochs))
  ]


def learning_rate_schedule(params, current_epoch):

3 Source : img.py
with Apache License 2.0
from Ascend

def ds_size(image_size, kernel_size, stride):
    """calculate the size of downsampling result"""
    image_x, image_y = image_size

    kernel_x, kernel_y = kernel_size
    stride_x, stride_y = stride

    def f(iw, kw, sw):
        return int(np.floor((iw - kw) / sw) + 1)

    output_size = (f(image_x, kernel_x, stride_x), f(image_y, kernel_y, stride_y))
    return output_size


def get_roi(img, p1, p2):

3 Source : dataset.py
with MIT License
from AugustDS

    def configure(self, minibatch_size, lod=0):
        lod = int(np.floor(lod))
        assert minibatch_size >= 1 and lod in self._tf_datasets
        if self._cur_minibatch != minibatch_size or self._cur_lod != lod:
            self._tf_init_ops[lod].run({self._tf_minibatch_in: minibatch_size})
            self._cur_minibatch = minibatch_size
            self._cur_lod = lod

    # Get next minibatch as TensorFlow expressions.
    def get_minibatch_tf(self): # => images, labels

3 Source : simple_execution_system.py
with Apache License 2.0
from Auquan

    def convertLimit(self, df, price):
        if self.limitType == 'L':
            return df
        else:
            try:
                return np.floor(df / price)
            except KeyError:
                logError('You have specified Dollar Limit but Price Feature Key does not exist')

    def getInstrumentExecutionsFromExecutions(self, time, executions):

See More Examples