id
int64
0
328k
repository_name
stringlengths
7
58
file_path
stringlengths
9
302
class_name
stringlengths
5
256
human_written_code
stringlengths
16
2.16M
class_skeleton
stringlengths
18
1.49M
⌀
total_program_units
int64
1
1.76k
total_doc_str
int64
0
771
AvgCountLine
float64
0
7.89k
AvgCountLineBlank
float64
0
297
AvgCountLineCode
float64
0
7.89k
AvgCountLineComment
float64
0
7.89k
AvgCyclomatic
float64
0
130
CommentToCodeRatio
float64
0
168
CountClassBase
float64
0
40
CountClassCoupled
float64
0
583
CountClassCoupledModified
float64
0
575
CountClassDerived
float64
0
5.35k
CountDeclInstanceMethod
float64
0
529
CountDeclInstanceVariable
float64
0
296
CountDeclMethod
float64
0
599
CountDeclMethodAll
float64
0
1.12k
CountLine
float64
1
40.4k
CountLineBlank
float64
0
8.16k
CountLineCode
float64
1
25.7k
CountLineCodeDecl
float64
1
8.15k
CountLineCodeExe
float64
0
24.2k
CountLineComment
float64
0
16.5k
CountStmt
float64
1
9.71k
CountStmtDecl
float64
1
8.15k
CountStmtExe
float64
0
9.69k
MaxCyclomatic
float64
0
759
MaxInheritanceTree
float64
0
16
MaxNesting
float64
0
34
SumCyclomatic
float64
0
2.9k
18,000
spotify/luigi
spotify_luigi/luigi/tools/luigi_grep.py
luigi.tools.luigi_grep.LuigiGrep
import json from collections import defaultdict from urllib.request import urlopen class LuigiGrep: def __init__(self, host, port): self._host = host self._port = port @property def graph_url(self): return 'http://{0}:{1}/api/graph'.format(self._host, self._port) def _fetch_j...
class LuigiGrep: def __init__(self, host, port): pass @property def graph_url(self): pass def _fetch_json(self): '''Returns the json representation of the dep graph''' pass def _build_results(self, jobs, job): pass def prefix_search(self, job_name_pre...
8
3
6
0
5
1
2
0.09
0
1
0
0
6
2
6
6
43
6
34
22
26
3
32
21
25
3
0
2
12
18,001
spotify/luigi
spotify_luigi/luigi/tools/range.py
luigi.tools.range.RangeBase
import warnings from luigi.parameter import ParameterException from luigi.task import Register, flatten_output import time from datetime import datetime, timedelta, date import luigi class RangeBase(luigi.WrapperTask): """ Produces a contiguous completed range of a recurring task. Made for the common use ...
class RangeBase(luigi.WrapperTask): ''' Produces a contiguous completed range of a recurring task. Made for the common use case where a task is parameterized by e.g. ``DateParameter``, and assurance is needed that any gaps arising from downtime are eventually filled. Emits events that one can u...
20
10
8
1
5
2
2
0.51
1
8
2
4
17
1
17
96
207
36
114
45
94
58
93
42
75
13
6
2
37
18,002
spotify/luigi
spotify_luigi/luigi/tools/range.py
luigi.tools.range.RangeByMinutes
import functools class RangeByMinutes(RangeByMinutesBase): """Efficiently produces a contiguous completed range of an recurring task every interval minutes that takes a single ``DateMinuteParameter``. Benefits from ``bulk_complete`` information to efficiently cover gaps. Falls back to infer it from o...
class RangeByMinutes(RangeByMinutesBase): '''Efficiently produces a contiguous completed range of an recurring task every interval minutes that takes a single ``DateMinuteParameter``. Benefits from ``bulk_complete`` information to efficiently cover gaps. Falls back to infer it from output filesystem li...
2
1
10
0
10
0
2
0.82
1
4
0
0
1
0
1
105
26
6
11
4
9
9
8
4
6
2
8
1
2
18,003
spotify/luigi
spotify_luigi/luigi/tools/range.py
luigi.tools.range.RangeByMinutesBase
from luigi.parameter import ParameterException import itertools from datetime import datetime, timedelta, date import luigi class RangeByMinutesBase(RangeBase): """ Produces a contiguous completed range of an recurring tasks separated a specified number of minutes. """ start = luigi.DateMinuteParameter...
class RangeByMinutesBase(RangeBase): ''' Produces a contiguous completed range of an recurring tasks separated a specified number of minutes. ''' def datetime_to_parameter(self, dt): pass def parameter_to_datetime(self, p): pass def datetime_to_parameters(self, dt): '...
9
4
6
0
4
1
2
0.26
1
6
2
3
8
0
8
104
81
9
58
20
49
15
35
20
26
6
7
2
13
18,004
spotify/luigi
spotify_luigi/luigi/tools/range.py
luigi.tools.range.RangeDaily
import functools class RangeDaily(RangeDailyBase): """Efficiently produces a contiguous completed range of a daily recurring task that takes a single ``DateParameter``. Falls back to infer it from output filesystem listing to facilitate the common case usage. Convenient to use even from command l...
class RangeDaily(RangeDailyBase): '''Efficiently produces a contiguous completed range of a daily recurring task that takes a single ``DateParameter``. Falls back to infer it from output filesystem listing to facilitate the common case usage. Convenient to use even from command line, like: .. c...
2
1
10
0
10
0
2
0.73
1
4
0
0
1
0
1
104
24
5
11
4
9
8
8
4
6
2
8
1
2
18,005
spotify/luigi
spotify_luigi/luigi/tools/range.py
luigi.tools.range.RangeDailyBase
from datetime import datetime, timedelta, date import itertools import luigi class RangeDailyBase(RangeBase): """ Produces a contiguous completed range of a daily recurring task. """ start = luigi.DateParameter(default=None, description='beginning date, inclusive. Default: None - work backward forever ...
class RangeDailyBase(RangeBase): ''' Produces a contiguous completed range of a daily recurring task. ''' def datetime_to_parameter(self, dt): pass def parameter_to_datetime(self, p): pass def datetime_to_parameters(self, dt): ''' Given a date-time, will produ...
8
4
4
0
3
1
1
0.32
1
3
0
3
7
0
7
103
60
7
41
17
33
13
27
17
19
4
7
2
10
18,006
spotify/luigi
spotify_luigi/luigi/tools/range.py
luigi.tools.range.RangeEvent
import luigi class RangeEvent(luigi.Event): """ Events communicating useful metrics. ``COMPLETE_COUNT`` would normally be nondecreasing, and its derivative would describe performance (how many instances complete invocation-over-invocation). ``COMPLETE_FRACTION`` reaching 1 would be a telling ...
class RangeEvent(luigi.Event): ''' Events communicating useful metrics. ``COMPLETE_COUNT`` would normally be nondecreasing, and its derivative would describe performance (how many instances complete invocation-over-invocation). ``COMPLETE_FRACTION`` reaching 1 would be a telling event in case o...
1
1
0
0
0
0
0
3.75
1
0
0
0
0
0
0
0
21
3
4
4
3
15
4
4
3
0
1
0
0
18,007
spotify/luigi
spotify_luigi/luigi/tools/range.py
luigi.tools.range.RangeHourly
import functools class RangeHourly(RangeHourlyBase): """Efficiently produces a contiguous completed range of an hourly recurring task that takes a single ``DateHourParameter``. Benefits from ``bulk_complete`` information to efficiently cover gaps. Falls back to infer it from output filesystem listing...
class RangeHourly(RangeHourlyBase): '''Efficiently produces a contiguous completed range of an hourly recurring task that takes a single ``DateHourParameter``. Benefits from ``bulk_complete`` information to efficiently cover gaps. Falls back to infer it from output filesystem listing to facilitate the ...
2
1
11
0
10
1
2
0.91
1
5
0
0
1
0
1
105
27
6
11
4
9
10
8
4
6
2
8
1
2
18,008
spotify/luigi
spotify_luigi/luigi/tools/range.py
luigi.tools.range.RangeHourlyBase
from datetime import datetime, timedelta, date import itertools import luigi class RangeHourlyBase(RangeBase): """ Produces a contiguous completed range of an hourly recurring task. """ start = luigi.DateHourParameter(default=None, description='beginning datehour, inclusive. Default: None - work backwa...
class RangeHourlyBase(RangeBase): ''' Produces a contiguous completed range of an hourly recurring task. ''' def datetime_to_parameter(self, dt): pass def parameter_to_datetime(self, p): pass def datetime_to_parameters(self, dt): ''' Given a date-time, will pr...
9
4
4
0
3
1
1
0.33
1
4
1
3
8
0
8
104
63
8
42
17
33
14
28
17
19
4
7
2
11
18,009
spotify/luigi
spotify_luigi/luigi/tools/range.py
luigi.tools.range.RangeMonthly
from datetime import datetime, timedelta, date from dateutil.relativedelta import relativedelta import luigi import itertools class RangeMonthly(RangeBase): """ Produces a contiguous completed range of a monthly recurring task. Unlike the Range* classes with shorter intervals, this class does not perform ...
class RangeMonthly(RangeBase): ''' Produces a contiguous completed range of a monthly recurring task. Unlike the Range* classes with shorter intervals, this class does not perform bulk optimisation. It is assumed that the number of months is low enough not to motivate the increased complexity. Henc...
10
4
4
0
3
1
1
0.34
1
4
0
2
9
0
9
105
72
10
47
20
37
16
32
20
22
4
7
2
12
18,010
spotify/luigi
spotify_luigi/luigi/util.py
luigi.util.copies
from luigi import task class copies: """ Auto-copies a task. Usage: .. code-block:: python @copies(MyTask): class CopyOfMyTask(luigi.Task): def output(self): return LocalTarget(self.date.strftime('/var/xyz/report-%Y-%m-%d')) """ def __init__(self, ...
class copies: ''' Auto-copies a task. Usage: .. code-block:: python @copies(MyTask): class CopyOfMyTask(luigi.Task): def output(self): return LocalTarget(self.date.strftime('/var/xyz/report-%Y-%m-%d')) ''' def __init__(self, task_to_copy): pas...
6
1
8
1
7
1
1
0.73
0
3
2
0
2
1
2
2
33
8
15
10
9
11
14
9
9
2
0
1
4
18,011
spotify/luigi
spotify_luigi/luigi/util.py
luigi.util.inherits
class inherits: """ Task inheritance. *New after Luigi 2.7.6:* multiple arguments support. Usage: .. code-block:: python class AnotherTask(luigi.Task): m = luigi.IntParameter() class YetAnotherTask(luigi.Task): n = luigi.IntParameter() @inherits(...
class inherits: ''' Task inheritance. *New after Luigi 2.7.6:* multiple arguments support. Usage: .. code-block:: python class AnotherTask(luigi.Task): m = luigi.IntParameter() class YetAnotherTask(luigi.Task): n = luigi.IntParameter() @inherits(Anothe...
6
1
11
1
9
1
2
0.91
0
2
0
0
2
2
2
2
78
15
33
11
27
30
26
11
20
6
0
3
12
18,012
spotify/luigi
spotify_luigi/luigi/util.py
luigi.util.requires
class requires: """ Same as :class:`~luigi.util.inherits`, but also auto-defines the requires method. *New after Luigi 2.7.6:* multiple arguments support. """ def __init__(self, *tasks_to_require, **kw_tasks_to_require): super(requires, self).__init__() self.tasks_to_require = tas...
class requires: ''' Same as :class:`~luigi.util.inherits`, but also auto-defines the requires method. *New after Luigi 2.7.6:* multiple arguments support. ''' def __init__(self, *tasks_to_require, **kw_tasks_to_require): pass def __call__(self, task_that_requires): pass ...
4
1
6
1
4
1
1
0.64
0
2
1
0
2
2
2
2
25
7
11
6
7
7
11
6
7
2
0
0
4
18,013
spotify/luigi
spotify_luigi/luigi/worker.py
luigi.worker.AsyncCompletionException
class AsyncCompletionException(Exception): """ Exception indicating that something went wrong with checking complete. """ def __init__(self, trace): self.trace = trace
class AsyncCompletionException(Exception): ''' Exception indicating that something went wrong with checking complete. ''' def __init__(self, trace): pass
2
1
2
0
2
0
1
1
1
0
0
0
1
1
1
11
7
1
3
3
1
3
3
3
1
1
3
0
1
18,014
spotify/luigi
spotify_luigi/luigi/worker.py
luigi.worker.ContextManagedTaskProcess
import importlib class ContextManagedTaskProcess(TaskProcess): def __init__(self, context, *args, **kwargs): super(ContextManagedTaskProcess, self).__init__(*args, **kwargs) self.context = context def run(self): if self.context: logger.debug('Importing module and instantia...
class ContextManagedTaskProcess(TaskProcess): def __init__(self, context, *args, **kwargs): pass def run(self): pass
3
0
7
1
7
0
2
0
1
1
0
0
2
1
2
9
16
2
14
7
11
0
13
7
10
2
2
2
3
18,015
spotify/luigi
spotify_luigi/luigi/worker.py
luigi.worker.DequeQueue
import collections.abc import queue as Queue import collections class DequeQueue(collections.deque): """ deque wrapper implementing the Queue interface. """ def put(self, obj, block=None, timeout=None): return self.append(obj) def get(self, block=None, timeout=None): try: ...
class DequeQueue(collections.deque): ''' deque wrapper implementing the Queue interface. ''' def put(self, obj, block=None, timeout=None): pass def get(self, block=None, timeout=None): pass
3
1
4
0
4
0
2
0.38
0
1
0
0
2
0
2
2
13
2
8
3
5
3
8
3
5
2
0
1
3
18,016
spotify/luigi
spotify_luigi/luigi/worker.py
luigi.worker.KeepAliveThread
import threading class KeepAliveThread(threading.Thread): """ Periodically tell the scheduler that the worker still lives. """ def __init__(self, scheduler, worker_id, ping_interval, rpc_message_callback): super(KeepAliveThread, self).__init__() self._should_stop = threading.Event() ...
class KeepAliveThread(threading.Thread): ''' Periodically tell the scheduler that the worker still lives. ''' def __init__(self, scheduler, worker_id, ping_interval, rpc_message_callback): pass def stop(self): pass def run(self): pass
4
1
9
0
8
1
3
0.2
1
3
0
0
3
5
3
28
33
4
25
11
21
5
25
11
21
6
1
4
8
18,017
spotify/luigi
spotify_luigi/luigi/worker.py
luigi.worker.SchedulerMessage
class SchedulerMessage: """ Message object that is build by the the :py:class:`Worker` when a message from the scheduler is received and passed to the message queue of a :py:class:`Task`. """ def __init__(self, scheduler, task_id, message_id, content, **payload): super(SchedulerMessage, sel...
class SchedulerMessage: ''' Message object that is build by the the :py:class:`Worker` when a message from the scheduler is received and passed to the message queue of a :py:class:`Task`. ''' def __init__(self, scheduler, task_id, message_id, content, **payload): pass def __str__(s...
5
1
4
1
3
0
1
0.29
0
2
0
0
4
5
4
4
24
6
14
10
9
4
14
10
9
1
0
0
4
18,018
spotify/luigi
spotify_luigi/luigi/worker.py
luigi.worker.SingleProcessPool
class SingleProcessPool: """ Dummy process pool for using a single processor. Imitates the api of multiprocessing.Pool using single-processor equivalents. """ def apply_async(self, function, args): return function(*args) def close(self): pass def join(self): pass
class SingleProcessPool: ''' Dummy process pool for using a single processor. Imitates the api of multiprocessing.Pool using single-processor equivalents. ''' def apply_async(self, function, args): pass def close(self): pass def join(self): pass
4
1
2
0
2
0
1
0.57
0
0
0
0
3
0
3
3
15
4
7
4
3
4
7
4
3
1
0
0
3
18,019
spotify/luigi
spotify_luigi/luigi/worker.py
luigi.worker.TaskException
class TaskException(Exception): pass
class TaskException(Exception): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
10
2
0
2
1
1
0
2
1
1
0
3
0
0
18,020
spotify/luigi
spotify_luigi/luigi/worker.py
luigi.worker.TaskProcess
import os import time from luigi.event import Event import functools import collections import collections.abc import contextlib import multiprocessing import random from luigi.scheduler import DISABLED, DONE, FAILED, PENDING, UNKNOWN, Scheduler, RetryPolicy from luigi.task import Task, Config, DynamicRequirements, fla...
class TaskProcess(multiprocessing.Process): ''' Wrap all task execution in this class. Mainly for convenience since this is run in a separate process. ''' def __init__(self, task, worker_id, result_queue, status_reporter, use_multiprocessing=False, worker_timeout=0, check_unfulfilled_deps=True, check_comp...
9
2
23
2
19
2
5
0.15
1
15
3
1
7
11
7
7
187
25
141
43
129
21
115
39
106
18
1
5
38
18,021
spotify/luigi
spotify_luigi/luigi/worker.py
luigi.worker.TaskStatusReporter
from luigi.task_status import RUNNING class TaskStatusReporter: """ Reports task status information to the scheduler. This object must be pickle-able for passing to `TaskProcess` on systems where fork method needs to pickle the process object (e.g. Windows). """ def __init__(self, scheduler,...
class TaskStatusReporter: ''' Reports task status information to the scheduler. This object must be pickle-able for passing to `TaskProcess` on systems where fork method needs to pickle the process object (e.g. Windows). ''' def __init__(self, scheduler, task_id, worker_id, scheduler_messages...
7
1
4
0
4
0
1
0.26
0
0
0
0
5
4
5
5
29
5
19
10
13
5
14
10
8
1
0
0
5
18,022
spotify/luigi
spotify_luigi/luigi/worker.py
luigi.worker.TracebackWrapper
class TracebackWrapper: """ Class to wrap tracebacks so we can know they're not just strings. """ def __init__(self, trace): self.trace = trace
class TracebackWrapper: ''' Class to wrap tracebacks so we can know they're not just strings. ''' def __init__(self, trace): pass
2
1
2
0
2
0
1
1
0
0
0
0
1
1
1
1
7
1
3
3
1
3
3
3
1
1
0
0
1
18,023
spotify/luigi
spotify_luigi/luigi/worker.py
luigi.worker.Worker
from luigi.scheduler import DISABLED, DONE, FAILED, PENDING, UNKNOWN, Scheduler, RetryPolicy import socket import random from luigi.task_status import RUNNING import subprocess from luigi.task_register import load_task import time from luigi.target import Target import queue as Queue import os from luigi.task_register ...
class Worker: ''' Worker object communicates with a scheduler. Simple class that talks to a scheduler and: * tells the scheduler what it has to do + its dependencies * asks for stuff to do (pulls it in a loop and runs it) ''' def __init__(self, scheduler=None, worker_id=None, worker_proces...
41
11
19
2
15
2
4
0.14
0
29
15
1
38
23
38
38
752
108
567
135
526
81
430
129
391
12
0
4
135
18,024
spotify/luigi
spotify_luigi/luigi/worker.py
luigi.worker.worker
from luigi.parameter import BoolParameter, FloatParameter, IntParameter, OptionalParameter, Parameter, TimeDeltaParameter from luigi.task import Task, Config, DynamicRequirements, flatten import datetime class worker(Config): id = Parameter(default='', description='Override the auto-generated worker_id') ping_...
class worker(Config): pass
1
0
0
0
0
0
0
0.02
1
0
0
0
0
0
0
78
61
3
57
19
56
1
20
19
19
0
6
0
0
18,025
Microsoft/LightGBM
docs/conf.py
conf.IgnoredDirective
from typing import Any, List from docutils.parsers.rst import Directive class IgnoredDirective(Directive): """Stub for unknown directives.""" has_content = True def run(self) -> List: """Do nothing.""" return []
class IgnoredDirective(Directive): '''Stub for unknown directives.''' def run(self) -> List: '''Do nothing.''' pass
2
2
3
0
2
1
1
0.5
1
0
0
0
1
0
1
1
8
2
4
3
2
2
4
3
2
1
1
0
1
18,026
Microsoft/LightGBM
docs/conf.py
conf.InternalRefTransform
from docutils.transforms import Transform from typing import Any, List from docutils.nodes import reference class InternalRefTransform(Transform): """Replaces '.rst' with '.html' in all internal links like './[Something].rst[#anchor]'.""" default_priority = 210 'Numerical priority of this transform, 0 thro...
class InternalRefTransform(Transform): '''Replaces '.rst' with '.html' in all internal links like './[Something].rst[#anchor]'.''' def apply(self, **kwargs: Any) -> None: '''Apply the transform to the document tree.''' pass
2
2
5
0
4
1
3
0.5
1
1
0
0
1
0
1
1
11
2
6
4
4
3
6
4
4
3
1
2
3
18,027
Microsoft/LightGBM
examples/python-guide/dataset_from_multi_hdf5.py
dataset_from_multi_hdf5.HDFSequence
import lightgbm as lgb class HDFSequence(lgb.Sequence): def __init__(self, hdf_dataset, batch_size): """ Construct a sequence object from HDF5 with required interface. Parameters ---------- hdf_dataset : h5py.Dataset Dataset in HDF5 file. batch_size : i...
class HDFSequence(lgb.Sequence): def __init__(self, hdf_dataset, batch_size): ''' Construct a sequence object from HDF5 with required interface. Parameters ---------- hdf_dataset : h5py.Dataset Dataset in HDF5 file. batch_size : int Size of a...
4
1
6
0
2
3
1
1.25
1
0
0
0
3
2
3
25
21
3
8
6
4
10
8
6
4
1
5
0
3
18,028
Microsoft/LightGBM
python-package/lightgbm/basic.py
lightgbm.basic.Booster
import json from typing import TYPE_CHECKING, Any, Callable, Dict, Iterable, Iterator, List, Optional, Set, Tuple, Union import ctypes from pathlib import Path from copy import deepcopy from .compat import CFFI_INSTALLED, PANDAS_INSTALLED, PYARROW_INSTALLED, arrow_cffi, arrow_is_boolean, arrow_is_floating, arrow_is_int...
class Booster: '''Booster in LightGBM.''' def __init__(self, params: Optional[Dict[str, Any]]=None, train_set: Optional[Dataset]=None, model_file: Optional[Union[str, Path]]=None, model_str: Optional[str]=None): '''Initialize the Booster. Parameters ---------- params : dict or ...
50
37
37
2
23
12
3
0.56
0
24
4
0
42
21
42
42
1,717
146
1,010
300
845
570
514
180
464
12
0
4
141
18,029
Microsoft/LightGBM
python-package/lightgbm/basic.py
lightgbm.basic.Dataset
from .compat import CFFI_INSTALLED, PANDAS_INSTALLED, PYARROW_INSTALLED, arrow_cffi, arrow_is_boolean, arrow_is_floating, arrow_is_integer, concat, pa_Array, pa_chunked_array, pa_ChunkedArray, pa_compute, pa_Table, pd_CategoricalDtype, pd_DataFrame, pd_Series import scipy.sparse from .libpath import _LIB import numpy a...
class Dataset: ''' Dataset in LightGBM. LightGBM does not train on raw data. It discretizes continuous features into histogram bins, tries to combine categorical features, and automatically handles missing and infinite values. This class handles that preprocessing, and holds that alternative re...
53
43
35
2
24
9
5
0.38
0
27
6
0
47
19
49
49
1,804
160
1,196
291
1,034
456
660
178
609
39
0
5
250
18,030
Microsoft/LightGBM
python-package/lightgbm/basic.py
lightgbm.basic.LGBMDeprecationWarning
class LGBMDeprecationWarning(FutureWarning): """Custom deprecation warning.""" pass
class LGBMDeprecationWarning(FutureWarning): '''Custom deprecation warning.''' pass
1
1
0
0
0
0
0
0.5
1
0
0
0
0
0
0
12
4
1
2
1
1
1
2
1
1
0
5
0
0
18,031
Microsoft/LightGBM
python-package/lightgbm/basic.py
lightgbm.basic.LightGBMError
class LightGBMError(Exception): """Error thrown by LightGBM.""" pass
class LightGBMError(Exception): '''Error thrown by LightGBM.''' pass
1
1
0
0
0
0
0
0.5
1
0
0
0
0
0
0
10
4
1
2
1
1
1
2
1
1
0
3
0
0
18,032
Microsoft/LightGBM
python-package/lightgbm/basic.py
lightgbm.basic.Sequence
from typing import TYPE_CHECKING, Any, Callable, Dict, Iterable, Iterator, List, Optional, Set, Tuple, Union import abc import numpy as np class Sequence(abc.ABC): """ Generic data access interface. Object should support the following operations: .. code-block:: # Get total row number. ...
class Sequence(abc.ABC): ''' Generic data access interface. Object should support the following operations: .. code-block:: # Get total row number. >>> len(seq) # Random access by row index. Used for data sampling. >>> seq[10] # Range data access. Used to read da...
5
3
16
3
2
11
1
5.38
1
3
0
2
2
0
2
22
64
14
8
6
3
43
6
4
3
1
4
0
2
18,033
Microsoft/LightGBM
python-package/lightgbm/basic.py
lightgbm.basic._ArrowCArray
from .compat import CFFI_INSTALLED, PANDAS_INSTALLED, PYARROW_INSTALLED, arrow_cffi, arrow_is_boolean, arrow_is_floating, arrow_is_integer, concat, pa_Array, pa_chunked_array, pa_ChunkedArray, pa_compute, pa_Table, pd_CategoricalDtype, pd_DataFrame, pd_Series class _ArrowCArray: """Simple wrapper around the C repr...
class _ArrowCArray: '''Simple wrapper around the C representation of an Arrow type.''' def __init__(self, n_chunks: int, chunks: arrow_cffi.CData, schema: arrow_cffi.CData): pass @property def chunks_ptr(self) -> int: '''Returns the address of the pointer to the list of chunks making u...
6
3
3
0
3
1
1
0.21
0
1
0
0
3
0
3
3
21
4
14
6
8
3
12
4
8
1
0
0
3
18,034
Microsoft/LightGBM
python-package/lightgbm/basic.py
lightgbm.basic._ConfigAliases
import json from typing import TYPE_CHECKING, Any, Callable, Dict, Iterable, Iterator, List, Optional, Set, Tuple, Union import ctypes from .libpath import _LIB class _ConfigAliases: aliases = None @staticmethod def _get_all_param_aliases() -> Dict[str, List[str]]: buffer_len = 1 << 20 tmp...
class _ConfigAliases: @staticmethod def _get_all_param_aliases() -> Dict[str, List[str]]: pass @classmethod def get(cls, *args: str) -> Set[str]: pass @classmethod def get_sorted(cls, name: str) -> List[str]: pass @classmethod def get_by_alias(cls, *args: str) -...
9
0
12
0
12
0
3
0.04
0
3
0
0
0
0
4
4
59
4
53
20
44
2
35
16
30
5
0
3
12
18,035
Microsoft/LightGBM
python-package/lightgbm/basic.py
lightgbm.basic._DummyLogger
import warnings class _DummyLogger: def info(self, msg: str) -> None: print(msg) def warning(self, msg: str) -> None: warnings.warn(msg, stacklevel=3)
class _DummyLogger: def info(self, msg: str) -> None: pass def warning(self, msg: str) -> None: pass
3
0
2
0
2
1
1
0.2
0
1
0
0
2
0
2
2
6
1
5
3
2
1
5
3
2
1
0
0
2
18,036
Microsoft/LightGBM
python-package/lightgbm/basic.py
lightgbm.basic._InnerPredictor
from .compat import CFFI_INSTALLED, PANDAS_INSTALLED, PYARROW_INSTALLED, arrow_cffi, arrow_is_boolean, arrow_is_floating, arrow_is_integer, concat, pa_Array, pa_chunked_array, pa_ChunkedArray, pa_compute, pa_Table, pd_CategoricalDtype, pd_DataFrame, pd_Series import scipy.sparse from .libpath import _LIB import numpy a...
class _InnerPredictor: '''_InnerPredictor of LightGBM. Not exposed to user. Used only for prediction, usually used for continued training. .. note:: Can be converted from Booster, but cannot be converted to Booster. ''' def __init__(self, booster_handle: _BoosterHandle, pandas_categori...
20
11
44
1
38
5
4
0.14
0
22
5
0
15
5
17
17
781
41
651
194
541
89
237
100
219
19
0
2
68
18,037
Microsoft/LightGBM
python-package/lightgbm/basic.py
lightgbm.basic._MissingType
from enum import Enum class _MissingType(Enum): NONE = 'None' NAN = 'NaN' ZERO = 'Zero'
class _MissingType(Enum): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
49
4
0
4
4
3
0
4
4
3
0
4
0
0
18,038
Microsoft/LightGBM
python-package/lightgbm/basic.py
lightgbm.basic._TempFile
from typing import TYPE_CHECKING, Any, Callable, Dict, Iterable, Iterator, List, Optional, Set, Tuple, Union from pathlib import Path from tempfile import NamedTemporaryFile class _TempFile: """Proxy class to workaround errors on Windows.""" def __enter__(self) -> '_TempFile': with NamedTemporaryFile(...
class _TempFile: '''Proxy class to workaround errors on Windows.''' def __enter__(self) -> '_TempFile': pass def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None: pass
3
1
4
0
4
0
2
0.11
0
2
0
0
2
2
2
2
12
2
9
6
6
1
9
5
6
2
0
1
3
18,039
Microsoft/LightGBM
python-package/lightgbm/callback.py
lightgbm.callback.CallbackEnv
from .basic import Booster, _ConfigAliases, _LGBM_BoosterEvalMethodResultType, _LGBM_BoosterEvalMethodResultWithStandardDeviationType, _log_info, _log_warning from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Union from dataclasses import dataclass @dataclass class CallbackEnv: model: Union[Bo...
@dataclass class CallbackEnv: pass
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
7
0
7
1
6
0
7
1
6
0
0
0
0
18,040
Microsoft/LightGBM
python-package/lightgbm/callback.py
lightgbm.callback.EarlyStopException
class EarlyStopException(Exception): """Exception of early stopping. Raise this from a callback passed in via keyword argument ``callbacks`` in ``cv()`` or ``train()`` to trigger early stopping. """ def __init__(self, best_iteration: int, best_score: _ListOfEvalResultTuples) -> None: """Cr...
class EarlyStopException(Exception): '''Exception of early stopping. Raise this from a callback passed in via keyword argument ``callbacks`` in ``cv()`` or ``train()`` to trigger early stopping. ''' def __init__(self, best_iteration: int, best_score: _ListOfEvalResultTuples) -> None: '''Cre...
2
2
14
1
4
9
1
2.6
1
2
0
0
1
2
1
11
21
3
5
4
3
13
5
4
3
1
3
0
1
18,041
Microsoft/LightGBM
python-package/lightgbm/callback.py
lightgbm.callback._EarlyStoppingCallback
from functools import partial from .basic import Booster, _ConfigAliases, _LGBM_BoosterEvalMethodResultType, _LGBM_BoosterEvalMethodResultWithStandardDeviationType, _log_info, _log_warning from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Union class _EarlyStoppingCallback: """Internal early s...
class _EarlyStoppingCallback: '''Internal early stopping callable class.''' def __init__(self, stopping_rounds: int, first_metric_only: bool=False, verbose: bool=True, min_delta: Union[float, List[float]]=0.0) -> None: pass def _reset_storages(self) -> None: pass def _gt_delta(self, ...
9
2
19
2
17
1
5
0.08
0
12
2
0
8
12
8
8
162
20
134
39
119
11
109
33
100
18
0
4
41
18,042
Microsoft/LightGBM
python-package/lightgbm/callback.py
lightgbm.callback._LogEvaluationCallback
from .basic import Booster, _ConfigAliases, _LGBM_BoosterEvalMethodResultType, _LGBM_BoosterEvalMethodResultWithStandardDeviationType, _log_info, _log_warning class _LogEvaluationCallback: """Internal log evaluation callable class.""" def __init__(self, period: int=1, show_stdv: bool=True) -> None: se...
class _LogEvaluationCallback: '''Internal log evaluation callable class.''' def __init__(self, period: int=1, show_stdv: bool=True) -> None: pass def __call__(self, env: CallbackEnv) -> None: pass
3
1
5
1
5
0
2
0.1
0
3
1
0
2
4
2
2
14
3
10
8
7
1
10
8
7
2
0
1
3
18,043
Microsoft/LightGBM
python-package/lightgbm/callback.py
lightgbm.callback._RecordEvaluationCallback
from collections import OrderedDict class _RecordEvaluationCallback: """Internal record evaluation callable class.""" def __init__(self, eval_result: _EvalResultDict) -> None: self.order = 20 self.before_iteration = False if not isinstance(eval_result, dict): raise TypeErro...
class _RecordEvaluationCallback: '''Internal record evaluation callable class.''' def __init__(self, eval_result: _EvalResultDict) -> None: pass def _init(self, env: CallbackEnv) -> None: pass def __call__(self, env: CallbackEnv) -> None: pass
4
1
14
0
12
1
4
0.13
0
5
1
0
3
3
3
3
46
4
38
12
34
5
30
12
26
5
0
2
11
18,044
Microsoft/LightGBM
python-package/lightgbm/callback.py
lightgbm.callback._ResetParameterCallback
from .basic import Booster, _ConfigAliases, _LGBM_BoosterEvalMethodResultType, _LGBM_BoosterEvalMethodResultWithStandardDeviationType, _log_info, _log_warning from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Union class _ResetParameterCallback: """Internal reset parameter callable class.""" ...
class _ResetParameterCallback: '''Internal reset parameter callable class.''' def __init__(self, **kwargs: Union[list, Callable]) -> None: pass def __call__(self, env: CallbackEnv) -> None: pass
3
1
15
1
14
1
5
0.07
0
3
1
0
2
3
2
2
33
3
28
10
25
2
22
10
19
9
0
3
10
18,045
Microsoft/LightGBM
python-package/lightgbm/dask.py
lightgbm.dask.DaskLGBMClassifier
import numpy as np from typing import Any, Dict, Iterable, List, Optional, Tuple, Type, Union from .compat import DASK_INSTALLED, PANDAS_INSTALLED, SKLEARN_INSTALLED, Client, Future, LGBMNotFittedError, concat, dask_Array, dask_array_from_delayed, dask_bag_from_delayed, dask_DataFrame, dask_Series, default_client, dela...
class DaskLGBMClassifier(LGBMClassifier, _DaskLGBMModel): '''Distributed version of lightgbm.LGBMClassifier.''' def __init__(self, *, boosting_type: str='gbdt', num_leaves: int=31, max_depth: int=-1, learning_rate: float=0.1, n_estimators: int=100, subsample_for_bin: int=200000, objective: Optional[Union[str,...
7
6
23
0
21
2
1
0.1
2
7
0
0
6
1
6
44
201
16
172
66
109
17
24
10
17
1
3
0
6
18,046
Microsoft/LightGBM
python-package/lightgbm/dask.py
lightgbm.dask.DaskLGBMRanker
from typing import Any, Dict, Iterable, List, Optional, Tuple, Type, Union from .compat import DASK_INSTALLED, PANDAS_INSTALLED, SKLEARN_INSTALLED, Client, Future, LGBMNotFittedError, concat, dask_Array, dask_array_from_delayed, dask_bag_from_delayed, dask_DataFrame, dask_Series, default_client, delayed, pd_DataFrame, ...
class DaskLGBMRanker(LGBMRanker, _DaskLGBMModel): '''Distributed version of lightgbm.LGBMRanker.''' def __init__(self, *, boosting_type: str='gbdt', num_leaves: int=31, max_depth: int=-1, learning_rate: float=0.1, n_estimators: int=100, subsample_for_bin: int=200000, objective: Optional[Union[str, _LGBM_Sciki...
6
5
23
0
21
2
1
0.1
2
7
0
0
5
1
5
36
174
14
148
57
94
15
21
9
15
1
3
0
5
18,047
Microsoft/LightGBM
python-package/lightgbm/dask.py
lightgbm.dask.DaskLGBMRegressor
from .compat import DASK_INSTALLED, PANDAS_INSTALLED, SKLEARN_INSTALLED, Client, Future, LGBMNotFittedError, concat, dask_Array, dask_array_from_delayed, dask_bag_from_delayed, dask_DataFrame, dask_Series, default_client, delayed, pd_DataFrame, pd_Series, wait from .sklearn import LGBMClassifier, LGBMModel, LGBMRanker,...
class DaskLGBMRegressor(LGBMRegressor, _DaskLGBMModel): '''Distributed version of lightgbm.LGBMRegressor.''' def __init__(self, *, boosting_type: str='gbdt', num_leaves: int=31, max_depth: int=-1, learning_rate: float=0.1, n_estimators: int=100, subsample_for_bin: int=200000, objective: Optional[Union[str, _L...
6
5
22
0
20
2
1
0.11
2
7
0
0
5
1
5
38
165
15
138
54
87
15
22
9
16
1
3
0
5
18,048
Microsoft/LightGBM
python-package/lightgbm/dask.py
lightgbm.dask._DaskLGBMModel
from .compat import DASK_INSTALLED, PANDAS_INSTALLED, SKLEARN_INSTALLED, Client, Future, LGBMNotFittedError, concat, dask_Array, dask_array_from_delayed, dask_bag_from_delayed, dask_DataFrame, dask_Series, default_client, delayed, pd_DataFrame, pd_Series, wait from .basic import LightGBMError, _choose_param_value, _Con...
class _DaskLGBMModel: @property def client_(self) -> Client: ''':obj:`dask.distributed.Client`: Dask client. This property can be passed in the constructor or updated with ``model.set_params(client=client)``. ''' pass def _lgb_dask_getstate(self) -> Dict[Any, Any]:...
8
2
17
1
15
2
2
0.14
0
6
1
3
4
1
5
5
91
10
76
39
48
11
36
17
30
3
0
1
9
18,049
Microsoft/LightGBM
python-package/lightgbm/dask.py
lightgbm.dask._DatasetNames
from enum import Enum, auto class _DatasetNames(Enum): """Placeholder names used by lightgbm.dask internals to say 'also evaluate the training data'. Avoid duplicating the training data when the validation set refers to elements of training data. """ TRAINSET = auto() SAMPLE_WEIGHT = auto() IN...
class _DatasetNames(Enum): '''Placeholder names used by lightgbm.dask internals to say 'also evaluate the training data'. Avoid duplicating the training data when the validation set refers to elements of training data. ''' pass
1
1
0
0
0
0
0
0.6
1
0
0
0
0
0
0
49
10
2
5
5
4
3
5
5
4
0
4
0
0
18,050
Microsoft/LightGBM
python-package/lightgbm/dask.py
lightgbm.dask._RemoteSocket
import socket class _RemoteSocket: def acquire(self) -> int: self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self.socket.bind(('', 0)) return self.socket.getsockname()[1] def release(self) -> Non...
class _RemoteSocket: def acquire(self) -> int: pass def release(self) -> None: pass
3
0
4
0
4
0
1
0
0
1
0
0
2
1
2
2
9
1
8
4
5
0
8
4
5
1
0
0
2
18,051
Microsoft/LightGBM
python-package/lightgbm/engine.py
lightgbm.engine.CVBooster
from .basic import Booster, Dataset, LightGBMError, _choose_param_value, _ConfigAliases, _InnerPredictor, _LGBM_BoosterEvalMethodResultType, _LGBM_BoosterEvalMethodResultWithStandardDeviationType, _LGBM_CustomObjectiveFunction, _LGBM_EvalFunctionResultType, _log_warning import json from pathlib import Path from typing ...
class CVBooster: '''CVBooster in LightGBM. Auxiliary data structure to hold and redirect all boosters of ``cv()`` function. This class has the same methods as Booster class. All method calls, except for the following methods, are actually performed for underlying Boosters and then all returned resu...
11
9
13
1
6
6
1
1.33
0
4
0
0
9
2
9
9
151
23
55
34
30
73
37
18
26
2
0
2
14
18,052
Microsoft/LightGBM
python-package/lightgbm/sklearn.py
lightgbm.sklearn.LGBMClassifier
from pathlib import Path from .basic import _MULTICLASS_OBJECTIVES, Booster, Dataset, LightGBMError, _choose_param_value, _ConfigAliases, _LGBM_BoosterBestScoreType, _LGBM_CategoricalFeatureConfiguration, _LGBM_EvalFunctionResultType, _LGBM_FeatureNameConfiguration, _LGBM_GroupType, _LGBM_InitScoreType, _LGBM_LabelType...
class LGBMClassifier(_LGBMClassifierBase, LGBMModel): '''LightGBM classifier.''' def __init__(self, *, boosting_type: str='gbdt', num_leaves: int=31, max_depth: int=-1, learning_rate: float=0.1, n_estimators: int=100, subsample_for_bin: int=200000, objective: Optional[Union[str, _LGBM_ScikitCustomObjectiveFun...
13
7
21
1
19
2
4
0.11
2
12
0
1
8
6
8
33
201
15
174
65
126
19
78
26
69
17
2
4
30
18,053
Microsoft/LightGBM
python-package/lightgbm/sklearn.py
lightgbm.sklearn.LGBMModel
from pathlib import Path import numpy as np from .engine import train import copy from .basic import _MULTICLASS_OBJECTIVES, Booster, Dataset, LightGBMError, _choose_param_value, _ConfigAliases, _LGBM_BoosterBestScoreType, _LGBM_CategoricalFeatureConfiguration, _LGBM_EvalFunctionResultType, _LGBM_FeatureNameConfigurati...
class LGBMModel(_LGBMModelBase): '''Implementation of the scikit-learn API for LightGBM.''' def __init__(self, *, boosting_type: str='gbdt', num_leaves: int=31, max_depth: int=-1, learning_rate: float=0.1, n_estimators: int=100, subsample_for_bin: int=200000, objective: Optional[Union[str, _LGBM_ScikitCustomO...
41
23
29
3
17
10
4
0.57
1
19
5
3
24
32
25
25
797
91
455
153
360
261
247
84
221
26
1
5
88
18,054
Microsoft/LightGBM
python-package/lightgbm/sklearn.py
lightgbm.sklearn.LGBMRanker
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Union import numpy as np from .basic import _MULTICLASS_OBJECTIVES, Booster, Dataset, LightGBMError, _choose_param_value, _ConfigAliases, _LGBM_BoosterBestScoreType, _LGBM_CategoricalFeatureConfiguration, _LGBM_EvalFunctionResultType, _LGBM_F...
class LGBMRanker(LGBMModel): '''LightGBM ranker. .. warning:: scikit-learn doesn't support ranking applications yet, therefore this class is not really compatible with the sklearn ecosystem. Please use this class mainly for training and applying ranking models in common sklearnish way. ...
3
2
59
2
55
3
6
0.18
1
8
0
1
1
1
1
26
80
6
66
23
46
12
17
5
15
6
2
2
6
18,055
Microsoft/LightGBM
python-package/lightgbm/sklearn.py
lightgbm.sklearn.LGBMRegressor
import numpy as np from .basic import _MULTICLASS_OBJECTIVES, Booster, Dataset, LightGBMError, _choose_param_value, _ConfigAliases, _LGBM_BoosterBestScoreType, _LGBM_CategoricalFeatureConfiguration, _LGBM_EvalFunctionResultType, _LGBM_FeatureNameConfiguration, _LGBM_GroupType, _LGBM_InitScoreType, _LGBM_LabelType, _LGB...
class LGBMRegressor(_LGBMRegressorBase, LGBMModel): '''LightGBM regressor.''' def __init__(self, *, boosting_type: str='gbdt', num_leaves: int=31, max_depth: int=-1, learning_rate: float=0.1, n_estimators: int=100, subsample_for_bin: int=200000, objective: Optional[Union[str, _LGBM_ScikitCustomObjectiveFuncti...
5
2
15
0
14
1
1
0.16
2
4
0
1
3
0
3
28
57
4
49
21
30
8
16
6
12
2
2
1
4
18,056
Microsoft/LightGBM
python-package/lightgbm/sklearn.py
lightgbm.sklearn._EvalFunctionWrapper
import numpy as np from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Union from inspect import signature from .basic import _MULTICLASS_OBJECTIVES, Booster, Dataset, LightGBMError, _choose_param_value, _ConfigAliases, _LGBM_BoosterBestScoreType, _LGBM_CategoricalFeatureConfiguration, _LGBM_E...
class _EvalFunctionWrapper: '''Proxy class for evaluation function.''' def __init__(self, func: _LGBM_ScikitCustomEvalFunction): '''Construct a proxy class. This class transforms evaluation function to match evaluation function with signature ``new_func(preds, dataset)`` as expected by...
3
3
38
4
9
26
3
2.79
0
1
0
0
2
1
2
2
79
10
19
12
12
53
15
8
12
4
0
1
5
18,057
Microsoft/LightGBM
python-package/lightgbm/sklearn.py
lightgbm.sklearn._ObjectiveFunctionWrapper
from .basic import _MULTICLASS_OBJECTIVES, Booster, Dataset, LightGBMError, _choose_param_value, _ConfigAliases, _LGBM_BoosterBestScoreType, _LGBM_CategoricalFeatureConfiguration, _LGBM_EvalFunctionResultType, _LGBM_FeatureNameConfiguration, _LGBM_GroupType, _LGBM_InitScoreType, _LGBM_LabelType, _LGBM_WeightType, _log_...
class _ObjectiveFunctionWrapper: '''Proxy class for objective function.''' def __init__(self, func: _LGBM_ScikitCustomObjectiveFunction): '''Construct a proxy class. This class transforms objective function to match objective function with signature ``new_func(preds, dataset)`` as expe...
3
3
41
5
10
27
3
2.62
0
1
0
0
2
1
2
2
85
12
21
13
14
55
17
9
14
4
0
1
5
18,058
pytorch/vision
pytorch_vision/docs/source/beta_status.py
beta_status.BetaStatus
from docutils.parsers.rst import Directive from docutils import nodes class BetaStatus(Directive): has_content = True text = 'The {api_name} is in Beta stage, and backward compatibility is not guaranteed.' node = nodes.warning def run(self): text = self.text.format(api_name=' '.join(self.conte...
class BetaStatus(Directive): def run(self): pass
2
0
3
0
3
0
1
0
1
0
0
0
1
0
1
1
8
1
7
6
5
0
7
6
5
1
1
0
1
18,059
pytorch/vision
pytorch_vision/references/detection/coco_eval.py
coco_eval.CocoEvaluator
import pycocotools.mask as mask_util from contextlib import redirect_stdout import copy from pycocotools.coco import COCO from pycocotools.cocoeval import COCOeval import io import numpy as np class CocoEvaluator: def __init__(self, coco_gt, iou_types): if not isinstance(iou_types, (list, tuple)): ...
class CocoEvaluator: def __init__(self, coco_gt, iou_types): pass def update(self, predictions): pass def synchronize_between_processes(self): pass def accumulate(self): pass def summarize(self): pass def prepare(self, predictions, iou_type): ...
10
0
14
2
13
0
3
0
0
7
0
0
9
5
9
9
137
22
115
43
105
0
83
43
73
4
0
2
26
18,060
pytorch/vision
pytorch_vision/references/detection/coco_utils.py
coco_utils.CocoDetection
import torchvision import transforms as T class CocoDetection(torchvision.datasets.CocoDetection): def __init__(self, img_folder, ann_file, transforms): super().__init__(img_folder, ann_file) self._transforms = transforms def __getitem__(self, idx): img, target = super().__getitem__(i...
class CocoDetection(torchvision.datasets.CocoDetection): def __init__(self, img_folder, ann_file, transforms): pass def __getitem__(self, idx): pass
3
0
5
0
5
0
2
0
1
2
0
0
2
1
2
17
12
1
11
6
8
0
11
6
8
2
4
1
3
18,061
pytorch/vision
pytorch_vision/references/detection/coco_utils.py
coco_utils.ConvertCocoPolysToMask
import torch import torch.utils.data class ConvertCocoPolysToMask: def __call__(self, image, target): w, h = image.size image_id = target['image_id'] anno = target['annotations'] anno = [obj for obj in anno if obj['iscrowd'] == 0] boxes = [obj['bbox'] for obj in anno] ...
class ConvertCocoPolysToMask: def __call__(self, image, target): pass
2
0
52
11
39
2
5
0.05
0
0
0
0
1
0
1
1
53
11
40
14
38
2
40
14
38
5
0
2
5
18,062
pytorch/vision
pytorch_vision/references/segmentation/coco_utils.py
coco_utils.ConvertCocoPolysToMask
from PIL import Image import torch import torch.utils.data class ConvertCocoPolysToMask: def __call__(self, image, anno): w, h = image.size segmentations = [obj['segmentation'] for obj in anno] cats = [obj['category_id'] for obj in anno] if segmentations: masks = conver...
class ConvertCocoPolysToMask: def __call__(self, image, anno): pass
2
0
16
0
13
3
2
0.21
0
0
0
0
1
0
1
1
17
0
14
7
12
3
13
7
11
2
0
1
2
18,063
pytorch/vision
pytorch_vision/references/segmentation/coco_utils.py
coco_utils.FilterAndRemapCocoCategories
import copy class FilterAndRemapCocoCategories: def __init__(self, categories, remap=True): self.categories = categories self.remap = remap def __call__(self, image, anno): anno = [obj for obj in anno if obj['category_id'] in self.categories] if not self.remap: ret...
class FilterAndRemapCocoCategories: def __init__(self, categories, remap=True): pass def __call__(self, image, anno): pass
3
0
6
0
6
0
2
0
0
0
0
0
2
2
2
2
13
1
12
5
9
0
12
5
9
3
0
1
4
18,064
pytorch/vision
pytorch_vision/docs/source/conf.py
conf.CustomGalleryExampleSortKey
class CustomGalleryExampleSortKey: def __init__(self, src_dir): self.src_dir = src_dir transforms_subsection_order = ['plot_transforms_getting_started.py', 'plot_transforms_illustrations.py', 'plot_transforms_e2e.py', 'plot_cutmix_mixup.py', 'plot_rotated_box_transforms.py', 'plot_keypoints_transforms....
class CustomGalleryExampleSortKey: def __init__(self, src_dir): pass def __call__(self, filename): pass
3
0
7
0
7
1
2
0.13
0
1
0
0
2
1
2
2
28
2
23
6
20
3
11
5
8
3
0
2
4
18,065
pytorch/vision
pytorch_vision/references/video_classification/datasets.py
datasets.KineticsWithVideoId
from torch import Tensor from typing import Tuple import torchvision class KineticsWithVideoId(torchvision.datasets.Kinetics): def __getitem__(self, idx: int) -> Tuple[Tensor, Tensor, int]: video, audio, info, video_idx = self.video_clips.get_clip(idx) label = self.samples[video_idx][1] if...
class KineticsWithVideoId(torchvision.datasets.Kinetics): def __getitem__(self, idx: int) -> Tuple[Tensor, Tensor, int]: pass
2
0
8
2
6
0
2
0
1
2
0
0
1
0
1
18
9
2
7
4
5
0
7
4
5
2
4
1
2
18,066
pytorch/vision
pytorch_vision/references/detection/group_by_aspect_ratio.py
group_by_aspect_ratio.GroupedBatchSampler
from torch.utils.data.sampler import BatchSampler, Sampler from collections import defaultdict class GroupedBatchSampler(BatchSampler): """ Wraps another sampler to yield a mini-batch of indices. It enforces that the batch only contain elements from the same group. It also tries to provide mini-batches...
class GroupedBatchSampler(BatchSampler): ''' Wraps another sampler to yield a mini-batch of indices. It enforces that the batch only contain elements from the same group. It also tries to provide mini-batches which follows an ordering which is as close as possible to the ordering from the original ...
4
1
14
1
11
2
3
0.54
1
2
0
0
3
3
3
10
59
5
35
17
31
19
35
17
31
6
3
3
9
18,067
pytorch/vision
pytorch_vision/references/similarity/loss.py
loss.TripletMarginLoss
import torch.nn as nn class TripletMarginLoss(nn.Module): def __init__(self, margin=1.0, p=2.0, mining='batch_all'): super().__init__() self.margin = margin self.p = p self.mining = mining if mining == 'batch_all': self.loss_fn = batch_all_triplet_loss i...
class TripletMarginLoss(nn.Module): def __init__(self, margin=1.0, p=2.0, mining='batch_all'): pass def forward(self, embeddings, labels): pass
3
0
6
1
6
0
2
0
1
1
0
0
2
4
2
12
14
2
12
7
9
0
12
7
9
3
1
1
4
18,068
pytorch/vision
pytorch_vision/references/similarity/model.py
model.EmbeddingNet
import torch.nn as nn import torchvision.models as models class EmbeddingNet(nn.Module): def __init__(self, backbone=None): super().__init__() if backbone is None: backbone = models.resnet50(num_classes=128) self.backbone = backbone def forward(self, x): x = self.b...
class EmbeddingNet(nn.Module): def __init__(self, backbone=None): pass def forward(self, x): pass
3
0
5
1
5
0
2
0
1
1
0
0
2
1
2
12
12
2
10
4
7
0
10
4
7
2
1
1
3
18,069
pytorch/vision
pytorch_vision/gallery/transforms/plot_custom_transforms.py
plot_custom_transforms.MyCustomTransform
import torch class MyCustomTransform(torch.nn.Module): def forward(self, img, bboxes, label): print(f"I'm transforming an image of shape {img.shape} with bboxes = {bboxes}\nlabel = {label!r}") return (img, bboxes, label)
class MyCustomTransform(torch.nn.Module): def forward(self, img, bboxes, label): pass
2
0
7
0
7
2
3
0.25
1
5
1
0
1
0
1
22
8
0
8
2
6
2
7
2
5
3
2
1
3
18,070
pytorch/vision
pytorch_vision/gallery/transforms/plot_custom_transforms.py
plot_custom_transforms.MyRandomTransform
import torch from typing import Any, Dict, List class MyRandomTransform(MyCustomTransform): def __init__(self, p=0.5): self.p = p super().__init__() def make_params(self, flat_inputs: List[Any]) -> Dict[str, Any]: apply_transform = (torch.rand(size=(1,)) < self.p).item() param...
class MyRandomTransform(MyCustomTransform): def __init__(self, p=0.5): pass def make_params(self, flat_inputs: List[Any]) -> Dict[str, Any]: pass def transform(self, inpt: Any, params: Dict[str, Any]): pass
4
0
4
0
4
0
1
0
1
4
0
0
3
1
3
14
16
2
14
7
10
0
13
7
9
2
2
1
4
18,071
pytorch/vision
pytorch_vision/gallery/transforms/plot_custom_tv_tensors.py
plot_custom_tv_tensors.MyTVTensor
from torchvision import tv_tensors class MyTVTensor(tv_tensors.TVTensor): pass
class MyTVTensor(tv_tensors.TVTensor): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
68
2
0
2
1
1
0
2
1
1
0
3
0
0
18,072
pytorch/vision
pytorch_vision/gallery/others/plot_repurposing_annotations.py
plot_repurposing_annotations.SegmentationToDetectionDataset
import os from torchvision.ops import masks_to_boxes import torchvision.transforms.functional as F from torchvision.io import decode_image import torch class SegmentationToDetectionDataset(torch.utils.data.Dataset): def __init__(self, root, transforms): self.root = root self.transforms = transform...
class SegmentationToDetectionDataset(torch.utils.data.Dataset): def __init__(self, root, transforms): pass def __getitem__(self, idx): pass
3
0
20
5
12
4
2
0.29
1
2
0
0
2
4
2
6
42
11
24
16
21
7
24
16
21
2
2
1
3
18,073
pytorch/vision
pytorch_vision/gallery/others/plot_scripted_tensor_transforms.py
plot_scripted_tensor_transforms.Predictor
import torch.nn as nn from torchvision.models import resnet18, ResNet18_Weights import torch class Predictor(nn.Module): def __init__(self): super().__init__() weights = ResNet18_Weights.DEFAULT self.resnet18 = resnet18(weights=weights, progress=False).eval() self.transforms = weig...
class Predictor(nn.Module): def __init__(self): pass def forward(self, x: torch.Tensor) -> torch.Tensor: pass
3
0
5
0
5
0
1
0
1
3
1
0
2
2
2
12
13
2
11
7
8
0
11
7
8
1
1
1
2
18,074
pytorch/vision
pytorch_vision/references/classification/presets.py
presets.ClassificationPresetEval
import torch from torchvision.transforms.functional import InterpolationMode class ClassificationPresetEval: def __init__(self, *, crop_size, resize_size=256, mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225), interpolation=InterpolationMode.BILINEAR, backend='pil', use_v2=False): T = get_module(use_v...
class ClassificationPresetEval: def __init__(self, *, crop_size, resize_size=256, mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225), interpolation=InterpolationMode.BILINEAR, backend='pil', use_v2=False): pass def __call__(self, img): pass
3
0
19
3
17
0
4
0
0
3
1
0
2
1
2
2
40
6
34
16
21
0
17
6
14
6
0
1
7
18,075
pytorch/vision
pytorch_vision/references/classification/presets.py
presets.ClassificationPresetTrain
import torch from torchvision.transforms.functional import InterpolationMode class ClassificationPresetTrain: def __init__(self, *, crop_size, mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225), interpolation=InterpolationMode.BILINEAR, hflip_prob=0.5, auto_augment_policy=None, ra_magnitude=9, augmix_severity=...
class ClassificationPresetTrain: def __init__(self, *, crop_size, mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225), interpolation=InterpolationMode.BILINEAR, hflip_prob=0.5, auto_augment_policy=None, ra_magnitude=9, augmix_severity=3, random_erase_prob=0.0, backend='pil', use_v2=False): pass def...
3
0
28
3
25
0
7
0.06
0
3
1
0
2
1
2
2
61
7
51
21
34
3
28
7
25
12
0
2
13
18,076
pytorch/vision
pytorch_vision/references/detection/presets.py
presets.DetectionPresetEval
import torch import transforms as reference_transforms class DetectionPresetEval: def __init__(self, backend='pil', use_v2=False): T, _ = get_modules(use_v2) transforms = [] backend = backend.lower() if backend == 'pil': transforms += [T.ToImage() if use_v2 else T.PILTo...
class DetectionPresetEval: def __init__(self, backend='pil', use_v2=False): pass def __call__(self, img, target): pass
3
0
11
2
9
1
4
0.05
0
2
0
0
2
1
2
2
24
4
19
6
16
1
16
6
13
6
0
1
7
18,077
pytorch/vision
pytorch_vision/references/detection/presets.py
presets.DetectionPresetTrain
from collections import defaultdict import torch import transforms as reference_transforms class DetectionPresetTrain: def __init__(self, *, data_augmentation, hflip_prob=0.5, mean=(123.0, 117.0, 104.0), backend='pil', use_v2=False): T, tv_tensors = get_modules(use_v2) transforms = [] back...
class DetectionPresetTrain: def __init__(self, *, data_augmentation, hflip_prob=0.5, mean=(123.0, 117.0, 104.0), backend='pil', use_v2=False): pass def __call__(self, img, target): pass
3
0
34
4
29
1
7
0.07
0
4
1
0
2
1
2
2
71
8
59
15
48
4
25
7
22
13
0
1
14
18,078
pytorch/vision
pytorch_vision/references/optical_flow/presets.py
presets.OpticalFlowPresetEval
import transforms as T import torch class OpticalFlowPresetEval(torch.nn.Module): def __init__(self): super().__init__() self.transforms = T.Compose([T.PILToTensor(), T.ConvertImageDtype(torch.float32), T.Normalize(mean=0.5, std=0.5), T.ValidateModelInput()]) def forward(self, img1, img2, flo...
class OpticalFlowPresetEval(torch.nn.Module): def __init__(self): pass def forward(self, img1, img2, flow, valid): pass
3
0
7
1
6
1
1
0.08
1
6
5
0
2
1
2
12
15
2
13
4
10
1
6
4
3
1
1
0
2
18,079
pytorch/vision
pytorch_vision/references/optical_flow/presets.py
presets.OpticalFlowPresetTrain
import transforms as T import torch class OpticalFlowPresetTrain(torch.nn.Module): def __init__(self, *, crop_size, min_scale=-0.2, max_scale=0.5, stretch_prob=0.8, brightness=0.4, contrast=0.4, saturation=0.4, hue=0.5 / 3.14, asymmetric_jitter_prob=0.2, do_flip=True): super().__init__() transform...
class OpticalFlowPresetTrain(torch.nn.Module): def __init__(self, *, crop_size, min_scale=-0.2, max_scale=0.5, stretch_prob=0.8, brightness=0.4, contrast=0.4, saturation=0.4, hue=0.5 / 3.14, asymmetric_jitter_prob=0.2, do_flip=True): pass def forward(self, img1, img2, flow, valid): pass
3
0
21
2
18
2
2
0.11
1
12
11
0
2
1
2
12
44
4
37
18
21
4
10
5
7
2
1
1
3
18,080
pytorch/vision
pytorch_vision/references/segmentation/presets.py
presets.SegmentationPresetEval
import torch class SegmentationPresetEval: def __init__(self, *, base_size, mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225), backend='pil', use_v2=False): T, _, _ = get_modules(use_v2) transforms = [] backend = backend.lower() if backend == 'tensor': transforms +=...
class SegmentationPresetEval: def __init__(self, *, base_size, mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225), backend='pil', use_v2=False): pass def __call__(self, img, target): pass
3
0
17
3
14
1
5
0.04
0
2
0
0
2
1
2
2
35
6
28
8
23
1
20
6
17
8
0
1
9
18,081
pytorch/vision
pytorch_vision/references/segmentation/presets.py
presets.SegmentationPresetTrain
import torch class SegmentationPresetTrain: def __init__(self, *, base_size, crop_size, hflip_prob=0.5, mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225), backend='pil', use_v2=False): T, tv_tensors, v2_extras = get_modules(use_v2) transforms = [] backend = backend.lower() if b...
class SegmentationPresetTrain: def __init__(self, *, base_size, crop_size, hflip_prob=0.5, mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225), backend='pil', use_v2=False): pass def __call__(self, img, target): pass
3
0
27
5
21
2
6
0.07
0
4
0
0
2
1
2
2
55
10
42
17
29
3
27
7
24
10
0
1
11
18,082
pytorch/vision
pytorch_vision/references/video_classification/presets.py
presets.VideoClassificationPresetEval
import torch from transforms import ConvertBCHWtoCBHW from torchvision.transforms import transforms class VideoClassificationPresetEval: def __init__(self, *, crop_size, resize_size, mean=(0.43216, 0.394666, 0.37645), std=(0.22803, 0.22145, 0.216989)): self.transforms = transforms.Compose([transforms.Conv...
class VideoClassificationPresetEval: def __init__(self, *, crop_size, resize_size, mean=(0.43216, 0.394666, 0.37645), std=(0.22803, 0.22145, 0.216989)): pass def __call__(self, x): pass
3
0
8
0
6
2
1
0.31
0
1
1
0
2
1
2
2
18
1
13
4
10
4
5
4
2
1
0
0
2
18,083
pytorch/vision
pytorch_vision/references/video_classification/presets.py
presets.VideoClassificationPresetTrain
from torchvision.transforms import transforms import torch from transforms import ConvertBCHWtoCBHW class VideoClassificationPresetTrain: def __init__(self, *, crop_size, resize_size, mean=(0.43216, 0.394666, 0.37645), std=(0.22803, 0.22145, 0.216989), hflip_prob=0.5): trans = [transforms.ConvertImageDtyp...
class VideoClassificationPresetTrain: def __init__(self, *, crop_size, resize_size, mean=(0.43216, 0.394666, 0.37645), std=(0.22803, 0.22145, 0.216989), hflip_prob=0.5): pass def __call__(self, x): pass
3
0
12
0
10
2
2
0.2
0
6
6
0
2
1
2
2
25
1
20
13
9
4
9
5
6
2
0
1
3
18,084
pytorch/vision
pytorch_vision/scripts/release_notes/retrieve_prs_data.py
retrieve_prs_data.CommitDataCache
import os import json class CommitDataCache: def __init__(self, path='results/data.json'): self.path = path self.data = {} if os.path.exists(path): self.data = self.read_from_disk() def get(self, commit): if commit not in self.data.keys(): self.data[com...
class CommitDataCache: def __init__(self, path='results/data.json'): pass def get(self, commit): pass def read_from_disk(self): pass def write_to_disk(self): pass
5
0
5
0
5
0
2
0.05
0
0
0
0
4
2
4
4
24
3
20
11
15
1
20
9
15
2
0
1
6
18,085
pytorch/vision
pytorch_vision/references/similarity/sampler.py
sampler.PKSampler
from torch.utils.data.sampler import Sampler import random import torch class PKSampler(Sampler): """ Randomly samples from a dataset while ensuring that each batch (of size p * k) includes samples from exactly p labels, with k samples for each label. Args: groups (list[int]): List where the ...
class PKSampler(Sampler): ''' Randomly samples from a dataset while ensuring that each batch (of size p * k) includes samples from exactly p labels, with k samples for each label. Args: groups (list[int]): List where the ith entry is the group_id/label of the ith sample in the dataset. ...
3
1
17
2
12
3
5
0.56
1
3
0
0
2
3
2
6
46
7
25
15
22
14
25
15
22
7
2
3
9
18,086
pytorch/vision
pytorch_vision/references/classification/sampler.py
sampler.RASampler
import math import torch.distributed as dist import torch class RASampler(torch.utils.data.Sampler): """Sampler that restricts data loading to a subset of the dataset for distributed, with repeated augmentation. It ensures that different each augmented version of a sample will be visible to a different...
class RASampler(torch.utils.data.Sampler): '''Sampler that restricts data loading to a subset of the dataset for distributed, with repeated augmentation. It ensures that different each augmented version of a sample will be visible to a different process (GPU). Heavily based on 'torch.utils.data.Dis...
5
1
11
1
9
1
2
0.3
1
5
0
0
4
10
4
8
56
8
37
18
32
11
36
17
31
5
2
2
9
18,087
pytorch/vision
pytorch_vision/setup.py
setup.clean
import distutils.command.clean import shutil import distutils.spawn import os import glob class clean(distutils.command.clean.clean): def run(self): with open('.gitignore') as f: ignores = f.read() for wildcard in filter(None, ignores.split('\n')): for filename in g...
class clean(distutils.command.clean.clean): def run(self): pass
2
0
12
1
10
1
4
0.09
1
2
0
0
1
0
1
34
13
1
11
6
9
1
11
5
9
4
2
4
4
18,088
pytorch/vision
pytorch_vision/references/depth/stereo/presets.py
stereo.presets.StereoMatchingEvalPreset
import transforms as T from typing import Optional, Tuple, Union import torch class StereoMatchingEvalPreset(torch.nn.Module): def __init__(self, mean: float=0.5, std: float=0.5, resize_size: Optional[Tuple[int, ...]]=None, max_disparity: Optional[float]=None, interpolation_type: str='bilinear', use_grayscale: bo...
class StereoMatchingEvalPreset(torch.nn.Module): def __init__(self, mean: float=0.5, std: float=0.5, resize_size: Optional[Tuple[int, ...]]=None, max_disparity: Optional[float]=None, interpolation_type: str='bilinear', use_grayscale: bool=False) -> None: pass def forward(self, images, disparities, ma...
3
0
17
3
14
0
2
0
1
13
8
0
2
1
2
12
35
6
29
13
18
0
12
5
9
3
1
1
4
18,089
pytorch/vision
pytorch_vision/references/depth/stereo/presets.py
stereo.presets.StereoMatchingTrainPreset
import torch from typing import Optional, Tuple, Union import transforms as T class StereoMatchingTrainPreset(torch.nn.Module): def __init__(self, *, resize_size: Optional[Tuple[int, ...]], resize_interpolation_type: str='bilinear', crop_size: Tuple[int, int], rescale_prob: float=1.0, scaling_type: str='exponenti...
class StereoMatchingTrainPreset(torch.nn.Module): def __init__(self, *, resize_size: Optional[Tuple[int, ...]], resize_interpolation_type: str='bilinear', crop_size: Tuple[int, int], rescale_prob: float=1.0, scaling_type: str='exponential', scale_range: Tuple[float, float]=(-0.2, 0.5), scale_interpolation_type: ...
3
0
50
5
38
7
3
0.18
1
22
16
0
2
1
2
12
101
10
77
37
43
14
18
6
15
5
1
1
6
18,090
pytorch/vision
pytorch_vision/references/depth/stereo/transforms.py
stereo.transforms.AsymetricGammaAdjust
import torchvision.transforms.functional as F import torch from typing import Callable, List, Optional, Sequence, Tuple, Union class AsymetricGammaAdjust(torch.nn.Module): def __init__(self, p: float, gamma_range: Tuple[float, float], gain: float=1) -> None: super().__init__() self.gamma_range = g...
class AsymetricGammaAdjust(torch.nn.Module): def __init__(self, p: float, gamma_range: Tuple[float, float], gain: float=1) -> None: pass def forward(self, images: T_STEREO_TENSOR, disparities: Tuple[T_FLOW, T_FLOW], masks: Tuple[T_MASK, T_MASK]) -> Tuple[T_STEREO_TENSOR, Tuple[T_FLOW, T_FLOW], Tuple[...
3
0
13
2
10
1
2
0.1
1
2
0
0
2
3
2
12
27
4
21
15
13
2
15
10
12
2
1
1
3
18,091
pytorch/vision
pytorch_vision/references/depth/stereo/transforms.py
stereo.transforms.AsymmetricColorJitter
from typing import Callable, List, Optional, Sequence, Tuple, Union import torchvision.transforms as T import torch class AsymmetricColorJitter(T.ColorJitter): def __init__(self, brightness: T_COLOR_AUG_PARAM=0, contrast: T_COLOR_AUG_PARAM=0, saturation: T_COLOR_AUG_PARAM=0, hue: T_COLOR_AUG_PARAM=0, p: float=0.2...
class AsymmetricColorJitter(T.ColorJitter): def __init__(self, brightness: T_COLOR_AUG_PARAM=0, contrast: T_COLOR_AUG_PARAM=0, saturation: T_COLOR_AUG_PARAM=0, hue: T_COLOR_AUG_PARAM=0, p: float=0.2): pass def forward(self, images: T_STEREO_TENSOR, disparities: Tuple[T_FLOW, T_FLOW], masks: Tuple[T_M...
3
0
14
1
12
1
2
0.12
1
2
0
0
2
1
2
17
31
3
25
19
10
3
12
7
9
2
2
1
3
18,092
pytorch/vision
pytorch_vision/references/depth/stereo/transforms.py
stereo.transforms.Compose
import torch from typing import Callable, List, Optional, Sequence, Tuple, Union class Compose(torch.nn.Module): def __init__(self, transforms: List[Callable]): super().__init__() self.transforms = transforms @torch.inference_mode() def forward(self, images, disparities, masks): f...
class Compose(torch.nn.Module): def __init__(self, transforms: List[Callable]): pass @torch.inference_mode() def forward(self, images, disparities, masks): pass
4
0
4
0
4
0
2
0
1
1
0
0
2
1
2
12
10
1
9
6
5
0
8
5
5
2
1
1
3
18,093
pytorch/vision
pytorch_vision/references/depth/stereo/transforms.py
stereo.transforms.ConvertImageDtype
import torchvision.transforms.functional as F import torch from typing import Callable, List, Optional, Sequence, Tuple, Union class ConvertImageDtype(torch.nn.Module): def __init__(self, dtype: torch.dtype): super().__init__() self.dtype = dtype def forward(self, images: T_STEREO_TENSOR, dis...
class ConvertImageDtype(torch.nn.Module): def __init__(self, dtype: torch.dtype): pass def forward(self, images: T_STEREO_TENSOR, disparities: Tuple[T_FLOW, T_FLOW], masks: Tuple[T_MASK, T_MASK]) -> Tuple[T_STEREO_TENSOR, Tuple[T_FLOW, T_FLOW], Tuple[T_MASK, T_MASK]]: pass
3
0
8
1
7
0
1
0
1
1
0
0
2
1
2
12
18
3
15
11
7
0
10
6
7
1
1
0
2
18,094
pytorch/vision
pytorch_vision/references/depth/stereo/transforms.py
stereo.transforms.ConvertToGrayscale
import PIL.Image from typing import Callable, List, Optional, Sequence, Tuple, Union import torchvision.transforms.functional as F import torch class ConvertToGrayscale(torch.nn.Module): def __init__(self) -> None: super().__init__() def forward(self, images: Tuple[PIL.Image.Image, PIL.Image.Image], ...
class ConvertToGrayscale(torch.nn.Module): def __init__(self) -> None: pass def forward(self, images: Tuple[PIL.Image.Image, PIL.Image.Image], disparities: Tuple[T_FLOW, T_FLOW], masks: Tuple[T_MASK, T_MASK]) -> Tuple[T_STEREO_TENSOR, Tuple[T_FLOW, T_FLOW], Tuple[T_MASK, T_MASK]]: pass
3
0
6
1
6
0
1
0
1
1
0
0
2
0
2
12
14
2
12
10
4
0
7
5
4
1
1
0
2
18,095
pytorch/vision
pytorch_vision/references/depth/stereo/transforms.py
stereo.transforms.InterpolationStrategy
import random import torchvision.transforms.functional as F from typing import Callable, List, Optional, Sequence, Tuple, Union class InterpolationStrategy: _valid_modes: List[str] = ['mixed', 'bicubic', 'bilinear'] def __init__(self, mode: str='mixed') -> None: if mode not in self._valid_modes: ...
class InterpolationStrategy: def __init__(self, mode: str='mixed') -> None: pass def __call__(self) -> F.InterpolationMode: pass @classmethod def is_valid(mode: str) -> bool: pass @property def valid_modes() -> List[str]: pass
7
0
4
0
4
0
2
0
0
4
1
0
3
1
4
4
25
6
19
9
12
0
15
7
10
5
0
1
8
18,096
pytorch/vision
pytorch_vision/references/depth/stereo/transforms.py
stereo.transforms.MakeValidDisparityMask
from typing import Callable, List, Optional, Sequence, Tuple, Union import torch class MakeValidDisparityMask(torch.nn.Module): def __init__(self, max_disparity: Optional[int]=256) -> None: super().__init__() self.max_disparity = max_disparity def forward(self, images: T_STEREO_TENSOR, dispar...
class MakeValidDisparityMask(torch.nn.Module): def __init__(self, max_disparity: Optional[int]=256) -> None: pass def forward(self, images: T_STEREO_TENSOR, disparities: Tuple[T_FLOW, T_FLOW], masks: Tuple[T_MASK, T_MASK]) -> Tuple[T_STEREO_TENSOR, Tuple[T_FLOW, T_FLOW], Tuple[T_MASK, T_MASK]]: ...
3
0
13
2
12
0
3
0
1
6
0
0
2
1
2
12
28
4
24
10
16
0
10
5
7
5
1
1
6
18,097
pytorch/vision
pytorch_vision/references/depth/stereo/transforms.py
stereo.transforms.Normalize
import torch import torchvision.transforms.functional as F from typing import Callable, List, Optional, Sequence, Tuple, Union class Normalize(torch.nn.Module): def __init__(self, mean: List[float], std: List[float]) -> None: super().__init__() self.mean = mean self.std = std def forw...
class Normalize(torch.nn.Module): def __init__(self, mean: List[float], std: List[float]) -> None: pass def forward(self, images: T_STEREO_TENSOR, disparities: Tuple[T_FLOW, T_FLOW], masks: Tuple[T_MASK, T_MASK]) -> Tuple[T_STEREO_TENSOR, Tuple[T_FLOW, T_FLOW], Tuple[T_MASK, T_MASK]]: pass
3
0
9
2
8
0
1
0
1
2
0
0
2
2
2
12
20
4
16
12
8
0
11
7
8
1
1
0
2
18,098
pytorch/vision
pytorch_vision/references/depth/stereo/transforms.py
stereo.transforms.RandomErase
import torch from typing import Callable, List, Optional, Sequence, Tuple, Union import torchvision.transforms.functional as F import random from torch import Tensor class RandomErase(torch.nn.Module): def __init__(self, p: float=0.5, erase_px_range: Tuple[int, int]=(50, 100), value: Union[Tensor, float]=0, inpla...
class RandomErase(torch.nn.Module): def __init__(self, p: float=0.5, erase_px_range: Tuple[int, int]=(50, 100), value: pass def forward(self, images: T_STEREO_TENSOR, disparities: T_STEREO_TENSOR, masks: T_STEREO_TENSOR) -> Tuple[T_STEREO_TENSOR, Tuple[T_FLOW, T_FLOW], Tuple[T_MASK, T_MASK]]: ...
4
0
19
2
16
1
3
0.12
1
7
0
0
3
6
3
13
62
7
49
29
33
6
34
17
30
5
1
2
10
18,099
pytorch/vision
pytorch_vision/references/depth/stereo/transforms.py
stereo.transforms.RandomHorizontalFlip
import torchvision.transforms.functional as F from typing import Callable, List, Optional, Sequence, Tuple, Union import torch class RandomHorizontalFlip(torch.nn.Module): def __init__(self, p: float=0.5) -> None: super().__init__() self.p = p def forward(self, images: T_STEREO_TENSOR, dispar...
class RandomHorizontalFlip(torch.nn.Module): def __init__(self, p: float=0.5) -> None: pass def forward(self, images: T_STEREO_TENSOR, disparities: Tuple[T_FLOW, T_FLOW], masks: Tuple[T_MASK, T_MASK]) -> Tuple[T_STEREO_TENSOR, Tuple[T_FLOW, T_FLOW], Tuple[T_MASK, T_MASK]]: pass
3
0
11
2
10
0
2
0
1
2
0
0
2
1
2
12
24
4
20
12
12
0
15
7
12
3
1
2
4