index int64 0 731k | package stringlengths 2 98 ⌀ | name stringlengths 1 76 | docstring stringlengths 0 281k ⌀ | code stringlengths 4 8.19k | signature stringlengths 2 42.8k ⌀ | embed_func_code listlengths 768 768 |
|---|---|---|---|---|---|---|
724,835 | scipy.sparse._dok | get | This provides dict.get method functionality with type checking | def get(self, key, default=0.0):
"""This provides dict.get method functionality with type checking"""
if key in self._dict:
return self._dict[key]
if isintlike(key) and self.ndim == 1:
key = (key,)
if self.ndim != len(key):
raise IndexError(f'Index {key} length needs to match sel... | (self, key, default=0.0) | [
0.07493139058351517,
-0.04491564631462097,
-0.04988228157162666,
0.04667916148900986,
0.030537601560354233,
-0.006289270240813494,
0.014171102084219456,
0.0008536402019672096,
0.08472070097923279,
-0.020820273086428642,
-0.018462922424077988,
0.011147934012115002,
0.008714103139936924,
-0.... |
724,837 | scipy.sparse._dok | get_shape | Get shape of a sparse matrix. | def get_shape(self):
"""Get shape of a sparse matrix."""
return self._shape
| (self) | [
-0.0038608757313340902,
-0.025809457525610924,
0.061875224113464355,
0.008603152818977833,
0.02839040383696556,
0.006077030673623085,
0.004019021987915039,
0.04318445175886154,
0.07125435024499893,
-0.0030743619427084923,
-0.05502643808722496,
-0.055330079048871994,
-0.0009689090074971318,
... |
724,843 | scipy.sparse._dok | items | null | def items(self):
return self._dict.items()
| (self) | [
0.029128050431609154,
-0.03728660196065903,
-0.06078457832336426,
-0.05289573222398758,
0.029785454273223877,
0.023160846903920174,
-0.02053122967481613,
-0.06048116087913513,
0.12730036675930023,
0.021289773285388947,
0.0027918596751987934,
0.0003890166699420661,
0.00512437941506505,
0.01... |
724,844 | scipy.sparse._dok | keys | null | def keys(self):
return self._dict.keys()
| (self) | [
-0.005706848111003637,
-0.021404864266514778,
-0.04157129302620888,
-0.0053135608322918415,
0.04116963595151901,
0.03291897475719452,
0.0012206545798107982,
-0.04829901456832886,
0.09639719873666763,
-0.0019277348183095455,
-0.029337549582123756,
-0.04649156704545021,
0.025404678657650948,
... |
724,845 | scipy.sparse._base | maximum | Element-wise maximum between this and another array/matrix. | def maximum(self, other):
"""Element-wise maximum between this and another array/matrix."""
return self.tocsr().maximum(other)
| (self, other) | [
0.011187615804374218,
0.016640476882457733,
0.057787999510765076,
0.07498345524072647,
-0.04594850912690163,
-0.07293973118066788,
-0.04985976964235306,
0.010641449131071568,
0.05683661252260208,
-0.015292678028345108,
-0.03735078126192093,
-0.037949804216623306,
0.013733459636569023,
0.01... |
724,847 | scipy.sparse._base | minimum | Element-wise minimum between this and another array/matrix. | def minimum(self, other):
"""Element-wise minimum between this and another array/matrix."""
return self.tocsr().minimum(other)
| (self, other) | [
-0.015730176120996475,
-0.01667381264269352,
0.07147403806447983,
0.059007637202739716,
-0.00014392634329851717,
-0.03450769558548927,
0.010605099610984325,
-0.003930379636585712,
0.051631685346364975,
0.00983460620045662,
-0.035234902054071426,
-0.07708392292261124,
0.025954358279705048,
... |
724,848 | scipy.sparse._base | multiply | Point-wise multiplication by another array/matrix. | def multiply(self, other):
"""Point-wise multiplication by another array/matrix."""
return self.tocsr().multiply(other)
| (self, other) | [
-0.01577613316476345,
-0.01773178018629551,
0.08360390365123749,
0.0749431848526001,
-0.057028062641620636,
-0.07599085569381714,
-0.05664391815662384,
-0.00757813174277544,
0.07054297626018524,
0.028741026297211647,
-0.02879340946674347,
-0.05538671463727951,
0.07050805538892746,
0.077108... |
724,849 | scipy.sparse._base | nonzero | Nonzero indices of the array/matrix.
Returns a tuple of arrays (row,col) containing the indices
of the non-zero elements of the array.
Examples
--------
>>> from scipy.sparse import csr_array
>>> A = csr_array([[1,2,0],[0,0,3],[4,0,5]])
>>> A.nonzero()
(... | def nonzero(self):
"""Nonzero indices of the array/matrix.
Returns a tuple of arrays (row,col) containing the indices
of the non-zero elements of the array.
Examples
--------
>>> from scipy.sparse import csr_array
>>> A = csr_array([[1,2,0],[0,0,3],[4,0,5]])
>>> A.nonzero()
(array([0... | (self) | [
-0.019292781129479408,
-0.006664779037237167,
0.052370183169841766,
0.0006405250751413405,
0.06643921881914139,
-0.027095217257738113,
-0.033086881041526794,
0.04459618777036667,
0.03418662026524544,
-0.029048196971416473,
-0.035570770502090454,
-0.0014031113823875785,
0.016372792422771454,
... |
724,850 | scipy.sparse._dok | pop | null | def pop(self, key, default=None, /):
return self._dict.pop(key, default)
| (self, key, default=None, /) | [
0.050738267600536346,
-0.005588275380432606,
-0.04050099477171898,
-0.02154308184981346,
-0.054667726159095764,
-0.012064126320183277,
-0.004916131496429443,
0.04791181534528732,
0.11119677126407623,
-0.04463726654648781,
-0.013632462359964848,
0.007565930485725403,
-0.05749417841434479,
0... |
724,851 | scipy.sparse._dok | popitem | null | def popitem(self):
return self._dict.popitem()
| (self) | [
0.07176396995782852,
0.02234317921102047,
-0.06435500085353851,
-0.039038270711898804,
-0.030964823439717293,
-0.05342428758740425,
-0.012400880455970764,
0.03118078038096428,
0.12379284203052521,
-0.042958710342645645,
-0.03174559026956558,
0.008804375305771828,
-0.03857313469052315,
0.02... |
724,852 | scipy.sparse._base | power | Element-wise power. | def power(self, n, dtype=None):
"""Element-wise power."""
return self.tocsr().power(n, dtype=dtype)
| (self, n, dtype=None) | [
-0.030379490926861763,
0.01052709948271513,
0.1122649610042572,
0.011313242837786674,
0.03386744111776352,
0.0036844846326857805,
-0.04145779460668564,
-0.049409594386816025,
-0.010653604753315449,
0.043951768428087234,
-0.0018682212103158236,
-0.014358420856297016,
0.09187943488359451,
0.... |
724,854 | scipy.sparse._dok | resize | Resize the array/matrix in-place to dimensions given by ``shape``
Any elements that lie within the new shape will remain at the same
indices, while non-zero elements lying outside the new shape are
removed.
Parameters
----------
shape : (int, int)
number of ... | def resize(self, *shape):
is_array = isinstance(self, sparray)
shape = check_shape(shape, allow_1d=is_array)
if len(shape) != len(self.shape):
# TODO implement resize across dimensions
raise NotImplementedError
if self.ndim == 1:
newN = shape[-1]
for i in list(self._dict)... | (self, *shape) | [
0.006301202345639467,
-0.0215372946113348,
-0.0306125245988369,
-0.01820659264922142,
-0.04775254428386688,
-0.04842616990208626,
-0.013715757988393307,
0.03276438266038895,
0.05538696423172951,
0.033456720411777496,
-0.020171333104372025,
-0.021948955953121185,
0.014080638065934181,
-0.02... |
724,855 | scipy.sparse._dok | set_shape | null | def set_shape(self, shape):
new_matrix = self.reshape(shape, copy=False).asformat(self.format)
self.__dict__ = new_matrix.__dict__
| (self, shape) | [
0.011373995803296566,
-0.0063364519737660885,
0.019979264587163925,
-0.01903926581144333,
-0.033036716282367706,
-0.02408108115196228,
-0.00423213467001915,
0.03824944049119949,
0.011963631957769394,
0.03113962523639202,
-0.018782902508974075,
-0.003950134851038456,
0.007669542450457811,
0... |
724,856 | scipy.sparse._dok | setdefault | null | def setdefault(self, key, default=None, /):
return self._dict.setdefault(key, default)
| (self, key, default=None, /) | [
0.023352717980742455,
-0.01853916421532631,
-0.0016274088993668556,
0.04150819405913353,
-0.03784570470452309,
-0.007146210875362158,
0.015181883238255978,
0.04768209904432297,
0.058669563382864,
-0.026596635580062866,
-0.019149577245116234,
0.00797899067401886,
-0.020213443785905838,
0.04... |
724,858 | scipy.sparse._base | sum |
Sum the array/matrix elements over a given axis.
Parameters
----------
axis : {-2, -1, 0, 1, None} optional
Axis along which the sum is computed. The default is to
compute the sum of all the array/matrix elements, returning a scalar
(i.e., `axis` = `... | def sum(self, axis=None, dtype=None, out=None):
"""
Sum the array/matrix elements over a given axis.
Parameters
----------
axis : {-2, -1, 0, 1, None} optional
Axis along which the sum is computed. The default is to
compute the sum of all the array/matrix elements, returning a scalar... | (self, axis=None, dtype=None, out=None) | [
-0.0476047657430172,
-0.025185801088809967,
0.02052386850118637,
0.021206103265285492,
0.03399798646569252,
-0.016856862232089043,
-0.038318801671266556,
0.015359737910330296,
0.056132689118385315,
0.01441219076514244,
-0.021319808438420296,
-0.014639602042734623,
0.04866601526737213,
0.04... |
724,859 | scipy.sparse._base | toarray |
Return a dense ndarray representation of this sparse array/matrix.
Parameters
----------
order : {'C', 'F'}, optional
Whether to store multidimensional data in C (row-major)
or Fortran (column-major) order in memory. The default
is 'None', which prov... | def toarray(self, order=None, out=None):
"""
Return a dense ndarray representation of this sparse array/matrix.
Parameters
----------
order : {'C', 'F'}, optional
Whether to store multidimensional data in C (row-major)
or Fortran (column-major) order in memory. The default
is... | (self, order=None, out=None) | [
-0.006155956536531448,
0.04132396727800369,
0.027981620281934738,
-0.020324427634477615,
0.026116177439689636,
-0.018885372206568718,
-0.026045113801956177,
0.02746640332043171,
0.038765646517276764,
-0.052729807794094086,
-0.04654720053076744,
-0.0761810690164566,
-0.002369554713368416,
-... |
724,861 | scipy.sparse._dok | tocoo | Convert this array/matrix to COOrdinate format.
With copy=False, the data/indices may be shared between this array/matrix and
the resultant coo_array/matrix.
| def tocoo(self, copy=False):
nnz = self.nnz
if nnz == 0:
return self._coo_container(self.shape, dtype=self.dtype)
idx_dtype = self._get_index_dtype(maxval=max(self.shape))
data = np.fromiter(self.values(), dtype=self.dtype, count=nnz)
# handle 1d keys specially b/c not a tuple
inds = zip... | (self, copy=False) | [
0.007823102176189423,
-0.03205477446317673,
0.01400623470544815,
-0.06996025890111923,
0.019023658707737923,
-0.009432046674191952,
0.0004911600844934583,
0.012011676095426083,
0.07715839892625809,
-0.0028522189240902662,
-0.026806868612766266,
0.013385705649852753,
-0.01708228699862957,
-... |
724,862 | scipy.sparse._dok | tocsc | Convert this array/matrix to Compressed Sparse Column format.
With copy=False, the data/indices may be shared between this array/matrix and
the resultant csc_array/matrix.
| def tocsc(self, copy=False):
if self.ndim == 1:
raise NotImplementedError("tocsr() not valid for 1d sparse array")
return self.tocoo(copy=False).tocsc(copy=copy)
| (self, copy=False) | [
-0.05078718811273575,
0.03475980460643768,
0.05670446902513504,
-0.04970517009496689,
0.04152241349220276,
-0.009154880419373512,
-0.00819120928645134,
-0.002681796671822667,
0.07824337482452393,
0.006217372603714466,
-0.013001114130020142,
-0.040575649589300156,
0.012772875837981701,
-0.0... |
724,863 | scipy.sparse._base | tocsr | Convert this array/matrix to Compressed Sparse Row format.
With copy=False, the data/indices may be shared between this array/matrix and
the resultant csr_array/matrix.
| def tocsr(self, copy=False):
"""Convert this array/matrix to Compressed Sparse Row format.
With copy=False, the data/indices may be shared between this array/matrix and
the resultant csr_array/matrix.
"""
return self.tocoo(copy=copy).tocsr(copy=False)
| (self, copy=False) | [
-0.03824298828840256,
0.013629522174596786,
0.05947745218873024,
-0.010302905924618244,
-0.008198668248951435,
-0.03279467299580574,
-0.011516553349792957,
0.051304977387189865,
0.06422726809978485,
-0.009499628096818924,
-0.045297861099243164,
-0.057312097400426865,
0.022736242040991783,
... |
724,866 | scipy.sparse._dok | todok | Convert this array/matrix to Dictionary Of Keys format.
With copy=False, the data/indices may be shared between this array/matrix and
the resultant dok_array/matrix.
| def todok(self, copy=False):
if copy:
return self.copy()
return self
| (self, copy=False) | [
-0.007745008450001478,
-0.018477557227015495,
-0.00043280620593577623,
0.0002502692223060876,
-0.08649639040231705,
-0.027917178347706795,
-0.009523306041955948,
0.06062111258506775,
0.13496649265289307,
-0.02478737384080887,
-0.018494293093681335,
-0.022728733718395233,
-0.02769959717988968... |
724,869 | scipy.sparse._dok | transpose |
Reverses the dimensions of the sparse array/matrix.
Parameters
----------
axes : None, optional
This argument is in the signature *solely* for NumPy
compatibility reasons. Do not pass in anything except
for the default value.
copy : bool, opt... | def transpose(self, axes=None, copy=False):
if self.ndim == 1:
return self.copy()
if axes is not None and axes != (1, 0):
raise ValueError(
"Sparse arrays/matrices do not support "
"an 'axes' parameter because swapping "
"dimensions is the only logical permuta... | (self, axes=None, copy=False) | [
-0.020027725026011467,
0.03181088715791702,
0.0013759940629824996,
-0.06183423474431038,
-0.053480226546525955,
-0.003832719288766384,
-0.0017362377839162946,
0.007300634868443012,
0.06832773983478546,
0.046548955142498016,
-0.010770830325782299,
-0.0163249671459198,
-0.011710199527442455,
... |
724,870 | scipy.sparse._dok | update | null | def update(self, val):
# Prevent direct usage of update
raise NotImplementedError("Direct update to DOK sparse format is not allowed.")
| (self, val) | [
0.05947189778089523,
0.009288250468671322,
-0.029719015583395958,
0.03996403142809868,
0.012031543999910355,
-0.020439231768250465,
-0.04900674149394035,
0.015951745212078094,
0.05019211396574974,
-0.03337673842906952,
-0.060284726321697235,
-0.04873579740524292,
0.03908346965909004,
0.024... |
724,871 | scipy.sparse._dok | values | null | def values(self):
return self._dict.values()
| (self) | [
0.06687885522842407,
-0.0532684251666069,
-0.040093790739774704,
-0.03429426997900009,
0.019761947914958,
0.03597043454647064,
-0.02770695649087429,
-0.05507867783308029,
0.11780065298080444,
0.01878977380692959,
-0.02395235374569893,
0.01248740591108799,
0.015336881391704082,
-0.009311079... |
724,872 | markov_clustering.mcl | expand |
Apply cluster expansion to the given matrix by raising
the matrix to the given power.
:param matrix: The matrix to be expanded
:param power: Cluster expansion parameter
:returns: The expanded matrix
| def expand(matrix, power):
"""
Apply cluster expansion to the given matrix by raising
the matrix to the given power.
:param matrix: The matrix to be expanded
:param power: Cluster expansion parameter
:returns: The expanded matrix
"""
if isspmatrix(matrix):
return matrix ** p... | (matrix, power) | [
0.05283648148179054,
-0.0047970418818295,
0.08710599690675735,
0.043449465185403824,
0.0031944329384714365,
-0.004048582632094622,
-0.008584634400904179,
-0.006936729419976473,
-0.017566146329045296,
0.036719802767038345,
-0.007959120906889439,
-0.005060188937932253,
-0.014063269831240177,
... |
724,873 | scipy.sparse._extract | find | Return the indices and values of the nonzero elements of a matrix
Parameters
----------
A : dense or sparse array or matrix
Matrix whose nonzero elements are desired.
Returns
-------
(I,J,V) : tuple of arrays
I,J, and V contain the row indices, column indices, and values
... | def find(A):
"""Return the indices and values of the nonzero elements of a matrix
Parameters
----------
A : dense or sparse array or matrix
Matrix whose nonzero elements are desired.
Returns
-------
(I,J,V) : tuple of arrays
I,J, and V contain the row indices, column indice... | (A) | [
0.007882272824645042,
-0.03947388380765915,
0.026162028312683105,
0.009507780894637108,
0.06882921606302261,
-0.012196121737360954,
-0.0028133797459304333,
0.01409094501286745,
0.06390459835529327,
-0.04759180545806885,
-0.06713637709617615,
-0.013744683004915714,
0.006660736631602049,
-0.... |
724,874 | markov_clustering.mcl | get_clusters |
Retrieve the clusters from the matrix
:param matrix: The matrix produced by the MCL algorithm
:returns: A list of tuples where each tuple represents a cluster and
contains the indices of the nodes belonging to the cluster
| def get_clusters(matrix):
"""
Retrieve the clusters from the matrix
:param matrix: The matrix produced by the MCL algorithm
:returns: A list of tuples where each tuple represents a cluster and
contains the indices of the nodes belonging to the cluster
"""
if not isspmatrix(mat... | (matrix) | [
0.00996114406734705,
0.006627516355365515,
0.04574355110526085,
0.014773930422961712,
0.03477569669485092,
0.002929618349298835,
0.029547860845923424,
0.03357470780611038,
0.03779583051800728,
0.045955490320920944,
-0.04747438803315163,
-0.002576386323198676,
-0.051925111562013626,
-0.0141... |
724,875 | markov_clustering.mcl | inflate |
Apply cluster inflation to the given matrix by raising
each element to the given power.
:param matrix: The matrix to be inflated
:param power: Cluster inflation parameter
:returns: The inflated matrix
| def inflate(matrix, power):
"""
Apply cluster inflation to the given matrix by raising
each element to the given power.
:param matrix: The matrix to be inflated
:param power: Cluster inflation parameter
:returns: The inflated matrix
"""
if isspmatrix(matrix):
return normaliz... | (matrix, power) | [
0.049409300088882446,
-0.0030729116406291723,
0.1421600878238678,
0.04403495416045189,
0.03720433637499809,
-0.022849634289741516,
0.014814121648669243,
0.005534708499908447,
-0.02141069620847702,
0.06327857822179794,
-0.03500258922576904,
0.007532751187682152,
-0.08106592297554016,
0.0024... |
724,876 | markov_clustering.modularity | is_undirected |
Determine if the matrix reprensents a directed graph
:param matrix: The matrix to tested
:returns: boolean
| def is_undirected(matrix):
"""
Determine if the matrix reprensents a directed graph
:param matrix: The matrix to tested
:returns: boolean
"""
if isspmatrix(matrix):
return sparse_allclose(matrix, matrix.transpose())
return np.allclose(matrix, matrix.T)
| (matrix) | [
0.005531210917979479,
0.05668949708342552,
0.028725912794470787,
0.05658554285764694,
0.015315867029130459,
-0.009520439431071281,
-0.04532387852668762,
0.04255177453160286,
0.016511335968971252,
0.03387162834405899,
-0.06465929001569748,
0.007735898718237877,
-0.02690672129392624,
0.02403... |
724,877 | scipy.sparse._base | isspmatrix | Is `x` of a sparse matrix type?
Parameters
----------
x
object to check for being a sparse matrix
Returns
-------
bool
True if `x` is a sparse matrix, False otherwise
Examples
--------
>>> import numpy as np
>>> from scipy.sparse import csr_array, csr_matrix, i... | def isspmatrix(x):
"""Is `x` of a sparse matrix type?
Parameters
----------
x
object to check for being a sparse matrix
Returns
-------
bool
True if `x` is a sparse matrix, False otherwise
Examples
--------
>>> import numpy as np
>>> from scipy.sparse impor... | (x) | [
0.01486754696816206,
0.0009040146833285689,
0.044950954616069794,
-0.01237434521317482,
0.04308105632662773,
0.01599498651921749,
-0.01642579771578312,
0.06526321172714233,
0.016948269680142403,
0.019505634903907776,
-0.04674752801656723,
-0.030395058915019035,
0.0017702188342809677,
0.008... |
724,878 | markov_clustering.mcl | iterate |
Run a single iteration (expansion + inflation) of the mcl algorithm
:param matrix: The matrix to perform the iteration on
:param expansion: Cluster expansion factor
:param inflation: Cluster inflation factor
| def iterate(matrix, expansion, inflation):
"""
Run a single iteration (expansion + inflation) of the mcl algorithm
:param matrix: The matrix to perform the iteration on
:param expansion: Cluster expansion factor
:param inflation: Cluster inflation factor
"""
# Expansion
matrix = exp... | (matrix, expansion, inflation) | [
0.08864642679691315,
-0.02943478897213936,
0.0031032550614327192,
0.032459281384944916,
-0.029200751334428787,
-0.006012978497892618,
-0.004433221183717251,
-0.02912873961031437,
0.008029306307435036,
-0.002848963486030698,
-0.0741000548005104,
0.007372199557721615,
-0.059121619910001755,
... |
724,880 | markov_clustering.modularity | modularity |
Compute the modularity
:param matrix: The adjacency matrix
:param clusters: The clusters returned by get_clusters
:returns: modularity value
| def modularity(matrix, clusters):
"""
Compute the modularity
:param matrix: The adjacency matrix
:param clusters: The clusters returned by get_clusters
:returns: modularity value
"""
matrix = convert_to_adjacency_matrix(matrix)
m = matrix.sum()
if isspmatrix(matrix):
matrix... | (matrix, clusters) | [
0.027341030538082123,
0.0023075148928910494,
-0.006432394031435251,
0.062023136764764786,
0.07878227531909943,
0.0012421637075021863,
-0.003502677893266082,
0.013670515269041061,
-0.024279264733195305,
0.07061757147312164,
-0.05500435456633568,
0.010089502669870853,
-0.03167405724525452,
0... |
724,881 | markov_clustering.mcl | normalize |
Normalize the columns of the given matrix
:param matrix: The matrix to be normalized
:returns: The normalized matrix
| def normalize(matrix):
"""
Normalize the columns of the given matrix
:param matrix: The matrix to be normalized
:returns: The normalized matrix
"""
return sklearn.preprocessing.normalize(matrix, norm="l1", axis=0)
| (matrix) | [
-0.02742999978363514,
0.041424207389354706,
0.05059574171900749,
0.01785234361886978,
-0.011955147609114647,
-0.04017200320959091,
0.03057742677628994,
0.0009169420227408409,
0.04162726551294327,
0.054047759622335434,
-0.04629764333367348,
-0.04352249205112457,
-0.007102863863110542,
0.033... |
724,884 | markov_clustering.mcl | prune |
Prune the matrix so that very small edges are removed.
The maximum value in each column is never pruned.
:param matrix: The matrix to be pruned
:param threshold: The value below which edges will be removed
:returns: The pruned matrix
| def prune(matrix, threshold):
"""
Prune the matrix so that very small edges are removed.
The maximum value in each column is never pruned.
:param matrix: The matrix to be pruned
:param threshold: The value below which edges will be removed
:returns: The pruned matrix
"""
if isspmatr... | (matrix, threshold) | [
0.033354297280311584,
0.008338574320077896,
0.009938727132976055,
0.01356573961675167,
-0.006485063582658768,
-0.029762841761112213,
0.006391721311956644,
0.04533766210079193,
0.01116551086306572,
-0.03637680783867836,
-0.09202656149864197,
0.04075055941939354,
-0.05173827335238457,
-0.007... |
724,885 | markov_clustering.mcl | run_mcl |
Perform MCL on the given similarity matrix
:param matrix: The similarity matrix to cluster
:param expansion: The cluster expansion factor
:param inflation: The cluster inflation factor
:param loop_value: Initialization value for self-loops
:param iterations: Maximum number of iterations
... | def run_mcl(matrix, expansion=2, inflation=2, loop_value=1,
iterations=100, pruning_threshold=0.001, pruning_frequency=1,
convergence_check_frequency=1, verbose=False):
"""
Perform MCL on the given similarity matrix
:param matrix: The similarity matrix to cluster
:param expa... | (matrix, expansion=2, inflation=2, loop_value=1, iterations=100, pruning_threshold=0.001, pruning_frequency=1, convergence_check_frequency=1, verbose=False) | [
0.0591849759221077,
0.015756916254758835,
-0.005439103115350008,
0.04129009321331978,
-0.012083756737411022,
-0.009983462281525135,
-0.02763346955180168,
-0.06152072921395302,
0.03970780596137047,
-0.015097631141543388,
-0.08853258937597275,
0.006931913085281849,
-0.006856566295027733,
0.0... |
724,887 | markov_clustering.mcl | sparse_allclose |
Version of np.allclose for use with sparse matrices
| def sparse_allclose(a, b, rtol=1e-5, atol=1e-8):
"""
Version of np.allclose for use with sparse matrices
"""
c = np.abs(a - b) - rtol * np.abs(b)
# noinspection PyUnresolvedReferences
return c.max() <= atol
| (a, b, rtol=1e-05, atol=1e-08) | [
-0.01812368631362915,
-0.0036160657182335854,
0.025251757353544235,
0.035831134766340256,
-0.009200588800013065,
-0.005770963151007891,
-0.07624088227748871,
0.02402038872241974,
-0.02258089929819107,
-0.02202591486275196,
-0.022979794070124626,
-0.019944727420806885,
0.0475204773247242,
-... |
724,890 | pipfile.api | Pipfile | null | class Pipfile(object):
def __init__(self, filename):
super(Pipfile, self).__init__()
self.filename = filename
self.data = None
@staticmethod
def find(max_depth=3):
"""Returns the path of a Pipfile in parent directories."""
i = 0
for c, d, f in walk_up(os.getc... | (filename) | [
0.06350443512201309,
-0.0282930638641119,
-0.0605851486325264,
0.0025293799117207527,
0.018695415928959846,
-0.038650523871183395,
0.020834892988204956,
0.05302700027823448,
-0.01425650529563427,
-0.0467885285615921,
0.058025773614645004,
0.015976082533597946,
-0.005808576010167599,
0.0185... |
724,891 | pipfile.api | __init__ | null | def __init__(self, filename):
super(Pipfile, self).__init__()
self.filename = filename
self.data = None
| (self, filename) | [
-0.0007872395217418671,
-0.028552815318107605,
-0.008988535031676292,
-0.012570369057357311,
-0.01792614348232746,
-0.037855397909879684,
0.009429898113012314,
0.07747624814510345,
0.04413633793592453,
-0.009039461612701416,
0.02821330539882183,
0.02155890315771103,
-0.02101568691432476,
0... |
724,892 | pipfile.api | assert_requirements | "Asserts PEP 508 specifiers. | def assert_requirements(self):
""""Asserts PEP 508 specifiers."""
# Support for 508's implementation_version.
if hasattr(sys, 'implementation'):
implementation_version = format_full_version(sys.implementation.version)
else:
implementation_version = "0"
# Default to cpython for 2.7.
... | (self) | [
0.050107818096876144,
0.030631473287940025,
-0.05638934671878815,
-0.009936726652085781,
0.018790431320667267,
-0.018420400097966194,
0.02772536315023899,
0.010279684327542782,
-0.010378961451351643,
-0.008528798818588257,
0.05122694373130798,
0.049819014966487885,
0.056894756853580475,
0.... |
724,893 | pipfile.api | find | Returns the path of a Pipfile in parent directories. | @staticmethod
def find(max_depth=3):
"""Returns the path of a Pipfile in parent directories."""
i = 0
for c, d, f in walk_up(os.getcwd()):
i += 1
if i < max_depth:
if 'Pipfile':
p = os.path.join(c, 'Pipfile')
if os.path.isfile(p):
... | (max_depth=3) | [
0.022638771682977676,
-0.07531388103961945,
-0.01794559508562088,
0.03297305479645729,
-0.03795433044433594,
-0.0065425680950284,
0.06984934955835342,
-0.0060453698970377445,
0.013605567626655102,
-0.027936022728681564,
0.041485827416181564,
-0.04501732811331749,
0.011049876920878887,
0.00... |
724,894 | pipfile.api | lock | Returns a JSON representation of the Pipfile. | def lock(self):
"""Returns a JSON representation of the Pipfile."""
data = self.data
data['_meta']['hash'] = {"sha256": self.hash}
# return _json.dumps(data)
return json.dumps(data, indent=4, separators=(',', ': '))
| (self) | [
0.010830101557075977,
-0.048718374222517014,
-0.037034161388874054,
0.02736564911901951,
0.031294550746679306,
-0.00827204529196024,
-0.030320866033434868,
0.02915927767753601,
0.007541781757026911,
-0.02517913095653057,
0.050939057022333145,
-0.056132037192583084,
-0.03812742233276367,
-0... |
724,897 | pipfile.api | load | Loads a pipfile from a given path.
If none is provided, one will try to be found.
| def load(pipfile_path=None):
"""Loads a pipfile from a given path.
If none is provided, one will try to be found.
"""
if pipfile_path is None:
pipfile_path = Pipfile.find()
return Pipfile.load(filename=pipfile_path)
| (pipfile_path=None) | [
0.042414888739585876,
-0.02025921829044819,
-0.04722895845770836,
-0.06692288815975189,
-0.02252037264406681,
-0.023979181423783302,
0.03946080058813095,
0.06338527798652649,
0.03225792571902275,
0.000171809020685032,
0.03978903219103813,
-0.004396943375468254,
-0.046572495251894,
-0.00135... |
724,898 | tf_keras.src.engine.input_layer | Input | `Input()` is used to instantiate a TF-Keras tensor.
A TF-Keras tensor is a symbolic tensor-like object, which we augment with
certain attributes that allow us to build a TF-Keras model just by knowing
the inputs and outputs of the model.
For instance, if `a`, `b` and `c` are TF-Keras tensors,
it b... | @keras_export("keras.layers.InputLayer")
class InputLayer(base_layer.Layer):
"""Layer to be used as an entry point into a Network (a graph of layers).
It can either wrap an existing tensor (pass an `input_tensor` argument)
or create a placeholder tensor (pass arguments `input_shape`, and
optionally, `d... | (shape=None, batch_size=None, name=None, dtype=None, sparse=None, tensor=None, ragged=None, type_spec=None, **kwargs) | [
0.021937713027000427,
-0.06982540339231491,
-0.03541174158453941,
0.008982685394585133,
-0.006282889284193516,
0.006392677780240774,
-0.07689178735017776,
0.044953349977731705,
0.03880520164966583,
-0.050263114273548126,
-0.01912313885986805,
-0.007770022843033075,
-0.027447093278169632,
0... |
724,899 | tf_keras.src.engine.training | Model | A model grouping layers into an object with training/inference features.
Args:
inputs: The input(s) of the model: a `keras.Input` object or a
combination of `keras.Input` objects in a dict, list or tuple.
outputs: The output(s) of the model: a tensor that originated from
`ke... | class Model(base_layer.Layer, version_utils.ModelVersionSelector):
"""A model grouping layers into an object with training/inference features.
Args:
inputs: The input(s) of the model: a `keras.Input` object or a
combination of `keras.Input` objects in a dict, list or tuple.
outputs:... | (*args, **kwargs) | [
0.012583411298692226,
-0.07537095993757248,
-0.023936539888381958,
0.04463549703359604,
0.00115878542419523,
-0.01805492863059044,
-0.09047968685626984,
0.015108726918697357,
-0.0034884971100836992,
-0.018950659781694412,
-0.014784968458116055,
0.028318069875240326,
-0.013414391316473484,
... |
724,900 | tf_keras.src.engine.training | __call__ | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | (self, *args, **kwargs) | [
0.024942101910710335,
-0.08747810125350952,
-0.039559438824653625,
0.04965827986598015,
-0.00267297332175076,
-0.002055916003882885,
-0.08698106557130814,
0.00023880961816757917,
-0.009330695495009422,
-0.024399882182478905,
-0.0193052776157856,
0.00976560078561306,
-0.02758542262017727,
0... | |
724,905 | tf_keras.src.engine.training | __init__ | def __new__(cls, *args, **kwargs):
# Signature detection
if is_functional_model_init_params(args, kwargs) and cls == Model:
# Functional model
from tf_keras.src.engine import functional
return functional.Functional(skip_init=True, *args, **kwargs)
else:
return super(Model, cl... | (self, *args, **kwargs) | [
0.017745215445756912,
-0.06812427192926407,
0.025872036814689636,
0.02296120673418045,
-0.017853694036602974,
-0.026233630254864693,
-0.03832894191145897,
0.027824642136693,
0.002899530343711376,
0.01639827899634838,
-0.002962809056043625,
0.03252536058425903,
-0.03306775167584419,
0.02292... | |
724,906 | tf_keras.src.engine.training | __new__ | null | def __new__(cls, *args, **kwargs):
# Signature detection
if is_functional_model_init_params(args, kwargs) and cls == Model:
# Functional model
from tf_keras.src.engine import functional
return functional.Functional(skip_init=True, *args, **kwargs)
else:
return super(Model, cl... | (cls, *args, **kwargs) | [
0.017745215445756912,
-0.06812427192926407,
0.025872036814689636,
0.02296120673418045,
-0.017853694036602974,
-0.026233630254864693,
-0.03832894191145897,
0.027824642136693,
0.002899530343711376,
0.01639827899634838,
-0.002962809056043625,
0.03252536058425903,
-0.03306775167584419,
0.02292... |
724,916 | tf_keras.src.engine.base_layer | _autographed_call | null | def _autographed_call(self):
# Wrapping `call` function in autograph to allow for dynamic control
# flow and control dependencies in call. We are limiting this to
# subclassed layers as autograph is strictly needed only for
# subclassed layers and models.
# tf_convert will respect the value of autog... | (self) | [
-0.03271239995956421,
-0.09952139109373093,
0.0021168007515370846,
0.06405813246965408,
0.018607696518301964,
0.013763037510216236,
-0.028384622186422348,
-0.023846587166190147,
0.012352567166090012,
-0.05512223765254021,
0.018485046923160553,
0.023268381133675575,
0.0036794880870729685,
-... |
724,951 | tf_keras.src.engine.base_layer | _infer_output_signature | Call the layer on input KerasTensors, returns output KerasTensors. | def _infer_output_signature(self, inputs, args, kwargs, input_masks):
"""Call the layer on input KerasTensors, returns output KerasTensors."""
keras_tensor_inputs = inputs
call_fn = self.call
# Wrapping `call` function in autograph to allow for dynamic control
# flow and control dependencies in call... | (self, inputs, args, kwargs, input_masks) | [
-0.014744695276021957,
-0.07174026966094971,
0.016373414546251297,
0.05070105567574501,
-0.039223380386829376,
0.017561420798301697,
-0.10224521160125732,
0.03951080143451691,
0.058442261070013046,
-0.011075287126004696,
0.03330250829458237,
0.028492996469140053,
0.0029149274341762066,
-0.... |
724,955 | tf_keras.src.engine.base_layer | _instrument_layer_creation | null | def _instrument_layer_creation(self):
self._instrumented_keras_api = False
self._instrumented_keras_layer_class = False
self._instrumented_keras_model_class = False
if not getattr(self, "_disable_keras_instrumentation", False):
self._instrumented_keras_api = True
if getattr(self, "_is_mo... | (self) | [
0.015182103961706161,
-0.047834258526563644,
0.02311762236058712,
0.06273568421602249,
-0.014884415082633495,
-0.00728911068290472,
-0.07974644750356674,
0.05137249454855919,
-0.034974124282598495,
-0.002819533459842205,
0.0005592287634499371,
0.016381362453103065,
0.015777479857206345,
-0... |
724,962 | tf_keras.src.engine.base_layer | _maybe_create_attribute | Create attribute (with the default value) if it hasn't been created.
This is useful for fields that is used for tracking purpose,
_trainable_weights, or _layers. Note that user could create a layer
subclass and assign an internal field before invoking the
Layer.__init__(), the __setattr... | @keras_export("keras.layers.Layer")
class Layer(tf.Module, version_utils.LayerVersionSelector):
"""This is the class from which all layers inherit.
A layer is a callable object that takes as input one or more tensors and
that outputs one or more tensors. It involves *computation*, defined
in the `call(... | (self, name, default_value) | [
0.005079122260212898,
-0.05363301560282707,
-0.012654628604650497,
0.06669586151838303,
0.020682834088802338,
-0.0011834276374429464,
-0.12116623669862747,
0.01769973337650299,
0.023843875154852867,
-0.007096640300005674,
0.018034677952528,
0.03920946270227432,
0.013879270292818546,
0.0220... |
724,964 | tf_keras.src.engine.training | _maybe_load_initial_counters_from_ckpt | Maybe load initial epoch from ckpt, considering worker recovery.
Refer to tensorflow/python/tf_keras/distribute/worker_training_state.py
for more information.
Args:
steps_per_epoch: The number of step per epoch.
initial_epoch: The original initial_epoch user passes in `fit(... | def _maybe_load_initial_counters_from_ckpt(
self, steps_per_epoch, initial_epoch
):
"""Maybe load initial epoch from ckpt, considering worker recovery.
Refer to tensorflow/python/tf_keras/distribute/worker_training_state.py
for more information.
Args:
steps_per_epoch: The number of step per ep... | (self, steps_per_epoch, initial_epoch) | [
0.004222314804792404,
0.048570416867733,
-0.03911390155553818,
0.07756548374891281,
0.002773481188341975,
0.023567691445350647,
0.07484259456396103,
-0.004898436833173037,
0.04547956958413124,
0.0013418957823887467,
0.03422006592154503,
-0.013669628649950027,
0.0077041140757501125,
0.00032... |
724,978 | tf_keras.src.engine.training | _set_save_spec | Defines the save spec so that serialization can trace `call()`.
The TensorSpecs of the call function `inputs`, `args`, and `kwargs` are
saved into a tuple of `([inputs] + args, kwargs)`. The input
`TensorSpec` names are updated to match the built `input_names`.
The specs can be retriev... | def __new__(cls, *args, **kwargs):
# Signature detection
if is_functional_model_init_params(args, kwargs) and cls == Model:
# Functional model
from tf_keras.src.engine import functional
return functional.Functional(skip_init=True, *args, **kwargs)
else:
return super(Model, cl... | (self, inputs, args=None, kwargs=None) | [
0.017745215445756912,
-0.06812427192926407,
0.025872036814689636,
0.02296120673418045,
-0.017853694036602974,
-0.026233630254864693,
-0.03832894191145897,
0.027824642136693,
0.002899530343711376,
0.01639827899634838,
-0.002962809056043625,
0.03252536058425903,
-0.03306775167584419,
0.02292... |
724,983 | tf_keras.src.engine.base_layer | _should_use_autograph | null | def _should_use_autograph(self):
if base_layer_utils.from_saved_model(self):
return False
if base_layer_utils.is_subclassed(self):
return True
return False
| (self) | [
0.014059145003557205,
-0.040970899164676666,
0.025790786370635033,
0.0835847407579422,
0.023292144760489464,
-0.04394873231649399,
-0.015719201415777206,
0.02450723759829998,
0.009378467686474323,
-0.005553490482270718,
0.027159906923770905,
0.005981340538710356,
-0.002161711221560836,
-0.... |
724,989 | tf_keras.src.engine.training | _updated_config | Util shared between different serialization methods.
Returns:
Model config with TF-Keras version information added.
| def _updated_config(self):
"""Util shared between different serialization methods.
Returns:
Model config with TF-Keras version information added.
"""
from tf_keras.src import __version__ as keras_version
config = self.get_config()
model_config = {
"class_name": self.__class__.__n... | (self) | [
0.05219399929046631,
-0.042321473360061646,
-0.0460842102766037,
0.020192110911011696,
-0.02011760137975216,
-0.0254822950810194,
-0.06422730535268784,
0.006170329172164202,
0.015069574117660522,
-0.009630369953811169,
-0.03229992836713791,
-0.07287042587995529,
-0.03475874662399292,
0.048... |
724,994 | tf_keras.src.engine.base_layer | add_metric | Adds metric tensor to the layer.
This method can be used inside the `call()` method of a subclassed layer
or model.
```python
class MyMetricLayer(tf.keras.layers.Layer):
def __init__(self):
super(MyMetricLayer, self).__init__(name='my_metric_layer')
se... | @doc_controls.do_not_generate_docs
def add_metric(self, value, name=None, **kwargs):
"""Adds metric tensor to the layer.
This method can be used inside the `call()` method of a subclassed layer
or model.
```python
class MyMetricLayer(tf.keras.layers.Layer):
def __init__(self):
super(My... | (self, value, name=None, **kwargs) | [
-0.0004251606878824532,
-0.08323600888252258,
0.009142616763710976,
0.08880570530891418,
0.04552452638745308,
0.014417389407753944,
-0.045253776013851166,
-0.021060410887002945,
0.020151467993855476,
-0.01809184066951275,
-0.01246412843465805,
0.01591617986559868,
0.0606091171503067,
-0.02... |
724,995 | tf_keras.src.engine.base_layer | add_update | Add update op(s), potentially dependent on layer inputs.
Weight updates (for instance, the updates of the moving mean and
variance in a BatchNormalization layer) may be dependent on the inputs
passed when calling a layer. Hence, when reusing the same layer on
different inputs `a` and `b... | @doc_controls.do_not_doc_inheritable
def add_update(self, updates):
"""Add update op(s), potentially dependent on layer inputs.
Weight updates (for instance, the updates of the moving mean and
variance in a BatchNormalization layer) may be dependent on the inputs
passed when calling a layer. Hence, when... | (self, updates) | [
-0.014526245184242725,
-0.0567692331969738,
-0.02567797154188156,
0.06562734395265579,
-0.0015071089146658778,
-0.0025594488251954317,
-0.08583930134773254,
0.008480234071612358,
0.04056451842188835,
0.011538391001522541,
-0.008304477669298649,
-0.04485296830534935,
0.05051231384277344,
0.... |
724,996 | tf_keras.src.engine.base_layer | add_variable | Deprecated, do NOT use! Alias for `add_weight`. | @doc_controls.do_not_doc_inheritable
def add_variable(self, *args, **kwargs):
"""Deprecated, do NOT use! Alias for `add_weight`."""
warnings.warn(
"`layer.add_variable` is deprecated and "
"will be removed in a future version. "
"Please use the `layer.add_weight()` method instead.",
... | (self, *args, **kwargs) | [
-0.012171566486358643,
-0.04262559488415718,
0.049757763743400574,
0.04269256442785263,
-0.0021409064065665007,
0.02777528017759323,
-0.060238372534513474,
0.024091999977827072,
0.0397794246673584,
-0.02928207628428936,
0.007379116490483284,
-0.03683280199766159,
0.040549565106630325,
-0.0... |
724,997 | tf_keras.src.engine.base_layer | add_weight | Adds a new variable to the layer.
Args:
name: Variable name.
shape: Variable shape. Defaults to scalar if unspecified.
dtype: The type of the variable. Defaults to `self.dtype`.
initializer: Initializer instance (callable).
regularizer: Regularizer instance (ca... | @doc_controls.for_subclass_implementers
def add_weight(
self,
name=None,
shape=None,
dtype=None,
initializer=None,
regularizer=None,
trainable=None,
constraint=None,
use_resource=None,
synchronization=tf.VariableSynchronization.AUTO,
aggregation=tf.VariableAggregation.NONE,
... | (self, name=None, shape=None, dtype=None, initializer=None, regularizer=None, trainable=None, constraint=None, use_resource=None, synchronization=<VariableSynchronization.AUTO: 0>, aggregation=<VariableAggregationV2.NONE: 0>, **kwargs) | [
0.008263405412435532,
-0.048505932092666626,
0.0032925703562796116,
0.03374948725104332,
0.049570195376873016,
0.04891526326537132,
-0.07318869978189468,
-0.025337697938084602,
-0.0032516370993107557,
-0.04408513754606247,
0.01477691251784563,
0.035243548452854156,
0.02562423050403595,
-0.... |
724,999 | tf_keras.src.engine.base_layer | build_from_config | Builds the layer's states with the supplied config dict.
By default, this method calls the `build(config["input_shape"])` method,
which creates weights based on the layer's input shape in the supplied
config. If your config contains other information needed to load the
layer's state, yo... | def build_from_config(self, config):
"""Builds the layer's states with the supplied config dict.
By default, this method calls the `build(config["input_shape"])` method,
which creates weights based on the layer's input shape in the supplied
config. If your config contains other information needed to loa... | (self, config) | [
-0.013505522161722183,
-0.06985437124967575,
-0.001561549142934382,
-0.04900795966386795,
-0.03788071498274803,
0.026169631630182266,
-0.0803634375333786,
0.0467412993311882,
0.05639177933335304,
-0.029346391558647156,
-0.031801942735910416,
0.042173635214567184,
-0.012775725685060024,
0.0... |
725,000 | tf_keras.src.engine.training | call | Calls the model on new inputs and returns the outputs as tensors.
In this case `call()` just reapplies
all ops in the graph to the new inputs
(e.g. build a new computational graph from the provided inputs).
Note: This method should not be called directly. It is only meant to be
... | @doc_controls.doc_in_current_and_subclasses
def call(self, inputs, training=None, mask=None):
"""Calls the model on new inputs and returns the outputs as tensors.
In this case `call()` just reapplies
all ops in the graph to the new inputs
(e.g. build a new computational graph from the provided inputs).
... | (self, inputs, training=None, mask=None) | [
-0.0007792821270413697,
-0.09496020525693893,
0.011879093945026398,
0.010781864635646343,
-0.051324937492609024,
0.003661209251731634,
-0.11004937440156937,
-0.005930478684604168,
0.12252695858478546,
-0.009793451055884361,
0.0015925692860037088,
-0.028872545808553696,
0.028147105127573013,
... |
725,001 | tf_keras.src.engine.training | compile | Configures the model for training.
Example:
```python
model.compile(optimizer=tf.keras.optimizers.Adam(learning_rate=1e-3),
loss=tf.keras.losses.BinaryCrossentropy(),
metrics=[tf.keras.metrics.BinaryAccuracy(),
tf.keras... | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | (self, optimizer='rmsprop', loss=None, metrics=None, loss_weights=None, weighted_metrics=None, run_eagerly=None, steps_per_execution=None, jit_compile=None, pss_evaluation_shards=0, **kwargs) | [
0.024919170886278152,
-0.08747690916061401,
-0.03955890238285065,
0.04970278963446617,
-0.0026446967385709286,
-0.0020671843085438013,
-0.08697988092899323,
0.0001960930385394022,
-0.009330568835139275,
-0.024422142654657364,
-0.01929371990263462,
0.009805005043745041,
-0.02756245620548725,
... |
725,002 | tf_keras.src.engine.training | compile_from_config | Compiles the model with the information given in config.
This method uses the information in the config (optimizer, loss,
metrics, etc.) to compile the model.
Args:
config: Dict containing information for compiling the model.
| def compile_from_config(self, config):
"""Compiles the model with the information given in config.
This method uses the information in the config (optimizer, loss,
metrics, etc.) to compile the model.
Args:
config: Dict containing information for compiling the model.
"""
has_overridden_c... | (self, config) | [
0.028345225378870964,
-0.03669678419828415,
-0.054544441401958466,
-0.009612339548766613,
-0.010059425607323647,
-0.009817998856306076,
-0.060624804347753525,
-0.005190663505345583,
0.02033345215022564,
-0.0600525327026844,
-0.01920679584145546,
0.007327732630074024,
0.011409623548388481,
... |
725,003 | tf_keras.src.engine.training | compute_loss | Compute the total loss, validate it, and return it.
Subclasses can optionally override this method to provide custom loss
computation logic.
Example:
```python
class MyModel(tf.keras.Model):
def __init__(self, *args, **kwargs):
super(MyModel, self).__init... | def compute_loss(self, x=None, y=None, y_pred=None, sample_weight=None):
"""Compute the total loss, validate it, and return it.
Subclasses can optionally override this method to provide custom loss
computation logic.
Example:
```python
class MyModel(tf.keras.Model):
def __init__(self, *arg... | (self, x=None, y=None, y_pred=None, sample_weight=None) | [
-0.030189121142029762,
-0.06310474872589111,
0.01095541100949049,
0.0774485319852829,
0.045402225106954575,
-0.04812873154878616,
-0.05547843873500824,
0.012753323651850224,
0.07306241989135742,
0.0029339559841901064,
0.0017855641199275851,
-0.02538810297846794,
0.05144795402884483,
-0.003... |
725,005 | tf_keras.src.engine.training | compute_metrics | Update metric states and collect all metrics to be returned.
Subclasses can optionally override this method to provide custom metric
updating and collection logic.
Example:
```python
class MyModel(tf.keras.Sequential):
def compute_metrics(self, x, y, y_pred, sample_w... | def compute_metrics(self, x, y, y_pred, sample_weight):
"""Update metric states and collect all metrics to be returned.
Subclasses can optionally override this method to provide custom metric
updating and collection logic.
Example:
```python
class MyModel(tf.keras.Sequential):
def compute_... | (self, x, y, y_pred, sample_weight) | [
0.0007426313823089004,
-0.06941600143909454,
-0.007334573660045862,
0.05540645867586136,
0.011213211342692375,
-0.01831088587641716,
-0.04960940405726433,
0.014167479239404202,
0.06038597971200943,
0.003502386622130871,
-0.015914028510451317,
-0.0019195773638784885,
0.09907016158103943,
0.... |
725,006 | tf_keras.src.engine.base_layer | compute_output_shape | Computes the output shape of the layer.
This method will cause the layer's state to be built, if that has not
happened before. This requires that the layer will later be used with
inputs that match the input shape provided here.
Args:
input_shape: Shape tuple (tuple of inte... | def compute_output_shape(self, input_shape):
"""Computes the output shape of the layer.
This method will cause the layer's state to be built, if that has not
happened before. This requires that the layer will later be used with
inputs that match the input shape provided here.
Args:
input_sha... | (self, input_shape) | [
-0.006974353455007076,
-0.09457631409168243,
-0.027247339487075806,
0.018842827528715134,
-0.0074758380651474,
0.018062738701701164,
-0.06006673350930214,
0.02080233208835125,
0.0400073416531086,
-0.042830515652894974,
0.027618810534477234,
0.0034964634105563164,
-0.019687920808792114,
-0.... |
725,007 | tf_keras.src.engine.base_layer | compute_output_signature | Compute the output tensor signature of the layer based on the inputs.
Unlike a TensorShape object, a TensorSpec object contains both shape
and dtype information for a tensor. This method allows layers to provide
output dtype information if it is different from the input dtype.
For any l... | @doc_controls.for_subclass_implementers
def compute_output_signature(self, input_signature):
"""Compute the output tensor signature of the layer based on the inputs.
Unlike a TensorShape object, a TensorSpec object contains both shape
and dtype information for a tensor. This method allows layers to provide
... | (self, input_signature) | [
-0.03019217774271965,
-0.08763620257377625,
0.0249748844653368,
0.022769635543227196,
-0.028363436460494995,
-0.016360072419047356,
-0.06328883022069931,
0.05009320005774498,
0.03049696795642376,
0.008184518665075302,
0.04206107556819916,
0.024275658652186394,
-0.017184799537062645,
-0.024... |
725,009 | tf_keras.src.engine.training | evaluate | Returns the loss value & metrics values for the model in test mode.
Computation is done in batches (see the `batch_size` arg.)
Args:
x: Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
... | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | (self, x=None, y=None, batch_size=None, verbose='auto', sample_weight=None, steps=None, callbacks=None, max_queue_size=10, workers=1, use_multiprocessing=False, return_dict=False, **kwargs) | [
0.024942101910710335,
-0.08747810125350952,
-0.039559438824653625,
0.04965827986598015,
-0.00267297332175076,
-0.002055916003882885,
-0.08698106557130814,
0.00023880961816757917,
-0.009330695495009422,
-0.024399882182478905,
-0.0193052776157856,
0.00976560078561306,
-0.02758542262017727,
0... |
725,010 | tf_keras.src.engine.training | evaluate_generator | Evaluates the model on a data generator.
DEPRECATED:
`Model.evaluate` now supports generators, so there is no longer any
need to use this endpoint.
| @doc_controls.do_not_generate_docs
def evaluate_generator(
self,
generator,
steps=None,
callbacks=None,
max_queue_size=10,
workers=1,
use_multiprocessing=False,
verbose=0,
):
"""Evaluates the model on a data generator.
DEPRECATED:
`Model.evaluate` now supports generators, s... | (self, generator, steps=None, callbacks=None, max_queue_size=10, workers=1, use_multiprocessing=False, verbose=0) | [
0.0750487744808197,
-0.0401727631688118,
-0.04251158609986305,
0.041238993406295776,
0.016844701021909714,
0.0402415506541729,
-0.03711165115237236,
0.011332984082400799,
0.013087103143334389,
0.029699640348553658,
0.06359540671110153,
0.03406774252653122,
0.04901214689016342,
0.0283926501... |
725,011 | tf_keras.src.engine.training | export | Create a SavedModel artifact for inference (e.g. via TF-Serving).
This method lets you export a model to a lightweight SavedModel artifact
that contains the model's forward pass only (its `call()` method)
and can be served via e.g. TF-Serving. The forward pass is registered
under the na... | def export(self, filepath):
"""Create a SavedModel artifact for inference (e.g. via TF-Serving).
This method lets you export a model to a lightweight SavedModel artifact
that contains the model's forward pass only (its `call()` method)
and can be served via e.g. TF-Serving. The forward pass is registere... | (self, filepath) | [
0.05151742696762085,
-0.05061424896121025,
-0.10007242113351822,
0.03226161375641823,
0.04664025083184242,
-0.03919804468750954,
-0.056647494435310364,
0.04689314216375351,
-0.005238448269665241,
-0.02581290528178215,
0.020411884412169456,
0.009781447239220142,
-0.019364194944500923,
0.004... |
725,013 | tf_keras.src.engine.training | fit | Trains the model for a fixed number of epochs (dataset iterations).
Args:
x: Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
... | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | (self, x=None, y=None, batch_size=None, epochs=1, verbose='auto', callbacks=None, validation_split=0.0, validation_data=None, shuffle=True, class_weight=None, sample_weight=None, initial_epoch=0, steps_per_epoch=None, validation_steps=None, validation_batch_size=None, validation_freq=1, max_queue_size=10, workers=1, us... | [
0.024919170886278152,
-0.08747690916061401,
-0.03955890238285065,
0.04970278963446617,
-0.0026446967385709286,
-0.0020671843085438013,
-0.08697988092899323,
0.0001960930385394022,
-0.009330568835139275,
-0.024422142654657364,
-0.01929371990263462,
0.009805005043745041,
-0.02756245620548725,
... |
725,014 | tf_keras.src.engine.training | fit_generator | Fits the model on data yielded batch-by-batch by a Python generator.
DEPRECATED:
`Model.fit` now supports generators, so there is no longer any need to
use this endpoint.
| @doc_controls.do_not_generate_docs
def fit_generator(
self,
generator,
steps_per_epoch=None,
epochs=1,
verbose=1,
callbacks=None,
validation_data=None,
validation_steps=None,
validation_freq=1,
class_weight=None,
max_queue_size=10,
workers=1,
use_multiprocessing=False... | (self, generator, steps_per_epoch=None, epochs=1, verbose=1, callbacks=None, validation_data=None, validation_steps=None, validation_freq=1, class_weight=None, max_queue_size=10, workers=1, use_multiprocessing=False, shuffle=True, initial_epoch=0) | [
0.06601640582084656,
-0.00630524754524231,
-0.04845375940203667,
-0.004004062619060278,
-0.011920140124857426,
0.03713192790746689,
-0.035511892288923264,
-0.0008514385554008186,
0.0368741936981678,
0.038512635976076126,
0.03186681494116783,
-0.01261049509048462,
0.03405754268169403,
0.030... |
725,015 | tf_keras.src.engine.base_layer | get_build_config | Returns a dictionary with the layer's input shape.
This method returns a config dict that can be used by
`build_from_config(config)` to create all states (e.g. Variables and
Lookup tables) needed by the layer.
By default, the config only contains the input shape that the layer
... | def get_build_config(self):
"""Returns a dictionary with the layer's input shape.
This method returns a config dict that can be used by
`build_from_config(config)` to create all states (e.g. Variables and
Lookup tables) needed by the layer.
By default, the config only contains the input shape that t... | (self) | [
0.01563890650868416,
-0.059172336012125015,
-0.028229327872395515,
-0.0018469328060746193,
-0.027295397594571114,
0.05124275013804436,
-0.047718487679958344,
0.026185255497694016,
0.044828593730926514,
-0.035665515810251236,
-0.026696274057030678,
-0.022185221314430237,
-0.04909295216202736,... |
725,016 | tf_keras.src.engine.training | get_compile_config | Returns a serialized config with information for compiling the model.
This method returns a config dictionary containing all the information
(optimizer, loss, metrics, etc.) with which the model was compiled.
Returns:
A dict containing information for compiling the model.
| def get_compile_config(self):
"""Returns a serialized config with information for compiling the model.
This method returns a config dictionary containing all the information
(optimizer, loss, metrics, etc.) with which the model was compiled.
Returns:
A dict containing information for compiling t... | (self) | [
0.031432684510946274,
-0.034097976982593536,
0.005392775405198336,
-0.03416905179619789,
0.009541747160255909,
0.0026031024754047394,
-0.033795908093452454,
-0.02103804238140583,
0.0033182892948389053,
-0.053803373128175735,
-0.022050853818655014,
-0.03507525101304054,
-0.019403329119086266,... |
725,017 | tf_keras.src.engine.training | get_config | Returns the config of the `Model`.
Config is a Python dictionary (serializable) containing the
configuration of an object, which in this case is a `Model`. This allows
the `Model` to be be reinstantiated later (without its trained weights)
from this configuration.
Note that `ge... | @generic_utils.default
def get_config(self):
"""Returns the config of the `Model`.
Config is a Python dictionary (serializable) containing the
configuration of an object, which in this case is a `Model`. This allows
the `Model` to be be reinstantiated later (without its trained weights)
from this co... | (self) | [
0.021138088777661324,
-0.03032102808356285,
-0.023679278790950775,
0.031379856169223785,
-0.010761559009552002,
-0.01610383577644825,
-0.05040028691291809,
0.009423582814633846,
0.04393180087208748,
-0.0454719178378582,
-0.016931647434830666,
-0.005756182596087456,
-0.029897496104240417,
0... |
725,018 | tf_keras.src.engine.base_layer | get_input_at | Retrieves the input tensor(s) of a layer at a given node.
Args:
node_index: Integer, index of the node
from which to retrieve the attribute.
E.g. `node_index=0` will correspond to the
first input node of the layer.
Returns:
A tens... | @doc_controls.do_not_doc_inheritable
def get_input_at(self, node_index):
"""Retrieves the input tensor(s) of a layer at a given node.
Args:
node_index: Integer, index of the node
from which to retrieve the attribute.
E.g. `node_index=0` will correspond to the
first in... | (self, node_index) | [
-0.03915867954492569,
-0.05068410933017731,
-0.009338373318314552,
0.006023077294230461,
-0.00872217956930399,
0.052385151386260986,
-0.015404844656586647,
0.004638811107724905,
0.11358794569969177,
0.01544823870062828,
0.017270782962441444,
-0.03002859838306904,
-0.030462538823485374,
0.0... |
725,019 | tf_keras.src.engine.base_layer | get_input_mask_at | Retrieves the input mask tensor(s) of a layer at a given node.
Args:
node_index: Integer, index of the node
from which to retrieve the attribute.
E.g. `node_index=0` will correspond to the
first time the layer was called.
Returns:
... | @doc_controls.do_not_doc_inheritable
def get_input_mask_at(self, node_index):
"""Retrieves the input mask tensor(s) of a layer at a given node.
Args:
node_index: Integer, index of the node
from which to retrieve the attribute.
E.g. `node_index=0` will correspond to the
... | (self, node_index) | [
0.000929960748180747,
-0.06847971677780151,
0.01590881682932377,
-0.0038885336834937334,
-0.03508763760328293,
0.02782096527516842,
-0.04366922751069069,
0.013555800542235374,
0.1202806904911995,
0.025675568729639053,
0.01932588219642639,
-0.012526355683803558,
-0.021938422694802284,
-0.00... |
725,020 | tf_keras.src.engine.base_layer | get_input_shape_at | Retrieves the input shape(s) of a layer at a given node.
Args:
node_index: Integer, index of the node
from which to retrieve the attribute.
E.g. `node_index=0` will correspond to the
first time the layer was called.
Returns:
A sha... | @doc_controls.do_not_doc_inheritable
def get_input_shape_at(self, node_index):
"""Retrieves the input shape(s) of a layer at a given node.
Args:
node_index: Integer, index of the node
from which to retrieve the attribute.
E.g. `node_index=0` will correspond to the
fir... | (self, node_index) | [
-0.03455488011240959,
-0.07388310879468918,
0.0041291178204119205,
-0.003988598007708788,
-0.02533678710460663,
0.04237210005521774,
-0.009391040541231632,
0.027844522148370743,
0.11082465946674347,
0.025976691395044327,
0.022483155131340027,
-0.027118144556879997,
-0.030404143035411835,
0... |
725,021 | tf_keras.src.engine.training | get_layer | Retrieves a layer based on either its name (unique) or index.
If `name` and `index` are both provided, `index` will take precedence.
Indices are based on order of horizontal graph traversal (bottom-up).
Args:
name: String, name of layer.
index: Integer, index of layer.
... | def get_layer(self, name=None, index=None):
"""Retrieves a layer based on either its name (unique) or index.
If `name` and `index` are both provided, `index` will take precedence.
Indices are based on order of horizontal graph traversal (bottom-up).
Args:
name: String, name of layer.
ind... | (self, name=None, index=None) | [
-0.02172437496483326,
-0.05128086730837822,
-0.0670868530869484,
0.03788475692272186,
-0.01726786606013775,
-0.013378387317061424,
-0.032090410590171814,
0.029521051794290543,
0.09412714838981628,
0.0002448920567985624,
0.00676007242873311,
-0.036502622067928314,
-0.0332067534327507,
-0.02... |
725,022 | tf_keras.src.engine.training | get_metrics_result | Returns the model's metrics values as a dict.
If any of the metric result is a dict (containing multiple metrics),
each of them gets added to the top level returned dict of this method.
Returns:
A `dict` containing values of the metrics listed in `self.metrics`.
Example:
... | def get_metrics_result(self):
"""Returns the model's metrics values as a dict.
If any of the metric result is a dict (containing multiple metrics),
each of them gets added to the top level returned dict of this method.
Returns:
A `dict` containing values of the metrics listed in `self.metrics`.
... | (self) | [
-0.01569344289600849,
-0.05860576406121254,
-0.01870165392756462,
0.002795281121507287,
0.02154676988720894,
0.019462767988443375,
0.0017963192658498883,
-0.057663433253765106,
0.030843231827020645,
0.04827636107802391,
0.004392261151224375,
-0.008680322207510471,
0.04776895418763161,
-0.0... |
725,023 | tf_keras.src.engine.base_layer | get_output_at | Retrieves the output tensor(s) of a layer at a given node.
Args:
node_index: Integer, index of the node
from which to retrieve the attribute.
E.g. `node_index=0` will correspond to the
first output node of the layer.
Returns:
A te... | @doc_controls.do_not_doc_inheritable
def get_output_at(self, node_index):
"""Retrieves the output tensor(s) of a layer at a given node.
Args:
node_index: Integer, index of the node
from which to retrieve the attribute.
E.g. `node_index=0` will correspond to the
first ... | (self, node_index) | [
-0.03632887452840805,
-0.05382562428712845,
0.0009587261592969298,
-0.006942204665392637,
0.03256244957447052,
0.05160001292824745,
-0.044923167675733566,
0.013756007887423038,
0.09559869021177292,
-0.0077254497446119785,
0.03097027912735939,
0.001313968445174396,
-0.012026877142488956,
-0... |
725,024 | tf_keras.src.engine.base_layer | get_output_mask_at | Retrieves the output mask tensor(s) of a layer at a given node.
Args:
node_index: Integer, index of the node
from which to retrieve the attribute.
E.g. `node_index=0` will correspond to the
first time the layer was called.
Returns:
... | @doc_controls.do_not_doc_inheritable
def get_output_mask_at(self, node_index):
"""Retrieves the output mask tensor(s) of a layer at a given node.
Args:
node_index: Integer, index of the node
from which to retrieve the attribute.
E.g. `node_index=0` will correspond to the
... | (self, node_index) | [
0.0033690892159938812,
-0.07246752828359604,
0.02664448879659176,
-0.01734631508588791,
-0.01907580904662609,
0.03589129075407982,
-0.06643998622894287,
0.022825900465250015,
0.1160302385687828,
0.016096284613013268,
0.02873357944190502,
0.007654297165572643,
-0.004240258131176233,
-0.0159... |
725,025 | tf_keras.src.engine.base_layer | get_output_shape_at | Retrieves the output shape(s) of a layer at a given node.
Args:
node_index: Integer, index of the node
from which to retrieve the attribute.
E.g. `node_index=0` will correspond to the
first time the layer was called.
Returns:
A sh... | @doc_controls.do_not_doc_inheritable
def get_output_shape_at(self, node_index):
"""Retrieves the output shape(s) of a layer at a given node.
Args:
node_index: Integer, index of the node
from which to retrieve the attribute.
E.g. `node_index=0` will correspond to the
f... | (self, node_index) | [
-0.03615874797105789,
-0.07794905453920364,
0.011451986618340015,
-0.015632735565304756,
0.003023959929123521,
0.044228363782167435,
-0.03423577547073364,
0.03200375288724899,
0.09518712759017944,
0.005176572594791651,
0.031729042530059814,
-0.005674485117197037,
-0.016783084720373154,
-0.... |
725,026 | tf_keras.src.engine.training | get_weight_paths | Retrieve all the variables and their paths for the model.
The variable path (string) is a stable key to identify a `tf.Variable`
instance owned by the model. It can be used to specify variable-specific
configurations (e.g. DTensor, quantization) from a global view.
This method returns ... | def get_weight_paths(self):
"""Retrieve all the variables and their paths for the model.
The variable path (string) is a stable key to identify a `tf.Variable`
instance owned by the model. It can be used to specify variable-specific
configurations (e.g. DTensor, quantization) from a global view.
Thi... | (self) | [
0.024346988648176193,
-0.05414898693561554,
-0.04017052426934242,
0.013627494685351849,
-0.005444981157779694,
0.021218379959464073,
-0.03796445578336716,
0.0038881979417055845,
0.028719017282128334,
-0.012644791044294834,
-0.014058681204915047,
-0.009290562011301517,
-0.01889197900891304,
... |
725,027 | tf_keras.src.engine.training | get_weights | Retrieves the weights of the model.
Returns:
A flat list of Numpy arrays.
| def get_weights(self):
"""Retrieves the weights of the model.
Returns:
A flat list of Numpy arrays.
"""
with self.distribute_strategy.scope():
return super().get_weights()
| (self) | [
0.008316305465996265,
-0.0446820892393589,
-0.05810370668768883,
-0.0020578396506607533,
0.006846723146736622,
0.011077080853283405,
-0.04719651862978935,
-0.02475353702902794,
0.06890895962715149,
0.05541938170790672,
-0.015052597038447857,
-0.04104635864496231,
0.012419242411851883,
0.01... |
725,028 | tf_keras.src.engine.base_layer | load_own_variables | Loads the state of the layer.
You can override this method to take full control of how the state of
the layer is loaded upon calling `keras.models.load_model()`.
Args:
store: Dict from which the state of the model will be loaded.
| def load_own_variables(self, store):
"""Loads the state of the layer.
You can override this method to take full control of how the state of
the layer is loaded upon calling `keras.models.load_model()`.
Args:
store: Dict from which the state of the model will be loaded.
"""
self._update_t... | (self, store) | [
-0.005032144952565432,
-0.01855851523578167,
-0.08383085578680038,
0.049289438873529434,
0.010893424972891808,
0.01802928000688553,
-0.04653741791844368,
-0.0030320766381919384,
0.022651266306638718,
-0.01513612736016512,
-0.03021933138370514,
0.017702918499708176,
-0.02049904316663742,
0.... |
725,029 | tf_keras.src.engine.training | load_weights | Loads all layer weights from a saved files.
The saved file could be a SavedModel file, a `.keras` file (v3 saving
format), or a file created via `model.save_weights()`.
By default, weights are loaded based on the network's
topology. This means the architecture should be the same as whe... | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | (self, filepath, skip_mismatch=False, by_name=False, options=None) | [
0.024942101910710335,
-0.08747810125350952,
-0.039559438824653625,
0.04965827986598015,
-0.00267297332175076,
-0.002055916003882885,
-0.08698106557130814,
0.00023880961816757917,
-0.009330695495009422,
-0.024399882182478905,
-0.0193052776157856,
0.00976560078561306,
-0.02758542262017727,
0... |
725,030 | tf_keras.src.engine.training | make_predict_function | Creates a function that executes one step of inference.
This method can be overridden to support custom inference logic.
This method is called by `Model.predict` and `Model.predict_on_batch`.
Typically, this method directly controls `tf.function` and
`tf.distribute.Strategy` settings, ... | def make_predict_function(self, force=False):
"""Creates a function that executes one step of inference.
This method can be overridden to support custom inference logic.
This method is called by `Model.predict` and `Model.predict_on_batch`.
Typically, this method directly controls `tf.function` and
... | (self, force=False) | [
0.061950862407684326,
-0.027480073273181915,
-0.07021612673997879,
0.014734571799635887,
0.010746775195002556,
0.034625280648469925,
-0.06643109768629074,
-0.03167064115405083,
0.05492152273654938,
-0.016202235594391823,
0.025780674070119858,
0.00039769342401996255,
-0.028793245553970337,
... |
725,031 | tf_keras.src.engine.training | make_test_function | Creates a function that executes one step of evaluation.
This method can be overridden to support custom evaluation logic.
This method is called by `Model.evaluate` and `Model.test_on_batch`.
Typically, this method directly controls `tf.function` and
`tf.distribute.Strategy` settings, ... | def make_test_function(self, force=False):
"""Creates a function that executes one step of evaluation.
This method can be overridden to support custom evaluation logic.
This method is called by `Model.evaluate` and `Model.test_on_batch`.
Typically, this method directly controls `tf.function` and
`tf... | (self, force=False) | [
0.025099359452724457,
-0.004320579115301371,
-0.029398253187537193,
0.00925322063267231,
0.026660840958356857,
0.05455544590950012,
-0.08890802413225174,
0.006395324598997831,
0.032019998878240585,
-0.030458517372608185,
-0.009224303998053074,
0.024096928536891937,
0.018390774726867676,
0.... |
725,032 | tf_keras.src.engine.training | make_train_function | Creates a function that executes one step of training.
This method can be overridden to support custom training logic.
This method is called by `Model.fit` and `Model.train_on_batch`.
Typically, this method directly controls `tf.function` and
`tf.distribute.Strategy` settings, and dele... | def make_train_function(self, force=False):
"""Creates a function that executes one step of training.
This method can be overridden to support custom training logic.
This method is called by `Model.fit` and `Model.train_on_batch`.
Typically, this method directly controls `tf.function` and
`tf.distri... | (self, force=False) | [
-0.0045358468778431416,
0.004135411232709885,
-0.02457948587834835,
0.008746491745114326,
0.005120726302266121,
0.04519829526543617,
-0.08061139285564423,
-0.007741761393845081,
0.025181353092193604,
-0.023666976019740105,
-0.01261009182780981,
-0.02030816860496998,
0.002272777259349823,
-... |
725,033 | tf_keras.src.engine.training | predict | Generates output predictions for the input samples.
Computation is done in batches. This method is designed for batch
processing of large numbers of inputs. It is not intended for use inside
of loops that iterate over your data and process small numbers of inputs
at a time.
For... | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | (self, x, batch_size=None, verbose='auto', steps=None, callbacks=None, max_queue_size=10, workers=1, use_multiprocessing=False) | [
0.024919170886278152,
-0.08747690916061401,
-0.03955890238285065,
0.04970278963446617,
-0.0026446967385709286,
-0.0020671843085438013,
-0.08697988092899323,
0.0001960930385394022,
-0.009330568835139275,
-0.024422142654657364,
-0.01929371990263462,
0.009805005043745041,
-0.02756245620548725,
... |
725,034 | tf_keras.src.engine.training | predict_generator | Generates predictions for the input samples from a data generator.
DEPRECATED:
`Model.predict` now supports generators, so there is no longer any
need to use this endpoint.
| @doc_controls.do_not_generate_docs
def predict_generator(
self,
generator,
steps=None,
callbacks=None,
max_queue_size=10,
workers=1,
use_multiprocessing=False,
verbose=0,
):
"""Generates predictions for the input samples from a data generator.
DEPRECATED:
`Model.predict` no... | (self, generator, steps=None, callbacks=None, max_queue_size=10, workers=1, use_multiprocessing=False, verbose=0) | [
0.06212548166513443,
-0.02741251140832901,
-0.07658325135707855,
0.002672809176146984,
-0.0005359597853384912,
0.03721803054213524,
-0.047631923109292984,
0.04068932682275772,
0.04516264796257019,
0.037182245403528214,
0.05267782881855965,
0.02435275912284851,
0.012578978203237057,
0.01930... |
725,035 | tf_keras.src.engine.training | predict_on_batch | Returns predictions for a single batch of samples.
Args:
x: Input data. It could be:
- A Numpy array (or array-like), or a list of arrays (in case the
model has multiple inputs).
- A TensorFlow tensor, or a list of tensors (in case the model has
... | def predict_on_batch(self, x):
"""Returns predictions for a single batch of samples.
Args:
x: Input data. It could be:
- A Numpy array (or array-like), or a list of arrays (in case the
model has multiple inputs).
- A TensorFlow tensor, or a list of tensors (in case the ... | (self, x) | [
0.01689780130982399,
-0.021345531567931175,
-0.07623659074306488,
0.008105049841105938,
0.012414347380399704,
0.01866617612540722,
-0.04722810536623001,
0.020559588447213173,
0.05465885251760483,
0.008859734982252121,
0.010494141839444637,
-0.03163425624370575,
-0.01810351200401783,
-0.023... |
725,036 | tf_keras.src.engine.training | predict_step | The logic for one inference step.
This method can be overridden to support custom inference logic.
This method is called by `Model.make_predict_function`.
This method should contain the mathematical logic for one step of
inference. This typically includes the forward pass.
Co... | def predict_step(self, data):
"""The logic for one inference step.
This method can be overridden to support custom inference logic.
This method is called by `Model.make_predict_function`.
This method should contain the mathematical logic for one step of
inference. This typically includes the forwar... | (self, data) | [
0.025024527683854103,
-0.02221508137881756,
-0.030941106379032135,
0.026661818847060204,
0.020373128354549408,
-0.006446839310228825,
0.011814553290605545,
-0.026140863075852394,
0.03207604959607124,
0.03510875999927521,
0.04123000055551529,
-0.016856670379638672,
0.012614593841135502,
0.0... |
725,037 | tf_keras.src.engine.training | reset_metrics | Resets the state of all the metrics in the model.
Examples:
>>> inputs = tf.keras.layers.Input(shape=(3,))
>>> outputs = tf.keras.layers.Dense(2)(inputs)
>>> model = tf.keras.models.Model(inputs=inputs, outputs=outputs)
>>> model.compile(optimizer="Adam", loss="mse", metrics=["... | def reset_metrics(self):
"""Resets the state of all the metrics in the model.
Examples:
>>> inputs = tf.keras.layers.Input(shape=(3,))
>>> outputs = tf.keras.layers.Dense(2)(inputs)
>>> model = tf.keras.models.Model(inputs=inputs, outputs=outputs)
>>> model.compile(optimizer="Adam", loss="mse", ... | (self) | [
-0.026054175570607185,
-0.001371272373944521,
0.05691719427704811,
-0.026260804384946823,
-0.05338570103049278,
-0.010838687419891357,
-0.06033598259091377,
-0.007532605901360512,
0.049666356295347214,
0.045909445732831955,
-0.06984096765518188,
-0.000058188088587485254,
0.07074262946844101,... |
725,038 | tf_keras.src.engine.training | reset_states | null | def reset_states(self):
for layer in self.layers:
if hasattr(layer, "reset_states") and getattr(
layer, "stateful", False
):
layer.reset_states()
| (self) | [
-0.028544753789901733,
-0.0041315932758152485,
0.03690919280052185,
0.011190740391612053,
-0.06061137467622757,
-0.018436986953020096,
-0.06990911066532135,
0.03912797197699547,
0.07677675783634186,
0.04476296156644821,
-0.06860601902008057,
0.024987664073705673,
-0.0038894647732377052,
0.... |
725,039 | tf_keras.src.engine.training | save | Saves a model as a TensorFlow SavedModel or HDF5 file.
See the [Serialization and Saving guide](
https://keras.io/guides/serialization_and_saving/) for details.
Args:
model: TF-Keras model instance to be saved.
filepath: `str` or `pathlib.Path` object. Path where to... | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | (self, filepath, overwrite=True, save_format=None, **kwargs) | [
0.024942101910710335,
-0.08747810125350952,
-0.039559438824653625,
0.04965827986598015,
-0.00267297332175076,
-0.002055916003882885,
-0.08698106557130814,
0.00023880961816757917,
-0.009330695495009422,
-0.024399882182478905,
-0.0193052776157856,
0.00976560078561306,
-0.02758542262017727,
0... |
725,040 | tf_keras.src.engine.base_layer | save_own_variables | Saves the state of the layer.
You can override this method to take full control of how the state of
the layer is saved upon calling `model.save()`.
Args:
store: Dict where the state of the model will be saved.
| def save_own_variables(self, store):
"""Saves the state of the layer.
You can override this method to take full control of how the state of
the layer is saved upon calling `model.save()`.
Args:
store: Dict where the state of the model will be saved.
"""
all_vars = self._trainable_weights... | (self, store) | [
-0.02590879239141941,
-0.01488642580807209,
-0.04405384883284569,
0.056198038160800934,
0.009669054299592972,
-0.004084418527781963,
-0.09750965237617493,
0.01919565536081791,
0.032052114605903625,
0.0019809987861663103,
-0.017210204154253006,
0.017423884943127632,
-0.005132789723575115,
0... |
725,042 | tf_keras.src.engine.training | save_weights | Saves all layer weights.
Either saves in HDF5 or in TensorFlow format based on the `save_format`
argument.
When saving in HDF5 format, the weight file has:
- `layer_names` (attribute), a list of strings
(ordered names of model layers).
- For every layer, a `gr... | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | (self, filepath, overwrite=True, save_format=None, options=None) | [
0.024919170886278152,
-0.08747690916061401,
-0.03955890238285065,
0.04970278963446617,
-0.0026446967385709286,
-0.0020671843085438013,
-0.08697988092899323,
0.0001960930385394022,
-0.009330568835139275,
-0.024422142654657364,
-0.01929371990263462,
0.009805005043745041,
-0.02756245620548725,
... |
725,043 | tf_keras.src.engine.base_layer | set_weights | Sets the weights of the layer, from NumPy arrays.
The weights of a layer represent the state of the layer. This function
sets the weight values from numpy arrays. The weight values should be
passed in the order they are created by the layer. Note that the layer's
weights must be instant... | def set_weights(self, weights):
"""Sets the weights of the layer, from NumPy arrays.
The weights of a layer represent the state of the layer. This function
sets the weight values from numpy arrays. The weight values should be
passed in the order they are created by the layer. Note that the layer's
w... | (self, weights) | [
-0.01917417161166668,
-0.06977375596761703,
-0.02738056145608425,
0.03568418323993683,
-0.0501328743994236,
-0.01607246696949005,
-0.10345496237277985,
0.051182981580495834,
0.04278212785720825,
0.03663705661892891,
-0.007039604242891073,
0.0019300573039799929,
0.020963242277503014,
0.0069... |
725,044 | tf_keras.src.engine.training | summary | Prints a string summary of the network.
Args:
line_length: Total length of printed lines
(e.g. set this to adapt the display to different
terminal window sizes).
positions: Relative or absolute positions of log elements
in each line. If no... | def summary(
self,
line_length=None,
positions=None,
print_fn=None,
expand_nested=False,
show_trainable=False,
layer_range=None,
):
"""Prints a string summary of the network.
Args:
line_length: Total length of printed lines
(e.g. set this to adapt the display to d... | (self, line_length=None, positions=None, print_fn=None, expand_nested=False, show_trainable=False, layer_range=None) | [
-0.042048078030347824,
-0.017096569761633873,
0.021489253267645836,
-0.025443561375141144,
0.0596545934677124,
-0.005926989950239658,
-0.04974198341369629,
-0.07310997694730759,
0.01562936045229435,
-0.01898426003754139,
-0.0850265845656395,
0.007465770933777094,
0.024244744330644608,
0.05... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.