Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? RAG (Retrieval-Augmented Generation)
et Fine Tuning d'un LLM
Voir le programme détaillé
Module « numpy.testing »

Fonction measure - module numpy.testing

Signature de la fonction measure

def measure(code_str, times=1, label=None) 

Description

help(numpy.testing.measure)

Return elapsed time for executing code in the namespace of the caller.

The supplied code string is compiled with the Python builtin ``compile``.
The precision of the timing is 10 milli-seconds. If the code will execute
fast on this timescale, it can be executed many times to get reasonable
timing accuracy.

Parameters
----------
code_str : str
    The code to be timed.
times : int, optional
    The number of times the code is executed. Default is 1. The code is
    only compiled once.
label : str, optional
    A label to identify `code_str` with. This is passed into ``compile``
    as the second argument (for run-time error messages).

Returns
-------
elapsed : float
    Total elapsed time in seconds for executing `code_str` `times` times.

Examples
--------
>>> times = 10
>>> etime = np.testing.measure('for i in range(1000): np.sqrt(i**2)', times=times)
>>> print("Time for a single execution : ", etime / times, "s")  # doctest: +SKIP
Time for a single execution :  0.005 s



Vous êtes un professionnel et vous avez besoin d'une formation ? Sensibilisation à
l'Intelligence Artificielle
Voir le programme détaillé