uid
stringlengths
24
24
split
stringclasses
1 value
category
stringclasses
2 values
content
stringlengths
5
482k
signature
stringlengths
1
14k
suffix
stringlengths
1
482k
prefix
stringlengths
9
14k
prefix_token_count
int64
3
5.01k
prefix_token_budget
int64
64
256
element_token_count
int64
1
292k
signature_token_count
int64
1
5.01k
prefix_context_token_count
int64
0
255
repo
stringlengths
7
112
path
stringlengths
4
208
language
stringclasses
1 value
name
stringlengths
1
218
qualname
stringlengths
1
218
start_line
int64
1
26.7k
end_line
int64
1
26.7k
signature_start_line
int64
1
26.7k
signature_end_line
int64
1
26.7k
source_hash
stringlengths
40
40
source_dataset
stringclasses
1 value
source_split
stringclasses
1 value
962a533e0ae8cafcfb23359f
train
function
def KeyDown(k): """Occurs when a key is pressed.""" try: offset = KeyCodeDict[k.upper()] except (KeyError): raise EPError("%s doesn't exist in VirtualKeyCode." % (k)) else: KeyOffset.add(offset) m = 256 ** (offset % 4) n = 2 ** (offset % 32) return [ # Ke...
def KeyDown(k):
"""Occurs when a key is pressed.""" try: offset = KeyCodeDict[k.upper()] except (KeyError): raise EPError("%s doesn't exist in VirtualKeyCode." % (k)) else: KeyOffset.add(offset) m = 256 ** (offset % 4) n = 2 ** (offset % 32) return [ # KeyDown ...
(0x596A18 + offset, Exactly, 0, m), MemoryX(KeyArray + offset // 8, Exactly, n, n), ], actions=SetMemoryX(KeyArray + offset // 8, SetTo, 0, n), ) def KeyDown(k):
64
64
128
5
59
Chromowolf/euddraft
lib/sqc.py
Python
KeyDown
KeyDown
124
137
124
124
64cb8554e6b664ae558be7bb885ce2c5611021c8
bigcode/the-stack
train
126bbd2c9b3007a9e4ce265e
train
function
def _ID(x): """Identity function.""" return x
def _ID(x):
"""Identity function.""" return x
- 1).bit_length() + 5 MapXY = [2 ** i for i in range(Map_X)] + [2 ** j for j in range(Map_Y)] human = [p for p in range(12) if ownr[p] == 6] def _ID(x):
64
64
14
5
59
Chromowolf/euddraft
lib/sqc.py
Python
_ID
_ID
244
246
244
244
0d3dd3b760f65d1393194261ace02f86ebada789
bigcode/the-stack
train
2ed4310700585711f7ac9d2b
train
function
@EUDFunc def _QueueGameCommand_NSelect(n, ptrListepd): buf = Db(b"...\x091234567890123456789012345.......") DoActions([SetMemory(0x6509B0, SetTo, EPD(buf) + 1)]) cw.writebyte(n) for _ in EUDLoopRange(n): unitepd = f_epdcunitread_epd(ptrListepd) unitIndex = _epd2alphaid(unitepd) u...
@EUDFunc def _QueueGameCommand_NSelect(n, ptrListepd):
buf = Db(b"...\x091234567890123456789012345.......") DoActions([SetMemory(0x6509B0, SetTo, EPD(buf) + 1)]) cw.writebyte(n) for _ in EUDLoopRange(n): unitepd = f_epdcunitread_epd(ptrListepd) unitIndex = _epd2alphaid(unitepd) uniquenessIdentifier = f_bread_epd(unitepd + 0xA5 // 4, ...
buf = Db(b"..\x09\x0112..") DoActions([SelectIndex << SetMemory(buf + 4, SetTo, 0xEDAC)]) QueueGameCommand(buf + 2, 4) @EUDFunc def _QueueGameCommand_NSelect(n, ptrListepd):
67
67
224
18
49
Chromowolf/euddraft
lib/sqc.py
Python
_QueueGameCommand_NSelect
_QueueGameCommand_NSelect
566
581
566
567
3ab644d11a739e97d5ae73c44d2cc30193637379
bigcode/the-stack
train
56f96238296fc8f55c89d131
train
function
def _UpdateMouseInfo(): ismousemoved << 0 sX, sY, mX, mY = [Forward() for _ in range(4)] if EUDIfNot()( [ sX << Memory(0x62848C, Exactly, 0), sY << Memory(0x6284A8, Exactly, 0), mX << Memory(0x6CDDC4, Exactly, 0), mY << Memory(0x6CDDC8, Exactly, 0), ...
def _UpdateMouseInfo():
ismousemoved << 0 sX, sY, mX, mY = [Forward() for _ in range(4)] if EUDIfNot()( [ sX << Memory(0x62848C, Exactly, 0), sY << Memory(0x6284A8, Exactly, 0), mX << Memory(0x6CDDC4, Exactly, 0), mY << Memory(0x6CDDC8, Exactly, 0), ] ): _...
) - 1, (0, _ID)) f_screenXread_epd = f_readgen_epd(0x3FF, (0, _ID)) f_screenYread_epd = f_readgen_epd(0x1FF, (0, _ID)) f_epdcunitread_epd = f_readgen_epd(0x7FFFF8, (EPD(0), lambda x: x // 4)) def _UpdateMouseInfo():
99
99
332
6
93
Chromowolf/euddraft
lib/sqc.py
Python
_UpdateMouseInfo
_UpdateMouseInfo
264
291
264
264
38669d409bf8b79bf8d6e3033a36cab06cc99cab
bigcode/the-stack
train
f92040f777357a4e0edef1a6
train
function
def MouseUp(k): """Occurs when a mouse button is released.""" try: v = MouseButtonDict[k.upper()] except (KeyError): raise EPError("%s is NOT a MouseButton. Use 'L', 'R' or 'M'." % (k)) else: MouseOffset.add(v) return [ # MouseUp MemoryX(0x6CDDC0, Exactly, 0,...
def MouseUp(k):
"""Occurs when a mouse button is released.""" try: v = MouseButtonDict[k.upper()] except (KeyError): raise EPError("%s is NOT a MouseButton. Use 'L', 'R' or 'M'." % (k)) else: MouseOffset.add(v) return [ # MouseUp MemoryX(0x6CDDC0, Exactly, 0, v), ...
or 'M'." % (k)) else: MouseOffset.add(v) return [ # MouseDown MemoryX(0x6CDDC0, Exactly, v, v), MemoryX(MouseArray, Exactly, 0, v), ] def MouseUp(k):
63
64
110
5
58
Chromowolf/euddraft
lib/sqc.py
Python
MouseUp
MouseUp
208
219
208
208
b1b4b3240198cb245f7e45fa03663168bd6a3ee2
bigcode/the-stack
train
26a99a657867396fe9d971a9
train
function
def _KeyUpdate(offset): m = 256 ** (offset % 4) n = 2 ** (offset % 32) RawTrigger( conditions=[ # KeyDown MemoryX(0x596A18 + offset, Exactly, m, m), MemoryX(KeyArray + offset // 8, Exactly, 0, n), ], actions=SetMemoryX(KeyArray + offset // 8, SetTo, n, n), ...
def _KeyUpdate(offset):
m = 256 ** (offset % 4) n = 2 ** (offset % 32) RawTrigger( conditions=[ # KeyDown MemoryX(0x596A18 + offset, Exactly, m, m), MemoryX(KeyArray + offset // 8, Exactly, 0, n), ], actions=SetMemoryX(KeyArray + offset // 8, SetTo, n, n), ) RawTrigger( ...
, 'NONAME': 0xFC, 'PA1': 0xFD, 'OEM_CLEAR': 0xFE, '_NONE_': 0xFF } # fmt: on KeyArray = EUDArray(8) KeyOffset = set() def _KeyUpdate(offset):
64
64
177
6
58
Chromowolf/euddraft
lib/sqc.py
Python
_KeyUpdate
_KeyUpdate
105
121
105
105
c117aef67fbadf76d520e8bab1d208c8c0b6f2f1
bigcode/the-stack
train
6469ad12dcca26ea80f82f49
train
function
def MouseDown(k): """Occurs when a mouse button is pressed.""" try: v = MouseButtonDict[k.upper()] except (KeyError): raise EPError("%s is NOT a MouseButton. Use 'L', 'R' or 'M'." % (k)) else: MouseOffset.add(v) return [ # MouseDown MemoryX(0x6CDDC0, Exactly,...
def MouseDown(k):
"""Occurs when a mouse button is pressed.""" try: v = MouseButtonDict[k.upper()] except (KeyError): raise EPError("%s is NOT a MouseButton. Use 'L', 'R' or 'M'." % (k)) else: MouseOffset.add(v) return [ # MouseDown MemoryX(0x6CDDC0, Exactly, v, v), ...
conditions=[ # MouseUp MemoryX(0x6CDDC0, Exactly, 0, k), MemoryX(MouseArray, Exactly, k, k), ], actions=SetMemoryX(MouseArray, SetTo, 0, k), ) def MouseDown(k):
64
64
110
5
59
Chromowolf/euddraft
lib/sqc.py
Python
MouseDown
MouseDown
194
205
194
194
971ad5eb5d36171528b6270ef82fa45e13020af3
bigcode/the-stack
train
3c8820276ec328d553331cee
train
function
def AddBefore(action_or_function): """Register initialization action or function. Run at the start of Main function.""" if callable(action_or_function): InitList.append(action_or_function) else: InitList[0].append(action_or_function)
def AddBefore(action_or_function):
"""Register initialization action or function. Run at the start of Main function.""" if callable(action_or_function): InitList.append(action_or_function) else: InitList[0].append(action_or_function)
QCList.append((EUDIf, condition, action_or_function)) def AddNot(condition, action_or_function): """Register local (desync) event, execute sync action or function when False.""" QCList.append((EUDIfNot, condition, action_or_function)) def AddBefore(action_or_function):
64
64
52
7
57
Chromowolf/euddraft
lib/sqc.py
Python
AddBefore
AddBefore
365
370
365
365
33f28b5944a1dbd12003fe246754ef14037230b0
bigcode/the-stack
train
4fc752bf85d2562f60c43ec2
train
class
@init_model_state_from_kwargs class UpdateComputeInstanceGroupCanaryDeployStageDetails(UpdateDeployStageDetails): """ Specifies the Instance Group Canary deployment stage. """ def __init__(self, **kwargs): """ Initializes a new UpdateComputeInstanceGroupCanaryDeployStageDetails object w...
@init_model_state_from_kwargs class UpdateComputeInstanceGroupCanaryDeployStageDetails(UpdateDeployStageDetails):
""" Specifies the Instance Group Canary deployment stage. """ def __init__(self, **kwargs): """ Initializes a new UpdateComputeInstanceGroupCanaryDeployStageDetails object with values from keyword arguments. The default value of the :py:attr:`~oci.devops.models.UpdateComputeInstanceGrou...
# coding: utf-8 # Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c...
168
256
1,761
22
145
pabs3/oci-python-sdk
src/oci/devops/models/update_compute_instance_group_canary_deploy_stage_details.py
Python
UpdateComputeInstanceGroupCanaryDeployStageDetails
UpdateComputeInstanceGroupCanaryDeployStageDetails
10
199
10
11
237b1c7545f86f0e1decb298122f26b228f8933f
bigcode/the-stack
train
d2b4a4f299231a4ddccf9822
train
function
def arrayMode(sequence): from collections import Counter store = [a for a, _ in Counter(sequence).most_common(1)] return store[0]
def arrayMode(sequence):
from collections import Counter store = [a for a, _ in Counter(sequence).most_common(1)] return store[0]
def arrayMode(sequence):
5
64
35
5
0
gurfinkel/codeSignal
tournaments/arrayMode/arrayMode.py
Python
arrayMode
arrayMode
1
5
1
1
516a6cea2e5894494abc8ac39c65cfce14cc21ff
bigcode/the-stack
train
33674669dc3276ad41a6fce2
train
class
class TestCreatorAudit(TestCase): """Set up necessary objects and test Creator role with Audit roles""" def setUp(self): super(TestCreatorAudit, self).setUp() self.generator = Generator() self.api = Api() self.object_generator = ObjectGenerator() self.init_users() self.init_test_cases() ...
class TestCreatorAudit(TestCase):
"""Set up necessary objects and test Creator role with Audit roles""" def setUp(self): super(TestCreatorAudit, self).setUp() self.generator = Generator() self.api = Api() self.object_generator = ObjectGenerator() self.init_users() self.init_test_cases() self.objects = {} def init_tes...
# Copyright (C) 2020 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """ Test Creator role with Audit scoped roles """ from ggrc import db from ggrc.models import all_models from integration.ggrc import TestCase from integration.ggrc.api_helper import Api from integration.gg...
110
256
1,585
7
102
MikalaiMikalalai/ggrc-core
test/integration/ggrc_basic_permissions/test_creator_audit.py
Python
TestCreatorAudit
TestCreatorAudit
17
241
17
17
b07a628e61c80585eb049b9d2a38497a9bfff615
bigcode/the-stack
train
fd2ba960f8c2345b1127d634
train
class
class TestBillPresentmentResponseData(unittest.TestCase): """BillPresentmentResponseData unit test stubs""" def setUp(self): pass def tearDown(self): pass def testBillPresentmentResponseData(self): """Test BillPresentmentResponseData""" # FIXME: construct object with m...
class TestBillPresentmentResponseData(unittest.TestCase):
"""BillPresentmentResponseData unit test stubs""" def setUp(self): pass def tearDown(self): pass def testBillPresentmentResponseData(self): """Test BillPresentmentResponseData""" # FIXME: construct object with mandatory attributes with example values # model = ...
-codegen.git """ from __future__ import absolute_import import unittest import iimmpact from iimmpact.models.bill_presentment_response_data import BillPresentmentResponseData # noqa: E501 from iimmpact.rest import ApiException class TestBillPresentmentResponseData(unittest.TestCase):
64
64
103
11
52
iimmpact/iimmpact_python_api
test/test_bill_presentment_response_data.py
Python
TestBillPresentmentResponseData
TestBillPresentmentResponseData
23
36
23
23
df3fe3ea9caf2de7f626a40a4f9beff9f3d82760
bigcode/the-stack
train
8cda0b7f785fbb7ade939bfd
train
class
class A_ASSOCIATE_RQ(PDU): """An A-ASSOCIATE-RQ PDU. An A-ASSOCIATE-RQ PDU is sent by an association requestor to initiate association negotiation with an acceptor. Attributes ---------- pdu_type : int The *PDU Type* field value (``0x01``). protocol_version : int The *Proto...
class A_ASSOCIATE_RQ(PDU):
"""An A-ASSOCIATE-RQ PDU. An A-ASSOCIATE-RQ PDU is sent by an association requestor to initiate association negotiation with an acceptor. Attributes ---------- pdu_type : int The *PDU Type* field value (``0x01``). protocol_version : int The *Protocol Version* field value (`...
return item_list @staticmethod def _wrap_pack(value: Any, packer: Callable[[Any], bytes]) -> bytes: """Return `value` encoded as bytes using `packer`. Parameters ---------- value The value to encode. packer : callable A callable function ...
256
256
3,147
9
247
chsasank/pynetdicom
pynetdicom/pdu.py
Python
A_ASSOCIATE_RQ
A_ASSOCIATE_RQ
339
701
339
339
fad2c3d38e893f603e132041b396f71655a80465
bigcode/the-stack
train
946c9baed16e9beed0ae164a
train
class
class A_ASSOCIATE_RJ(PDU): """An A-ASSOCIATE-RJ PDU. An A-ASSOCIATE-RJ PDU is sent by an association acceptor to indicate that association negotiation has been unsuccessful. Attributes ---------- pdu_type : int The *PDU Type* field value (``0x03``). reason_diagnostic : int ...
class A_ASSOCIATE_RJ(PDU):
"""An A-ASSOCIATE-RJ PDU. An A-ASSOCIATE-RJ PDU is sent by an association acceptor to indicate that association negotiation has been unsuccessful. Attributes ---------- pdu_type : int The *PDU Type* field value (``0x03``). reason_diagnostic : int The *Reason/Diagnostic* fie...
name: ={self.application_context_name}') s.append(' * Presentation Context Item(s):') for cx in self.presentation_context: item_str_list = str(cx).split('\n') s.append(f' - {item_str_list[0]}') for jj in item_str_list[1:-1]: s.append(f' {j...
256
256
1,870
9
246
chsasank/pynetdicom
pynetdicom/pdu.py
Python
A_ASSOCIATE_RJ
A_ASSOCIATE_RJ
1,052
1,280
1,052
1,052
dbc6974e30f944ef00524e02ff7ef340311e8279
bigcode/the-stack
train
19021d4aa5be6786ac49c7e6
train
class
class A_RELEASE_RQ(PDU): """An A-RELEASE-RQ PDU. An A-RELEASE-RQ PDU is used once an association has been established to initiate the release of the association. Attributes ---------- pdu_type : int The *PDU Type* field value (``0x05``). Notes ----- An A-RELEASE-RQ PDU req...
class A_RELEASE_RQ(PDU):
"""An A-RELEASE-RQ PDU. An A-RELEASE-RQ PDU is used once an association has been established to initiate the release of the association. Attributes ---------- pdu_type : int The *PDU Type* field value (``0x05``). Notes ----- An A-RELEASE-RQ PDU requires the following param...
):\n' s += ' --------------------------------\n' for ii in self.presentation_data_value_items: item_str = f'{ii}' item_str_list = item_str.split('\n') s += f' * {item_str_list[0]}\n' for jj in item_str_list[1:]: s += f' {jj}\n' ...
256
256
969
8
247
chsasank/pynetdicom
pynetdicom/pdu.py
Python
A_RELEASE_RQ
A_RELEASE_RQ
1,518
1,640
1,518
1,518
36e2947ca9f7ac9b06ed6becfb960b43654d2e4a
bigcode/the-stack
train
bc7f7fd1665fb606c475532a
train
class
class A_RELEASE_RP(PDU): """An A-RELEASE-RP PDU. An A-RELEASE-RP PDU is used once an association has been established to confirm the release of the association. Attributes ---------- pdu_type : int The *PDU Type* field value (``0x06``). Notes ----- An A-RELEASE-RP PDU requ...
class A_RELEASE_RP(PDU):
"""An A-RELEASE-RP PDU. An A-RELEASE-RP PDU is used once an association has been established to confirm the release of the association. Attributes ---------- pdu_type : int The *PDU Type* field value (``0x06``). Notes ----- An A-RELEASE-RP PDU requires the following parame...
list of tuple A list of (attr_name, callable, [args]), where - attr_name is the name of the attribute corresponding to the field - callable is an encoding function that returns bytes - args is a list of arguments to pass callable. """ return [ ...
256
256
985
8
247
chsasank/pynetdicom
pynetdicom/pdu.py
Python
A_RELEASE_RP
A_RELEASE_RP
1,643
1,768
1,643
1,643
f817a86658633a1789f3cd54e024965718af83d1
bigcode/the-stack
train
0e6f879b914214dce4c54ce9
train
class
class A_ASSOCIATE_AC(PDU): """An A-ASSOCIATE-AC PDU. An A-ASSOCIATE-AC PDU is sent by an association acceptor to indicate that association negotiation has been successful. Attributes ---------- pdu_type : int The *PDU Type* field value (``0x02``). protocol_version : int The...
class A_ASSOCIATE_AC(PDU):
"""An A-ASSOCIATE-AC PDU. An A-ASSOCIATE-AC PDU is sent by an association acceptor to indicate that association negotiation has been successful. Attributes ---------- pdu_type : int The *PDU Type* field value (``0x02``). protocol_version : int The *Protocol Version* field v...
: ={self.application_context_name}') s.append(' * Presentation Context Item(s):') for cx in self.presentation_context: item_str_list = str(cx).split('\n') s.append(f' - {item_str_list[0]}') for jj in item_str_list[1:-1]: s.append(f' {jj}') ...
256
256
2,937
8
247
chsasank/pynetdicom
pynetdicom/pdu.py
Python
A_ASSOCIATE_AC
A_ASSOCIATE_AC
704
1,049
704
704
a28e7d7a1be9dc168d2c5d1d6c2b10ed2e3cc695
bigcode/the-stack
train
919f2ffeeb4548e6ce3a8a18
train
class
class A_ABORT_RQ(PDU): """An A-ABORT-RQ PDU. An A-ABORT-RQ PDU is used to abort the association. Attributes ---------- pdu_type : int The *PDU Type* field value (``0x07``). reason_diagnostic : int The *Reason/Diagnostic* field value. source : int The *Source* field ...
class A_ABORT_RQ(PDU):
"""An A-ABORT-RQ PDU. An A-ABORT-RQ PDU is used to abort the association. Attributes ---------- pdu_type : int The *PDU Type* field value (``0x07``). reason_diagnostic : int The *Reason/Diagnostic* field value. source : int The *Source* field value. Notes -...
list of tuple A list of (attr_name, callable, [args]), where - attr_name is the name of the attribute corresponding to the field - callable is an encoding function that returns bytes - args is a list of arguments to pass callable. """ return [ ...
256
256
1,684
8
247
chsasank/pynetdicom
pynetdicom/pdu.py
Python
A_ABORT_RQ
A_ABORT_RQ
1,771
1,971
1,771
1,771
002e8ba5320353f2c1f797c29ee2740d4146c167
bigcode/the-stack
train
ebfa1877a571fcb1bac9ab47
train
class
class PDU: """Base class for PDUs. Protocol Data Units (PDUs) are the message formats exchanged between peer entities within a layer. A PDU consists of protocol control information and user data. PDUs are constructed by mandatory fixed fields followed by optional variable fields that contain one or...
class PDU:
"""Base class for PDUs. Protocol Data Units (PDUs) are the message formats exchanged between peer entities within a layer. A PDU consists of protocol control information and user data. PDUs are constructed by mandatory fixed fields followed by optional variable fields that contain one or more items...
PDU_ITEM_TYPES, _PDUItemType, PDUItem ) from pynetdicom.utils import validate_ae_title if TYPE_CHECKING: # pragma: no cover from pynetdicom.pdu_primitives import ( A_ASSOCIATE, P_DATA, A_RELEASE, A_ABORT, A_P_ABORT ) LOGGER = logging.getLogger('pynetdicom.pdu') _PDVItem = List[Presentat...
256
256
1,986
4
251
chsasank/pynetdicom
pynetdicom/pdu.py
Python
PDU
PDU
72
336
72
72
9233c374c6cc492987fbc341e86cbca1b139b058
bigcode/the-stack
train
12ee5d6537ed956581e368ab
train
class
class P_DATA_TF(PDU): """A P-DATA-TF PDU. A P-DATA-TF PDU is used once an association has been established to send DIMSE message data. Attributes ---------- pdu_type : int The *PDU Type* field value (``0x04``). presentation_data_value_items : list of pdu.PresentationDataValueItem ...
class P_DATA_TF(PDU):
"""A P-DATA-TF PDU. A P-DATA-TF PDU is used once an association has been established to send DIMSE message data. Attributes ---------- pdu_type : int The *PDU Type* field value (``0x04``). presentation_data_value_items : list of pdu.PresentationDataValueItem The *Presentati...
*Source* field value.""" _sources = { 1: 'DUL service-user', 2: 'DUL service-provider (ACSE related)', 3: 'DUL service-provider (presentation related)' } if self.source not in _sources: msg = 'Invalid value in Source field in A-ASSOCIATE-RJ PDU' ...
256
256
1,892
8
247
chsasank/pynetdicom
pynetdicom/pdu.py
Python
P_DATA_TF
P_DATA_TF
1,284
1,515
1,284
1,284
ffcf3024e5ef3537dfdc3cb0887162ef7bae50d1
bigcode/the-stack
train
bb26ac1eb97dee804b6f767b
train
class
class Module: def __init__(self, name: str, menv: msat_env, enc: LTLEncoder, *args, **kwargs): self.name = name self.menv = menv self.enc = enc self.symb2next = {} true = msat_make_true(menv) self.init = true self.trans = true def _symb(s...
class Module:
def __init__(self, name: str, menv: msat_env, enc: LTLEncoder, *args, **kwargs): self.name = name self.menv = menv self.enc = enc self.symb2next = {} true = msat_make_true(menv) self.init = true self.trans = true def _symb(self, v_name, v...
(menv, sender.stutter))) rhs = enc.make_G(msat_make_impl(menv, sender.wait_ack, enc.make_F(sender.send))) ltl = msat_make_impl(menv, lhs, rhs) return TermMap(curr2next), init, trans, ltl class Module:
64
64
168
3
60
EnricoMagnago/F3
benchmarks/f3_wrong_hints_permutations/scaling_ltl_timed_transition_system/16-sender_receiver_35.py
Python
Module
Module
137
154
137
137
1df951df4e384526ae7251d61c59eee88edafeeb
bigcode/the-stack
train
a9f86c4afc46c4812b1ba80e
train
function
def check_ltl(menv: msat_env, enc: LTLEncoder) -> (Iterable, msat_term, msat_term, msat_term): assert menv assert isinstance(menv, msat_env) assert enc assert isinstance(enc, LTLEncoder) int_type = msat_get_integer_type(menv) real_type = msat_ge...
def check_ltl(menv: msat_env, enc: LTLEncoder) -> (Iterable, msat_term, msat_term, msat_term):
assert menv assert isinstance(menv, msat_env) assert enc assert isinstance(enc, LTLEncoder) int_type = msat_get_integer_type(menv) real_type = msat_get_rational_type(menv) r2s, x_r2s = decl_consts(menv, "r2s", int_type) s2r, x_s2r = decl_consts(menv, "s2r", int_type) delta, x_delta =...
0, arg1) return msat_make_not(menv, leq) def msat_make_impl(menv: msat_env, arg0: msat_term, arg1: msat_term): n_arg0 = msat_make_not(menv, arg0) return msat_make_or(menv, n_arg0, arg1) def diverging_symbs(menv: msat_env) -> frozenset: real_type = msat_get_rational_type(menv) delta = msat_declar...
174
174
582
33
141
EnricoMagnago/F3
benchmarks/f3_wrong_hints_permutations/scaling_ltl_timed_transition_system/16-sender_receiver_35.py
Python
check_ltl
check_ltl
92
134
92
93
c5b5ab0268bf90901fb127d8beeeb6d18e40ef34
bigcode/the-stack
train
3ab61a5549590b5a59157cc5
train
function
def hints(env: PysmtEnv) -> FrozenSet[Hint]: assert isinstance(env, PysmtEnv) mgr = env.formula_manager delta = mgr.Symbol(delta_name, types.REAL) r2s = mgr.Symbol("r2s", types.INT) s2r = mgr.Symbol("r2s", types.INT) s_l = mgr.Symbol("s_l", types.BOOL) s_evt = mgr.Symbol("s_evt", types.BOOL...
def hints(env: PysmtEnv) -> FrozenSet[Hint]:
assert isinstance(env, PysmtEnv) mgr = env.formula_manager delta = mgr.Symbol(delta_name, types.REAL) r2s = mgr.Symbol("r2s", types.INT) s2r = mgr.Symbol("r2s", types.INT) s_l = mgr.Symbol("s_l", types.BOOL) s_evt = mgr.Symbol("s_evt", types.BOOL) s_msg_id = mgr.Symbol("s_msg_id", types...
(wait & wait') -> (out_c' = out_c) lhs = msat_make_and(menv, disc_t, msat_make_and(menv, self.wait, self.x_wait)) rhs = msat_make_equal(menv, x_out_c, out_c) self.trans = msat_make_and(menv, self.trans, msat_make_impl(menv, lhs, rhs...
256
256
1,540
15
241
EnricoMagnago/F3
benchmarks/f3_wrong_hints_permutations/scaling_ltl_timed_transition_system/16-sender_receiver_35.py
Python
hints
hints
342
490
342
342
3d217c8fe8008fcc5255f0e2652ba59f1757eaf0
bigcode/the-stack
train
7973ed56e0bbb3e8ed8acf27
train
function
def msat_make_lt(menv: msat_env, arg0: msat_term, arg1: msat_term): geq = msat_make_geq(menv, arg0, arg1) return msat_make_not(menv, geq)
def msat_make_lt(menv: msat_env, arg0: msat_term, arg1: msat_term):
geq = msat_make_geq(menv, arg0, arg1) return msat_make_not(menv, geq)
(menv, "-1") arg1 = msat_make_times(menv, arg1, m_one) return msat_make_plus(menv, arg0, arg1) def msat_make_lt(menv: msat_env, arg0: msat_term, arg1: msat_term):
64
64
56
26
38
EnricoMagnago/F3
benchmarks/f3_wrong_hints_permutations/scaling_ltl_timed_transition_system/16-sender_receiver_35.py
Python
msat_make_lt
msat_make_lt
66
68
66
66
f682ff02b643620fb47f1bac9d203fab49c9977a
bigcode/the-stack
train
edb4b786dae2e5d5ce5893a0
train
class
class Receiver(Module): def __init__(self, name: str, menv: msat_env, enc: LTLEncoder, in_c, x_in_c, out_c, x_out_c, delta): super().__init__(name, menv, enc) bool_type = msat_get_bool_type(menv) loc, x_loc = self._symb("l", bool_type) self.wait = loc self....
class Receiver(Module):
def __init__(self, name: str, menv: msat_env, enc: LTLEncoder, in_c, x_in_c, out_c, x_out_c, delta): super().__init__(name, menv, enc) bool_type = msat_get_bool_type(menv) loc, x_loc = self._symb("l", bool_type) self.wait = loc self.work = msat_make_not(men...
_make_and(menv, disc_t, self.wait_ack) rhs = msat_make_iff(menv, self.x_send, msat_make_and(menv, msat_make_equal(menv, in_c, msg_id), msat_make_lt(menv, c, timeout))) self.trans = msat_make_a...
178
178
594
4
174
EnricoMagnago/F3
benchmarks/f3_wrong_hints_permutations/scaling_ltl_timed_transition_system/16-sender_receiver_35.py
Python
Receiver
Receiver
290
339
290
290
a6252a2abab9f9e2231191273b9dd082b68e6e47
bigcode/the-stack
train
54eb544c802a4e662c427e05
train
function
def make_enum(menv, v_name: str, enum_size: int): bool_type = msat_get_bool_type(menv) num_bits = ceil(log(enum_size, 2)) b_vars = [] for idx in range(num_bits): c_name = "{}{}".format(v_name, idx) b_vars.append(tuple(decl_consts(menv, c_name, bool_type))) vals = [] x_vals = [] ...
def make_enum(menv, v_name: str, enum_size: int):
bool_type = msat_get_bool_type(menv) num_bits = ceil(log(enum_size, 2)) b_vars = [] for idx in range(num_bits): c_name = "{}{}".format(v_name, idx) b_vars.append(tuple(decl_consts(menv, c_name, bool_type))) vals = [] x_vals = [] for enum_val in range(enum_size): bit_v...
not name.startswith("_"), name s = msat_declare_function(menv, name, c_type) s = msat_make_constant(menv, s) x_s = msat_declare_function(menv, name_next(name), c_type) x_s = msat_make_constant(menv, x_s) return s, x_s def make_enum(menv, v_name: str, enum_size: int):
91
91
304
16
74
EnricoMagnago/F3
benchmarks/f3_wrong_hints_permutations/scaling_ltl_timed_transition_system/16-sender_receiver_35.py
Python
make_enum
make_enum
31
57
31
31
6f40058273179024dd97843c5848eacb9296b965
bigcode/the-stack
train
31d6ecdb9f8c09d11b99929b
train
function
def decl_consts(menv: msat_env, name: str, c_type) -> tuple: assert not name.startswith("_"), name s = msat_declare_function(menv, name, c_type) s = msat_make_constant(menv, s) x_s = msat_declare_function(menv, name_next(name), c_type) x_s = msat_make_constant(menv, x_s) return s, x_s
def decl_consts(menv: msat_env, name: str, c_type) -> tuple:
assert not name.startswith("_"), name s = msat_declare_function(menv, name, c_type) s = msat_make_constant(menv, s) x_s = msat_declare_function(menv, name_next(name), c_type) x_s = msat_make_constant(menv, x_s) return s, x_s
import pysmt.typing as types from ltl.ltl import TermMap, LTLEncoder from utils import name_next, symb_to_next from hint import Hint, Location delta_name = "delta" def decl_consts(menv: msat_env, name: str, c_type) -> tuple:
64
64
97
20
44
EnricoMagnago/F3
benchmarks/f3_wrong_hints_permutations/scaling_ltl_timed_transition_system/16-sender_receiver_35.py
Python
decl_consts
decl_consts
22
28
22
22
c4ecf1f5e126ec75d8eb9ef6e31b305b569d35be
bigcode/the-stack
train
de46f028e0f450e0778f228f
train
function
def msat_make_impl(menv: msat_env, arg0: msat_term, arg1: msat_term): n_arg0 = msat_make_not(menv, arg0) return msat_make_or(menv, n_arg0, arg1)
def msat_make_impl(menv: msat_env, arg0: msat_term, arg1: msat_term):
n_arg0 = msat_make_not(menv, arg0) return msat_make_or(menv, n_arg0, arg1)
, arg1: msat_term): leq = msat_make_leq(menv, arg0, arg1) return msat_make_not(menv, leq) def msat_make_impl(menv: msat_env, arg0: msat_term, arg1: msat_term):
64
64
57
26
38
EnricoMagnago/F3
benchmarks/f3_wrong_hints_permutations/scaling_ltl_timed_transition_system/16-sender_receiver_35.py
Python
msat_make_impl
msat_make_impl
80
82
80
80
6517b33753958b928ace2c9a49a92b8749eb6875
bigcode/the-stack
train
1c631f4110f711e1d2341835
train
function
def msat_make_minus(menv: msat_env, arg0: msat_term, arg1: msat_term): m_one = msat_make_number(menv, "-1") arg1 = msat_make_times(menv, arg1, m_one) return msat_make_plus(menv, arg0, arg1)
def msat_make_minus(menv: msat_env, arg0: msat_term, arg1: msat_term):
m_one = msat_make_number(menv, "-1") arg1 = msat_make_times(menv, arg1, m_one) return msat_make_plus(menv, arg0, arg1)
(pred) x_vals.append(x_pred) assert len(vals) == enum_size assert len(x_vals) == enum_size return b_vars, vals, x_vals def msat_make_minus(menv: msat_env, arg0: msat_term, arg1: msat_term):
64
64
72
26
37
EnricoMagnago/F3
benchmarks/f3_wrong_hints_permutations/scaling_ltl_timed_transition_system/16-sender_receiver_35.py
Python
msat_make_minus
msat_make_minus
60
63
60
60
c38225f1e9673b3cae169f25af1413608ccd44e7
bigcode/the-stack
train
b4223c5b2bdbdb99687cb942
train
function
def diverging_symbs(menv: msat_env) -> frozenset: real_type = msat_get_rational_type(menv) delta = msat_declare_function(menv, delta_name, real_type) delta = msat_make_constant(menv, delta) return frozenset([delta])
def diverging_symbs(menv: msat_env) -> frozenset:
real_type = msat_get_rational_type(menv) delta = msat_declare_function(menv, delta_name, real_type) delta = msat_make_constant(menv, delta) return frozenset([delta])
_env, arg0: msat_term, arg1: msat_term): n_arg0 = msat_make_not(menv, arg0) return msat_make_or(menv, n_arg0, arg1) def diverging_symbs(menv: msat_env) -> frozenset:
64
64
67
17
47
EnricoMagnago/F3
benchmarks/f3_wrong_hints_permutations/scaling_ltl_timed_transition_system/16-sender_receiver_35.py
Python
diverging_symbs
diverging_symbs
85
89
85
85
52aee152609891824a5119dca9434b688ce1f7d3
bigcode/the-stack
train
22ef1551b96827671eb03729
train
function
def msat_make_geq(menv: msat_env, arg0: msat_term, arg1: msat_term): return msat_make_leq(menv, arg1, arg0)
def msat_make_geq(menv: msat_env, arg0: msat_term, arg1: msat_term):
return msat_make_leq(menv, arg1, arg0)
arg1: msat_term): geq = msat_make_geq(menv, arg0, arg1) return msat_make_not(menv, geq) def msat_make_geq(menv: msat_env, arg0: msat_term, arg1: msat_term):
64
64
43
27
37
EnricoMagnago/F3
benchmarks/f3_wrong_hints_permutations/scaling_ltl_timed_transition_system/16-sender_receiver_35.py
Python
msat_make_geq
msat_make_geq
71
72
71
71
b508b807d803a8843eb678982d7c937a8b671e86
bigcode/the-stack
train
3c55aad989f16369b32a3663
train
class
class Sender(Module): def __init__(self, name: str, menv: msat_env, enc: LTLEncoder, in_c, x_in_c, out_c, x_out_c, delta): super().__init__(name, menv, enc) bool_type = msat_get_bool_type(menv) int_type = msat_get_integer_type(menv) real_type = msat_get_rational_typ...
class Sender(Module):
def __init__(self, name: str, menv: msat_env, enc: LTLEncoder, in_c, x_in_c, out_c, x_out_c, delta): super().__init__(name, menv, enc) bool_type = msat_get_bool_type(menv) int_type = msat_get_integer_type(menv) real_type = msat_get_rational_type(menv) loc, x...
G (s.wait_ack -> F s.send) lhs = enc.make_G(enc.make_F(msat_make_not(menv, sender.stutter))) rhs = enc.make_G(msat_make_impl(menv, sender.wait_ack, enc.make_F(sender.send))) ltl = msat_make_impl(menv, lhs, rhs) return TermMap(curr2next), init, trans, ltl class Modu...
256
256
1,581
4
252
EnricoMagnago/F3
benchmarks/f3_wrong_hints_permutations/scaling_ltl_timed_transition_system/16-sender_receiver_35.py
Python
Sender
Sender
157
287
157
157
433aae4a3982373c712889177fa3b8c3bb2c06fd
bigcode/the-stack
train
c31a9747780b059f8c770f70
train
function
def msat_make_gt(menv: msat_env, arg0: msat_term, arg1: msat_term): leq = msat_make_leq(menv, arg0, arg1) return msat_make_not(menv, leq)
def msat_make_gt(menv: msat_env, arg0: msat_term, arg1: msat_term):
leq = msat_make_leq(menv, arg0, arg1) return msat_make_not(menv, leq)
q(menv: msat_env, arg0: msat_term, arg1: msat_term): return msat_make_leq(menv, arg1, arg0) def msat_make_gt(menv: msat_env, arg0: msat_term, arg1: msat_term):
64
64
56
26
38
EnricoMagnago/F3
benchmarks/f3_wrong_hints_permutations/scaling_ltl_timed_transition_system/16-sender_receiver_35.py
Python
msat_make_gt
msat_make_gt
75
77
75
75
6ebfbc8ba8c3ffb3ba712af6009f476ff9bc91f6
bigcode/the-stack
train
6b634cfd81fe1dce92dac7b2
train
class
class MultiWorkerAllReduce(AllReduceCrossDeviceOps): """All-reduce algorithms for distributed TensorFlow.""" def __init__(self, worker_devices, num_gpus_per_worker, all_reduce_spec=("pscpu/pscpu", 2, -1), num_packs=0, agg_small_grads_max_by...
class MultiWorkerAllReduce(AllReduceCrossDeviceOps):
"""All-reduce algorithms for distributed TensorFlow.""" def __init__(self, worker_devices, num_gpus_per_worker, all_reduce_spec=("pscpu/pscpu", 2, -1), num_packs=0, agg_small_grads_max_bytes=0, agg_small_grads_max_group=10): ...
_max_bytes, self._agg_small_grads_max_group) # The actual aggregation of the repacked gradients. Note that they are # sharded among different aggregation trees. So it is important to strike # the balance on num_splits. if self._all_reduce_alg == "nccl": # TODO(yuefengz): merge this into t...
256
256
1,381
11
245
JRKONE/tensorflow
tensorflow/python/distribute/cross_device_ops.py
Python
MultiWorkerAllReduce
MultiWorkerAllReduce
643
763
643
643
2ad7182ada16c7c24f34bf903e9ec2fbbb33596a
bigcode/the-stack
train
c974324aa010d2fb89302fc7
train
class
class AllReduceCrossDeviceOps(CrossDeviceOps): """Reduction using all reduce.""" def __init__(self, all_reduce_alg="nccl", num_packs=1, agg_small_grads_max_bytes=0, agg_small_grads_max_group=10): """All-reduce implementation of CrossDeviceOps. Be...
class AllReduceCrossDeviceOps(CrossDeviceOps):
"""Reduction using all reduce.""" def __init__(self, all_reduce_alg="nccl", num_packs=1, agg_small_grads_max_bytes=0, agg_small_grads_max_group=10): """All-reduce implementation of CrossDeviceOps. Before performing all-reduce, tensors will be rep...
aggregation process.""" return cross_device_utils.unpack_small_tensors(summed_device_grad_packs, self.packing) def _pack_tensors(device_grads, num_packs=0, agg_small_grads_max_bytes=0, agg_small_grads_max_gro...
256
256
1,077
11
244
JRKONE/tensorflow
tensorflow/python/distribute/cross_device_ops.py
Python
AllReduceCrossDeviceOps
AllReduceCrossDeviceOps
525
632
525
525
3a198985a72821d6960fe1b0d0f95fde2236ee02
bigcode/the-stack
train
72e0340eb8e194a538eff873
train
function
def _validate_value_destination_pairs(value_destination_pairs): # TODO(yuefengz): raise exceptions instead of returning False. # pylint: disable=g-missing-docstring if not value_destination_pairs: return False if not isinstance(value_destination_pairs, (list, tuple)): return False if not all(isinstance(pair, ...
def _validate_value_destination_pairs(value_destination_pairs): # TODO(yuefengz): raise exceptions instead of returning False. # pylint: disable=g-missing-docstring
if not value_destination_pairs: return False if not isinstance(value_destination_pairs, (list, tuple)): return False if not all(isinstance(pair, tuple) for pair in value_destination_pairs): return False if not all(isinstance(v[0], value_lib.PerReplica) for v in value_destination_pairs): ret...
= _make_tensor_into_per_replica(pair[0]) result.append((per_replica, pair[1])) return result def _validate_value_destination_pairs(value_destination_pairs): # TODO(yuefengz): raise exceptions instead of returning False. # pylint: disable=g-missing-docstring
64
64
114
36
27
JRKONE/tensorflow
tensorflow/python/distribute/cross_device_ops.py
Python
_validate_value_destination_pairs
_validate_value_destination_pairs
101
111
101
103
36ca0f22bb14066fc67154fec7e8a06cd51a4bf7
bigcode/the-stack
train
c5f5fa0159c30e392969dd84
train
class
class ConcatAndSplitPacker(object): """Concatenate and split tensors for reduction.""" def __init__(self, num_packs=1): """Initialize the ConcatAndSplitPacker object. Args: num_packs: specifies the number of split packs that will be formed. Raises: ValueError: if num_packs is not ...
class ConcatAndSplitPacker(object):
"""Concatenate and split tensors for reduction.""" def __init__(self, num_packs=1): """Initialize the ConcatAndSplitPacker object. Args: num_packs: specifies the number of split packs that will be formed. Raises: ValueError: if num_packs is not greater than 0. """ if num_p...
if reduce_op is "mean". Args: grouped_reduced: a list of lists, each sublist has components for each device, paired with a None. It is the result from cross_device_utils.aggregate_gradients_using*. destinations: a list of device strings for returned Mirrored objects. reduce_op: Indicates how...
256
256
1,006
9
247
JRKONE/tensorflow
tensorflow/python/distribute/cross_device_ops.py
Python
ConcatAndSplitPacker
ConcatAndSplitPacker
356
457
356
356
76ce6b5caa40cd3f0d139178386922caf34c91e0
bigcode/the-stack
train
3100c1c86990db78487931ce
train
function
def check_destinations(destinations): """Checks whether `destinations` is not empty. Args: destinations: a DistributedValues, Variable, string or a list of strings. Returns: Boolean which is True if `destinations` is not empty. """ # Calling bool() on a ResourceVariable is not allowed. if isinstan...
def check_destinations(destinations):
"""Checks whether `destinations` is not empty. Args: destinations: a DistributedValues, Variable, string or a list of strings. Returns: Boolean which is True if `destinations` is not empty. """ # Calling bool() on a ResourceVariable is not allowed. if isinstance(destinations, resource_variable_ops...
tensorflow.python.eager import context from tensorflow.python.framework import ops from tensorflow.python.ops import array_ops from tensorflow.python.ops import math_ops from tensorflow.python.ops import resource_variable_ops from tensorflow.python.platform import tf_logging as logging from tensorflow.python.training ...
64
64
95
7
56
JRKONE/tensorflow
tensorflow/python/distribute/cross_device_ops.py
Python
check_destinations
check_destinations
37
49
37
37
63698aa5f3704165d3159af45bd212a9d59deac5
bigcode/the-stack
train
c0dec1b8d2252a90ecbee151
train
function
def choose_the_best(devices, session_config=None): """Find the best subclass of CrossDeviceOps given a tensorflow session. Args: devices: a list of devices passed for distribute strategy. session_config: a tensorflow session config or None. If None, it will make deciesion based on all local devices. ...
def choose_the_best(devices, session_config=None):
"""Find the best subclass of CrossDeviceOps given a tensorflow session. Args: devices: a list of devices passed for distribute strategy. session_config: a tensorflow session config or None. If None, it will make deciesion based on all local devices. Returns: a subclass of CrossDeviceOps. """...
if _has_dgx1_like_links(device_links): logging.info("Configured hierarchical_copy with num_packs=%d", len(device_links)) return AllReduceCrossDeviceOps( "hierarchical_copy", num_packs=len(device_links)) else: logging.info("Configured nccl all-reduce.") return AllReduceCrossD...
94
94
314
11
83
JRKONE/tensorflow
tensorflow/python/distribute/cross_device_ops.py
Python
choose_the_best
choose_the_best
918
954
918
918
1f8be3a654a7d51e096487d5ebcb001a00af75c6
bigcode/the-stack
train
08f6fc6ee8bb4108f7dfdc90
train
function
def _normalize_value_destination_pairs(value_destination_pairs): """Converts each tensor into a PerReplica object in the input list.""" result = [] if not isinstance(value_destination_pairs, (list, tuple)): raise ValueError("`value_destination_pairs` should be a list or tuple") for pair in value_destination...
def _normalize_value_destination_pairs(value_destination_pairs):
"""Converts each tensor into a PerReplica object in the input list.""" result = [] if not isinstance(value_destination_pairs, (list, tuple)): raise ValueError("`value_destination_pairs` should be a list or tuple") for pair in value_destination_pairs: if not isinstance(pair, tuple): raise ValueErro...
try: device = input_tensor.device except AttributeError: raise ValueError("Cannot convert `input_tensor` to a `PerReplica` object " "because it doesn't have device set.") return value_lib.PerReplica({device: input_tensor}) def _normalize_value_destination_pairs(value_destination_pairs...
64
64
162
10
54
JRKONE/tensorflow
tensorflow/python/distribute/cross_device_ops.py
Python
_normalize_value_destination_pairs
_normalize_value_destination_pairs
83
98
83
83
6cf9c4fb326e7efa5e93f156a0886fa837faf08c
bigcode/the-stack
train
16212a40e52fc085ff87f780
train
function
def _group_value_by_device(per_replica_values): """Group values into sublists by their devices. This grouping is needed to call the all-reduce library because it expects a list of the following form: [[(grad0_gpu0, v0_gpu0), (grad1_gpu0, v1_gpu0), (grad2_gpu0, v2_gpu0) ...], [(grad0_gpu1, v0_gpu1), (gra...
def _group_value_by_device(per_replica_values):
"""Group values into sublists by their devices. This grouping is needed to call the all-reduce library because it expects a list of the following form: [[(grad0_gpu0, v0_gpu0), (grad1_gpu0, v1_gpu0), (grad2_gpu0, v2_gpu0) ...], [(grad0_gpu1, v0_gpu1), (grad1_gpu1, v1_gpu1), (grad2_gpu1, v2_gpu1) ...], ...
reduced = _simple_reduce(per_replica_value, reduce_to_device, self.accumulation_fn, reduce_op) return self.broadcast(reduced, devices) def _batch_reduce(self, reduce_op, value_destination_pairs): return [ self._reduce(reduce_op, t, destinations=v) for t, v in val...
86
87
292
11
75
JRKONE/tensorflow
tensorflow/python/distribute/cross_device_ops.py
Python
_group_value_by_device
_group_value_by_device
295
320
295
295
7738c85d1c2961e75144b0b0d5c708250e507786
bigcode/the-stack
train
379824532e17be3cfd023182
train
function
def _ungroup_and_make_mirrored(grouped_reduced, destinations, reduce_op, num_between_graph_workers=1): """Ungroup results from all-reduce and make Mirrored objects. Each all-reduce result will be divided by the number of d...
def _ungroup_and_make_mirrored(grouped_reduced, destinations, reduce_op, num_between_graph_workers=1):
"""Ungroup results from all-reduce and make Mirrored objects. Each all-reduce result will be divided by the number of destinations before Mirrored objects are created if reduce_op is "mean". Args: grouped_reduced: a list of lists, each sublist has components for each device, paired with a None. It i...
(len(destinations))] for per_replica_value in per_replica_values: # pylint: disable=protected-access for i, v in enumerate(per_replica_value._index.values()): assert per_replica_value.devices == destinations grouped[i].append((v, None)) return grouped def _ungroup_and_make_mirrored(grouped_reduc...
93
93
313
29
63
JRKONE/tensorflow
tensorflow/python/distribute/cross_device_ops.py
Python
_ungroup_and_make_mirrored
_ungroup_and_make_mirrored
323
353
323
326
91bbf31d7162c2c01a02d07f86fbcb89679007a9
bigcode/the-stack
train
849e9753ad07e7a057ff4f3e
train
class
class CollectiveAllReduce(CrossDeviceOps): """All-reduce cross device ops using collective ops. In the between-graph replicated training, it will still do all-reduces across all workers and then put results on the right destinations. """ def __init__(self, num_workers=1, num_gp...
class CollectiveAllReduce(CrossDeviceOps):
"""All-reduce cross device ops using collective ops. In the between-graph replicated training, it will still do all-reduces across all workers and then put results on the right destinations. """ def __init__(self, num_workers=1, num_gpus_per_worker=0, all_reduce_...
ads_by_size( spec_tuple.limit, remaining_grads) if this_grads: device_grad_packs, tensor_packer = _pack_tensors( this_grads, self._num_packs, self._agg_small_grads_max_bytes, self._agg_small_grads_max_group) range_agg_grads = cross_device_utils.sum_gradients_all...
256
256
1,168
9
247
JRKONE/tensorflow
tensorflow/python/distribute/cross_device_ops.py
Python
CollectiveAllReduce
CollectiveAllReduce
767
886
767
767
fe8df0ef5563ee6c4e6421197ea1f624e1891a8c
bigcode/the-stack
train
e95d3d9ecee04c47dfe8bc79
train
function
def _all_devices_match(value_destination_pairs): if not all(_devices_match(v, d) for v, d in value_destination_pairs): return False if not all(_devices_match(v, value_destination_pairs[0][0]) for v, _ in value_destination_pairs[1:]): return False return True
def _all_devices_match(value_destination_pairs):
if not all(_devices_match(v, d) for v, d in value_destination_pairs): return False if not all(_devices_match(v, value_destination_pairs[0][0]) for v, _ in value_destination_pairs[1:]): return False return True
isinstance(destinations, (list, tuple)): return [device_util.resolve(destination) for destination in destinations] else: return [destinations.device] def _devices_match(left, right): return set(get_devices_from(left)) == set(get_devices_from(right)) def _all_devices_match(value_destination_pairs):
64
64
71
9
55
JRKONE/tensorflow
tensorflow/python/distribute/cross_device_ops.py
Python
_all_devices_match
_all_devices_match
134
140
134
134
6ca2bbdf9f138b1ea71e2523d2d516bde42e52b4
bigcode/the-stack
train
d143d55fcb648739565f041a
train
function
def _unpack_tensors(reduced, tensor_packer=None): """Unpack tensors if they are packed before all-reduce.""" if tensor_packer: return tensor_packer.unpack(reduced) return reduced
def _unpack_tensors(reduced, tensor_packer=None):
"""Unpack tensors if they are packed before all-reduce.""" if tensor_packer: return tensor_packer.unpack(reduced) return reduced
_grads_max_group) device_grad_packs = tensor_packer.pack(device_grads) else: tensor_packer = None device_grad_packs = device_grads return device_grad_packs, tensor_packer def _unpack_tensors(reduced, tensor_packer=None):
64
64
47
14
49
JRKONE/tensorflow
tensorflow/python/distribute/cross_device_ops.py
Python
_unpack_tensors
_unpack_tensors
518
522
518
518
792fbdf60711bcbab227fb20470e94e0ffcfa4ea
bigcode/the-stack
train
cf8f2f7b9e103c106f191292
train
function
def _simple_reduce(per_replica_value, reduce_to_device, accumulation_fn, reduce_op): # pylint: disable=g-missing-docstring all_values = [] count = 0 for v in per_replica_value._index.values(): # pylint: disable=protected-access count += 1 all_values.append(v) if not all_values: ...
def _simple_reduce(per_replica_value, reduce_to_device, accumulation_fn, reduce_op): # pylint: disable=g-missing-docstring
all_values = [] count = 0 for v in per_replica_value._index.values(): # pylint: disable=protected-access count += 1 all_values.append(v) if not all_values: raise ValueError("`per_replica_value` must be non-empty") with ops.device(reduce_to_device): with context.context().device_policy(contex...
: index[d] = cross_device_utils.copy_tensor_or_indexed_slices_to_device( value, d) return value_lib.Mirrored(index) def _simple_reduce(per_replica_value, reduce_to_device, accumulation_fn, reduce_op): # pylint: disable=g-missing-docstring
64
64
216
31
33
JRKONE/tensorflow
tensorflow/python/distribute/cross_device_ops.py
Python
_simple_reduce
_simple_reduce
152
172
152
154
a93b04ab986c825956d990603c93891aeb10bcfb
bigcode/the-stack
train
d831949999d18df981779223
train
function
def _choose_all_reduce_algorithm(device_links): if _has_dgx1_like_links(device_links): logging.info("Configured hierarchical_copy with num_packs=%d", len(device_links)) return AllReduceCrossDeviceOps( "hierarchical_copy", num_packs=len(device_links)) else: logging.info("Configur...
def _choose_all_reduce_algorithm(device_links):
if _has_dgx1_like_links(device_links): logging.info("Configured hierarchical_copy with num_packs=%d", len(device_links)) return AllReduceCrossDeviceOps( "hierarchical_copy", num_packs=len(device_links)) else: logging.info("Configured nccl all-reduce.") return AllReduceCrossD...
) in enumerate(zip(gpu_links, _dgx1_links)): if (set(gpu_link) != set(dgx1_link) and set(gpu_link) != set(dgx1_link + [i])): return False return True def _choose_all_reduce_algorithm(device_links):
64
64
92
9
54
JRKONE/tensorflow
tensorflow/python/distribute/cross_device_ops.py
Python
_choose_all_reduce_algorithm
_choose_all_reduce_algorithm
907
915
907
907
4cb061d6cf37738602773c06b7b8ae725af49c06
bigcode/the-stack
train
d72918f1a3ab270582d782f1
train
function
def _pack_tensors(device_grads, num_packs=0, agg_small_grads_max_bytes=0, agg_small_grads_max_group=0): """Pack tensors if specified.""" if num_packs > 0: tensor_packer = ConcatAndSplitPacker(num_packs) device_grad_packs = tensor_packer.pack(device_grads...
def _pack_tensors(device_grads, num_packs=0, agg_small_grads_max_bytes=0, agg_small_grads_max_group=0):
"""Pack tensors if specified.""" if num_packs > 0: tensor_packer = ConcatAndSplitPacker(num_packs) device_grad_packs = tensor_packer.pack(device_grads) elif agg_small_grads_max_bytes > 0 and agg_small_grads_max_group > 0: tensor_packer = AggregateSmallTensorPacker(agg_small_grads_max_bytes, ...
"""Reverse the aggregation process.""" return cross_device_utils.unpack_small_tensors(summed_device_grad_packs, self.packing) def _pack_tensors(device_grads, num_packs=0, agg_small_grads_max_bytes=0, agg_sma...
64
64
174
36
28
JRKONE/tensorflow
tensorflow/python/distribute/cross_device_ops.py
Python
_pack_tensors
_pack_tensors
500
515
500
503
92cf84ddc2b816a0e175e95d586952727671bef7
bigcode/the-stack
train
5d9e0d236f84359816d038bd
train
function
def _make_tensor_into_per_replica(input_tensor): """Converts a single tensor into a PerReplica object.""" if isinstance(input_tensor, (tuple, list)): raise ValueError("Cannot convert `input_tensor` to a `PerReplica` object, " "got %r but expected a object that is not a tuple or list." ...
def _make_tensor_into_per_replica(input_tensor):
"""Converts a single tensor into a PerReplica object.""" if isinstance(input_tensor, (tuple, list)): raise ValueError("Cannot convert `input_tensor` to a `PerReplica` object, " "got %r but expected a object that is not a tuple or list." % (input_tensor,)) if isinstanc...
inations must be one of a `DistributedValues` object," " a tf.Variable object, a device string, a list of device " "strings") if not check_destinations(destinations): raise ValueError("destinations can not be empty") def _make_tensor_into_per_replica(input_tensor):
64
64
149
11
53
JRKONE/tensorflow
tensorflow/python/distribute/cross_device_ops.py
Python
_make_tensor_into_per_replica
_make_tensor_into_per_replica
65
80
65
65
d85ce7d726fbff943c435fd1b7668a12b34d6408
bigcode/the-stack
train
0b033bf1304767580528e20f
train
class
class ReductionToOneDeviceCrossDeviceOps(CrossDeviceOps): """Always do reduction to one device first and then do broadcasting. Batch reduction is done by reduction on each element one by one. """ def __init__(self, reduce_to_device=None, accumulation_fn=math_ops.add_n): """Constructor. Args: ...
class ReductionToOneDeviceCrossDeviceOps(CrossDeviceOps):
"""Always do reduction to one device first and then do broadcasting. Batch reduction is done by reduction on each element one by one. """ def __init__(self, reduce_to_device=None, accumulation_fn=math_ops.add_n): """Constructor. Args: reduce_to_device: the intermediate device to reduce to. If...
lica_value, destinations): raise NotImplementedError( "_reduce method must be implemented in descendants.") def _batch_reduce(self, reduce_op, value_destination_pairs): raise NotImplementedError( "_batch_reduce method must be implemented in descendants.") def _broadcast(self, tensor, desti...
86
86
288
13
73
JRKONE/tensorflow
tensorflow/python/distribute/cross_device_ops.py
Python
ReductionToOneDeviceCrossDeviceOps
ReductionToOneDeviceCrossDeviceOps
260
292
260
260
4a3929d78c43b91043b55dfcc8e17fba78c0fd02
bigcode/the-stack
train
820bec62ff95f7c32ac6d9ab
train
class
class CrossDeviceOps(object): """Base class for cross-device reduction and broadcasting algorithms.""" def __init__(self): pass def reduce(self, reduce_op, per_replica_value, destinations): """Reduce `per_replica_value` to `destinations`. It runs the reduction operation defined by `reduce_op` and p...
class CrossDeviceOps(object):
"""Base class for cross-device reduction and broadcasting algorithms.""" def __init__(self): pass def reduce(self, reduce_op, per_replica_value, destinations): """Reduce `per_replica_value` to `destinations`. It runs the reduction operation defined by `reduce_op` and put the result on `destinat...
= [] count = 0 for v in per_replica_value._index.values(): # pylint: disable=protected-access count += 1 all_values.append(v) if not all_values: raise ValueError("`per_replica_value` must be non-empty") with ops.device(reduce_to_device): with context.context().device_policy(context.DEVICE_PLA...
188
188
628
6
181
JRKONE/tensorflow
tensorflow/python/distribute/cross_device_ops.py
Python
CrossDeviceOps
CrossDeviceOps
175
257
175
175
cb74f77d45692a238bcf42dbc13d39b2f8ccecde
bigcode/the-stack
train
febd44a38a126e93bf5bf1ce
train
function
def get_devices_from(destinations): if isinstance(destinations, value_lib.DistributedValues): return list(destinations.devices) elif isinstance(destinations, (resource_variable_ops.ResourceVariable, value_lib.AggregatingVariable)): return [destinations.device] elif isinsta...
def get_devices_from(destinations):
if isinstance(destinations, value_lib.DistributedValues): return list(destinations.devices) elif isinstance(destinations, (resource_variable_ops.ResourceVariable, value_lib.AggregatingVariable)): return [destinations.device] elif isinstance(destinations, six.string_types):...
): return False if not all(isinstance(v[0], value_lib.PerReplica) for v in value_destination_pairs): return False return True # TODO(yuefengz): consider calling this function in the caller of # CrossDeviceOps. def get_devices_from(destinations):
64
64
106
7
57
JRKONE/tensorflow
tensorflow/python/distribute/cross_device_ops.py
Python
get_devices_from
get_devices_from
116
127
116
116
2f139c58e76e45463e95ac2f567d7fe7e8f6853e
bigcode/the-stack
train
fe0f9b3e242a8240514da058
train
function
def _simple_broadcast(value, destinations): index = {} devices = get_devices_from(destinations) for d in devices: index[d] = cross_device_utils.copy_tensor_or_indexed_slices_to_device( value, d) return value_lib.Mirrored(index)
def _simple_broadcast(value, destinations):
index = {} devices = get_devices_from(destinations) for d in devices: index[d] = cross_device_utils.copy_tensor_or_indexed_slices_to_device( value, d) return value_lib.Mirrored(index)
(v, d) for v, d in value_destination_pairs): return False if not all(_devices_match(v, value_destination_pairs[0][0]) for v, _ in value_destination_pairs[1:]): return False return True def _simple_broadcast(value, destinations):
64
64
60
9
54
JRKONE/tensorflow
tensorflow/python/distribute/cross_device_ops.py
Python
_simple_broadcast
_simple_broadcast
143
149
143
143
6c57eb9f6577a94e63af9701df4f21aaed40d2b3
bigcode/the-stack
train
540e4f094b3094ed4e454be5
train
function
def _has_dgx1_like_links(gpu_links): if not gpu_links: return False # TODO(yuefengz): figure out the right topology for hierarchial copy if # number of gpus are less than 8. if len(gpu_links) < 8: return False for i, (gpu_link, dgx1_link) in enumerate(zip(gpu_links, _dgx1_links)): if (set(gpu_link...
def _has_dgx1_like_links(gpu_links):
if not gpu_links: return False # TODO(yuefengz): figure out the right topology for hierarchial copy if # number of gpus are less than 8. if len(gpu_links) < 8: return False for i, (gpu_link, dgx1_link) in enumerate(zip(gpu_links, _dgx1_links)): if (set(gpu_link) != set(dgx1_link) and set(g...
7], [0, 5, 6, 7], [1, 4, 6, 7], [2, 4, 5, 7], [3, 4, 5, 6]] def _has_dgx1_like_links(gpu_links):
63
64
136
12
51
JRKONE/tensorflow
tensorflow/python/distribute/cross_device_ops.py
Python
_has_dgx1_like_links
_has_dgx1_like_links
893
904
893
893
8f602165735b27c1832306b7320d5f07b181dbce
bigcode/the-stack
train
d7e3155669cbee0c02bcdeb4
train
function
def validate_destinations(destinations): if not isinstance( destinations, (value_lib.DistributedValues, resource_variable_ops.ResourceVariable, value_lib.AggregatingVariable, six.string_types, list)): raise ValueError("destinations must be one of a `DistributedValues` object," ...
def validate_destinations(destinations):
if not isinstance( destinations, (value_lib.DistributedValues, resource_variable_ops.ResourceVariable, value_lib.AggregatingVariable, six.string_types, list)): raise ValueError("destinations must be one of a `DistributedValues` object," " a tf.Variable object, a device stri...
Returns: Boolean which is True if `destinations` is not empty. """ # Calling bool() on a ResourceVariable is not allowed. if isinstance(destinations, resource_variable_ops.ResourceVariable): return bool(destinations.device) return bool(destinations) def validate_destinations(destinations):
64
64
101
7
57
JRKONE/tensorflow
tensorflow/python/distribute/cross_device_ops.py
Python
validate_destinations
validate_destinations
52
62
52
52
b95b0509568bd4cf3b73c73ffd2cf23ad519716b
bigcode/the-stack
train
b0085bedd6f8946016ba3d79
train
class
class AggregateSmallTensorPacker(object): """Concatenate small gradient tensors together for reduction.""" def __init__(self, agg_small_grads_max_bytes=1048576, agg_small_grads_max_group=16): """Initialize the AggregateSmallTensorPacker object. Args: agg_small_grads_max...
class AggregateSmallTensorPacker(object):
"""Concatenate small gradient tensors together for reduction.""" def __init__(self, agg_small_grads_max_bytes=1048576, agg_small_grads_max_group=16): """Initialize the AggregateSmallTensorPacker object. Args: agg_small_grads_max_bytes: largest tensor eligible for aggreg...
shapes. grads_with_shapes = [ array_ops.reshape(grad, shape) for shape, grad in zip(device_shapes, grads_with_sizes) ] # Form the list with the original list of variables. summed_device_grads = [ (g, v) for g, (_, v) in zip(grads_with_shapes, ...
107
107
357
8
98
JRKONE/tensorflow
tensorflow/python/distribute/cross_device_ops.py
Python
AggregateSmallTensorPacker
AggregateSmallTensorPacker
460
497
460
460
f87de51e86e12ca8f25a28cea130799c20456537
bigcode/the-stack
train
2641b1fccb4f19ec50fb12b9
train
function
def _devices_match(left, right): return set(get_devices_from(left)) == set(get_devices_from(right))
def _devices_match(left, right):
return set(get_devices_from(left)) == set(get_devices_from(right))
inations.device] elif isinstance(destinations, six.string_types): return [device_util.resolve(destinations)] elif isinstance(destinations, (list, tuple)): return [device_util.resolve(destination) for destination in destinations] else: return [destinations.device] def _devices_match(left, right):
64
64
23
8
56
JRKONE/tensorflow
tensorflow/python/distribute/cross_device_ops.py
Python
_devices_match
_devices_match
130
131
130
130
2b54fc581d557da809a52af2f56a83dbbaca7d92
bigcode/the-stack
train
bc3fa93ad3a17d36dd53a1cd
train
function
async def resolver(context, *args): # pylint: disable=unused-argument await asyncio.sleep(0.001) return "hey"
async def resolver(context, *args): # pylint: disable=unused-argument
await asyncio.sleep(0.001) return "hey"
( type=QueryRootType, resolver=lambda *args: QueryRootType ) }, ) Schema = GraphQLSchema(QueryRootType, MutationRootType, SubscriptionsRootType) # Schema with async methods async def resolver(context, *args): # pylint: disable=unused-argument
64
64
32
18
45
mazvv/aiohttp-graphql
tests/schema.py
Python
resolver
resolver
65
68
65
66
3cbc3e0965fde643458f56863e2b089423cd9ee7
bigcode/the-stack
train
79db9d4165d4e28e3c2b89c6
train
function
def resolver_3(context, *args): # pylint: disable=unused-argument return "hey3"
def resolver_3(context, *args): # pylint: disable=unused-argument
return "hey3"
(0.001) return "hey" async def resolver_2(context, *args): # pylint: disable=unused-argument await asyncio.sleep(0.003) return "hey2" def resolver_3(context, *args): # pylint: disable=unused-argument
64
64
25
19
45
mazvv/aiohttp-graphql
tests/schema.py
Python
resolver_3
resolver_3
77
79
77
78
1984bdda50ca4b21f8fef2b2b0c4bf3de17b7499
bigcode/the-stack
train
48613ef6a856e13459420ff8
train
function
def resolve_raises(*args): # pylint: disable=unused-argument raise Exception("Throws!")
def resolve_raises(*args): # pylint: disable=unused-argument
raise Exception("Throws!")
graphql.type.definition import ( GraphQLArgument, GraphQLField, GraphQLNonNull, GraphQLObjectType, ) from graphql.type.scalars import GraphQLString from graphql.type.schema import GraphQLSchema def resolve_raises(*args): # pylint: disable=unused-argument
64
64
23
17
46
mazvv/aiohttp-graphql
tests/schema.py
Python
resolve_raises
resolve_raises
13
15
13
14
6c66bd99b9c99e7a991a05ea4466174331e2da02
bigcode/the-stack
train
c4678157b1248ae25a96983e
train
function
async def resolver_2(context, *args): # pylint: disable=unused-argument await asyncio.sleep(0.003) return "hey2"
async def resolver_2(context, *args): # pylint: disable=unused-argument
await asyncio.sleep(0.003) return "hey2"
, SubscriptionsRootType) # Schema with async methods async def resolver(context, *args): # pylint: disable=unused-argument await asyncio.sleep(0.001) return "hey" async def resolver_2(context, *args): # pylint: disable=unused-argument
64
64
35
20
44
mazvv/aiohttp-graphql
tests/schema.py
Python
resolver_2
resolver_2
71
74
71
72
bcbb51d790ffd82d02fbda1589aff76730fb1db6
bigcode/the-stack
train
4c808aac348bac0726d48ea6
train
function
def main(source, limit, num_threads): pool = futures.ThreadPoolExecutor(num_threads) pending = {} t0 = time.time() # submit all jobs for iso_cc in sorted(cf.cc2name)[:limit]: print('get:', iso_cc) times[iso_cc] = [time.time() - t0] job = pool.submit(fetch, iso_cc, source) ...
def main(source, limit, num_threads):
pool = futures.ThreadPoolExecutor(num_threads) pending = {} t0 = time.time() # submit all jobs for iso_cc in sorted(cf.cc2name)[:limit]: print('get:', iso_cc) times[iso_cc] = [time.time() - t0] job = pool.submit(fetch, iso_cc, source) pending[job] = iso_cc to_down...
from concurrent import futures import sys import requests import countryflags as cf import time from getsequential import fetch DEFAULT_LIMIT = sys.maxsize DEFAULT_NUM_THREADS = 100 GLOBAL_TIMEOUT = 300 # seconds times = {} def main(source, limit, num_threads):
62
84
281
9
53
garoa/concorrente
flags/getthreadpool.py
Python
main
main
15
40
15
15
e13f3e32064bafde45cef36a4c19d71e856d4dc7
bigcode/the-stack
train
b8b130c72886a8b208d0220f
train
class
class QChatLogger: """ Simple logger module used in the QChat project, overrides the default logger but allows space for any additional desired functionalities. """ def __init__(self, name): self.logger = logging.getLogger(name) self.logger.setLevel(LOG_LEVEL) def warning(self, ...
class QChatLogger:
""" Simple logger module used in the QChat project, overrides the default logger but allows space for any additional desired functionalities. """ def __init__(self, name): self.logger = logging.getLogger(name) self.logger.setLevel(LOG_LEVEL) def warning(self, message): s...
import logging LOG_LEVEL = logging.DEBUG FORMAT = '%(asctime)s - %(levelname)s - %(name)s - %(message)s' logging.basicConfig(format=FORMAT) class QChatLogger:
42
64
126
5
37
mdskrzypczyk/QChat
qchat/log.py
Python
QChatLogger
QChatLogger
8
30
8
8
78ba10375661d625fde83a05756d9fc08a8a4ec6
bigcode/the-stack
train
4a9359d2482abb441ac5a86b
train
function
@pytest.mark.skipif(not lastools_is_present(), reason="LASTools not found.") def test_lastools(minimal_dataset): # Instantiate a default filter object f = LASToolsFilter() # Make sure that the filter widget can be displayed widget = f.widget_form() # And that the filter can be reconstructed using ...
@pytest.mark.skipif(not lastools_is_present(), reason="LASTools not found.") def test_lastools(minimal_dataset): # Instantiate a default filter object
f = LASToolsFilter() # Make sure that the filter widget can be displayed widget = f.widget_form() # And that the filter can be reconstructed using the form data f2 = f.copy(**pyrsistent.thaw(widget.data)) # Apply the filter dataset = f.execute(minimal_dataset)
from adaptivefiltering.lastools import * import pyrsistent import pytest @pytest.mark.skipif(not lastools_is_present(), reason="LASTools not found.") def test_lastools(minimal_dataset): # Instantiate a default filter object
49
64
103
33
15
zaw-shinoto/adaptivefiltering
tests/test_lastools.py
Python
test_lastools
test_lastools
7
19
7
9
97fcadef869be02d7f30274b82eae6a4ffda7b82
bigcode/the-stack
train
46dc0a0211b4d9eb1cf2f2b1
train
function
def import_error_trace(logger, witness, verification_task_files): # Parse witness po = ErrorTraceParser(logger, witness, verification_task_files) trace = po.error_trace # Parse comments from sources trace.parse_model_comments() trace.remove_switch_cases() # Find violation trace.find_v...
def import_error_trace(logger, witness, verification_task_files): # Parse witness
po = ErrorTraceParser(logger, witness, verification_task_files) trace = po.error_trace # Parse comments from sources trace.parse_model_comments() trace.remove_switch_cases() # Find violation trace.find_violation_path() # Make more difficult transformations envmodel_simplification...
See the License for the specific language governing permissions and # limitations under the License. # from klever.core.vrp.et.parser import ErrorTraceParser from klever.core.vrp.et.envmodel import envmodel_simplifications def import_error_trace(logger, witness, verification_task_files): # Parse witness
64
64
102
17
46
lutovna/klever
klever/core/vrp/et/__init__.py
Python
import_error_trace
import_error_trace
22
41
22
23
5f5d51f51b17b3f289b193ffd62af4303dec6082
bigcode/the-stack
train
46af3f39437d0f259db86e04
train
class
class Output(object): """NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ """ Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The k...
class Output(object):
"""NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ """ Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name ...
# coding: utf-8 """ Control-M Services Provides access to BMC Control-M Services # noqa: E501 OpenAPI spec version: 9.20.220 Contact: customer_support@bmc.com Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import six class Output(obje...
87
175
584
4
82
dcompane/controlm_py
controlm_py/models/output.py
Python
Output
Output
18
110
18
18
a80badf9f6e2b224d93732dfe291cfc782c9883b
bigcode/the-stack
train
e8f096ea6a6febdb4f57fecb
train
class
class PyWebP(Gtk.Application): """ Main Class """ def _init__(self): app_id = "com.github.tudo75.pywebp-gtk" super(PyWebP, self).__init__(application_id=app_id) self.set_flags(Gio.ApplicationFlags.NON_UNIQUE) self.connect("activate", self.do_activate) self.connect...
class PyWebP(Gtk.Application):
""" Main Class """ def _init__(self): app_id = "com.github.tudo75.pywebp-gtk" super(PyWebP, self).__init__(application_id=app_id) self.set_flags(Gio.ApplicationFlags.NON_UNIQUE) self.connect("activate", self.do_activate) self.connect("destroy", self.do_shutdown) ...
of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR...
256
256
2,052
7
249
tudo75/PyWebP-Gtk
pywebp/app.py
Python
PyWebP
PyWebP
44
286
44
44
f6f278d86e34cc567419b5d3d66698e977e75f52
bigcode/the-stack
train
97fb10b47b7a0f3dd6aa5faa
train
class
class DBMixin: """ A mixin for tornado.web.Application to initialize and have convenience methods for database accesses. """ db = None # type: Gino async def init_db(self: [tornado.web.Application, "DBMixin"], db: Gino, **kwargs): await db.init_app(self, **kwargs)
class DBMixin:
""" A mixin for tornado.web.Application to initialize and have convenience methods for database accesses. """ db = None # type: Gino async def init_db(self: [tornado.web.Application, "DBMixin"], db: Gino, **kwargs): await db.init_app(self, **kwargs)
=database, ) await self.set_bind( dsn, echo=echo, min_size=pool_min_size, max_size=pool_max_size, ssl=ssl, loop=asyncio_loop, **kwargs, ) app.db = self class DBMixin:
64
64
74
4
59
ppsirg/gino-tornado
src/gino_tornado.py
Python
DBMixin
DBMixin
274
283
274
274
17e2a74818e18cddbf969dd3b76bbbdd1176a3e2
bigcode/the-stack
train
6c1225c63f2fcd183d250139
train
class
class Gino(_Gino): """ Base class for GINO database. Using this class as a metadata for your database adds an additional ``get_or_404()`` method to all of your table classes. """ model_base_classes = _Gino.model_base_classes + (TornadoModelMixin,) query_executor = GinoExecutor if typ...
class Gino(_Gino):
""" Base class for GINO database. Using this class as a metadata for your database adds an additional ``get_or_404()`` method to all of your table classes. """ model_base_classes = _Gino.model_base_classes + (TornadoModelMixin,) query_executor = GinoExecutor if typing.TYPE_CHECKING: ...
rv = await cls.get(*args, **kwargs) if rv is None: raise tornado.web.HTTPError(404) return rv class GinoExecutor(_Executor): async def first_or_404(self, *args, **kwargs): rv = await self.first(*args, **kwargs) if rv is None: raise tornado.web.HTTPEr...
232
232
776
7
225
ppsirg/gino-tornado
src/gino_tornado.py
Python
Gino
Gino
169
271
169
169
27dbe2a30f98bd3ada24c0ee7b3dc479536b251f
bigcode/the-stack
train
0ef221aedf363095b8ccf386
train
class
class RequestHandlerMixin: """ A mixin to provide convenience methods to access GINO object """ @property def db(self: tornado.web.RequestHandler) -> Gino: return self.application.db
class RequestHandlerMixin:
""" A mixin to provide convenience methods to access GINO object """ @property def db(self: tornado.web.RequestHandler) -> Gino: return self.application.db
initialize and have convenience methods for database accesses. """ db = None # type: Gino async def init_db(self: [tornado.web.Application, "DBMixin"], db: Gino, **kwargs): await db.init_app(self, **kwargs) class RequestHandlerMixin:
64
64
47
5
59
ppsirg/gino-tornado
src/gino_tornado.py
Python
RequestHandlerMixin
RequestHandlerMixin
286
293
286
286
5e7e378d02a4a2afe226f467b1082ede60c1e78b
bigcode/the-stack
train
6911cdd3d8f51a5695a96a83
train
class
class GinoExecutor(_Executor): async def first_or_404(self, *args, **kwargs): rv = await self.first(*args, **kwargs) if rv is None: raise tornado.web.HTTPError(404) return rv
class GinoExecutor(_Executor):
async def first_or_404(self, *args, **kwargs): rv = await self.first(*args, **kwargs) if rv is None: raise tornado.web.HTTPError(404) return rv
classmethod async def get_or_404(cls, *args, **kwargs): # noinspection PyUnresolvedReferences rv = await cls.get(*args, **kwargs) if rv is None: raise tornado.web.HTTPError(404) return rv class GinoExecutor(_Executor):
64
64
53
7
56
ppsirg/gino-tornado
src/gino_tornado.py
Python
GinoExecutor
GinoExecutor
135
140
135
135
7917bd40a50f6c69b478e5452c21ba25f23d5c78
bigcode/the-stack
train
eee15d4d1319c0890cb1bff9
train
class
class TornadoModelMixin: @classmethod async def get_or_404(cls, *args, **kwargs): # noinspection PyUnresolvedReferences rv = await cls.get(*args, **kwargs) if rv is None: raise tornado.web.HTTPError(404) return rv
class TornadoModelMixin: @classmethod
async def get_or_404(cls, *args, **kwargs): # noinspection PyUnresolvedReferences rv = await cls.get(*args, **kwargs) if rv is None: raise tornado.web.HTTPError(404) return rv
as _Connection, GinoEngine as _Engine from gino.strategies import GinoStrategy from sqlalchemy.engine.url import URL if tornado.version_info[0] < 5: raise Exception("Only Tornado 5 or later is supported") class TornadoModelMixin: @classmethod
64
64
65
10
54
ppsirg/gino-tornado
src/gino_tornado.py
Python
TornadoModelMixin
TornadoModelMixin
125
132
125
126
ff86254b55322c99e78b576a5710f27f417df348
bigcode/the-stack
train
16f5ea96a7d953d8ada67321
train
class
class GinoEngine(_Engine): connection_cls = GinoConnection async def first_or_404(self, *args, **kwargs): rv = await self.first(*args, **kwargs) if rv is None: raise tornado.web.HTTPError(404) return rv
class GinoEngine(_Engine):
connection_cls = GinoConnection async def first_or_404(self, *args, **kwargs): rv = await self.first(*args, **kwargs) if rv is None: raise tornado.web.HTTPError(404) return rv
return rv class GinoConnection(_Connection): async def first_or_404(self, *args, **kwargs): rv = await self.first(*args, **kwargs) if rv is None: raise tornado.web.HTTPError(404) return rv class GinoEngine(_Engine):
64
64
61
7
56
ppsirg/gino-tornado
src/gino_tornado.py
Python
GinoEngine
GinoEngine
151
158
151
151
0ab3533e9717a5a0df4c0af0b6ec6bd4a9ab139d
bigcode/the-stack
train
4e86a1f1cf9ad4f2b5fef384
train
class
class TornadoStrategy(GinoStrategy): name = "tornado" engine_cls = GinoEngine
class TornadoStrategy(GinoStrategy):
name = "tornado" engine_cls = GinoEngine
Engine): connection_cls = GinoConnection async def first_or_404(self, *args, **kwargs): rv = await self.first(*args, **kwargs) if rv is None: raise tornado.web.HTTPError(404) return rv class TornadoStrategy(GinoStrategy):
64
64
23
8
55
ppsirg/gino-tornado
src/gino_tornado.py
Python
TornadoStrategy
TornadoStrategy
161
163
161
161
fcdfc3acc9ed7a05bc4bc6d0d10f1749b45c428b
bigcode/the-stack
train
d773c237e66a23da2bd66eaa
train
class
class GinoConnection(_Connection): async def first_or_404(self, *args, **kwargs): rv = await self.first(*args, **kwargs) if rv is None: raise tornado.web.HTTPError(404) return rv
class GinoConnection(_Connection):
async def first_or_404(self, *args, **kwargs): rv = await self.first(*args, **kwargs) if rv is None: raise tornado.web.HTTPError(404) return rv
return rv class GinoExecutor(_Executor): async def first_or_404(self, *args, **kwargs): rv = await self.first(*args, **kwargs) if rv is None: raise tornado.web.HTTPError(404) return rv class GinoConnection(_Connection):
64
64
53
7
56
ppsirg/gino-tornado
src/gino_tornado.py
Python
GinoConnection
GinoConnection
143
148
143
143
2dcfd6c334933552b01b10e2970c80f9be68b115
bigcode/the-stack
train
828f9d65ca4a57673c9b2ca8
train
class
@DecoratedDecorator class table_append(OutputDecorator): # noqa: N801 def __init__(self, identifier: str, table_schema: TableSchema = None, options: dict = None): self.__identifier = identifier self.__table_schema = table_schema self.__options = options or {} def process_result(self, r...
@DecoratedDecorator class table_append(OutputDecorator): # noqa: N801
def __init__(self, identifier: str, table_schema: TableSchema = None, options: dict = None): self.__identifier = identifier self.__table_schema = table_schema self.__options = options or {} def process_result(self, result: DataFrame, container: ContainerInterface): table_definit...
.sql import DataFrame from datalakebundle.table.create.TableDefinitionFactory import TableDefinitionFactory from datalakebundle.table.schema.TableSchema import TableSchema from datalakebundle.table.write.TableAppender import TableAppender @DecoratedDecorator class table_append(OutputDecorator): # noqa: N801
64
64
177
18
45
bricksflow/datalake-bundle
src/datalakebundle/table/write/table_append.py
Python
table_append
table_append
10
26
10
11
f29a315a7bac2ef89a9240b2b1848da2f51d946a
bigcode/the-stack
train
e86f3eb1d71595c1c2f54ed9
train
function
@register_model def seresnext50_32x4d(pretrained=False, num_classes=1000, in_chans=3, **kwargs): default_cfg = default_cfgs['seresnext50_32x4d'] model = SENet(SEResNeXtBottleneck, [3, 4, 6, 3], groups=32, reduction=16, inplanes=64, input_3x3=False, downsample_kernel_size=1, d...
@register_model def seresnext50_32x4d(pretrained=False, num_classes=1000, in_chans=3, **kwargs):
default_cfg = default_cfgs['seresnext50_32x4d'] model = SENet(SEResNeXtBottleneck, [3, 4, 6, 3], groups=32, reduction=16, inplanes=64, input_3x3=False, downsample_kernel_size=1, downsample_padding=0, num_classes=num_classes, in_chans=in_chans, **kwargs) ...
model.default_cfg = default_cfg if pretrained: load_pretrained(model, default_cfg, num_classes, in_chans) return model @register_model def seresnext50_32x4d(pretrained=False, num_classes=1000, in_chans=3, **kwargs):
64
64
159
32
31
ptklx/segmentation_models.pytorch
my_timm/models/senet.py
Python
seresnext50_32x4d
seresnext50_32x4d
488
498
488
489
b1e2d2370368531b5c2278b11ce48afdfc096c12
bigcode/the-stack
train
74005becdb567f90f669b3e3
train
function
@register_model def seresnet34(pretrained=False, num_classes=1000, in_chans=3, **kwargs): default_cfg = default_cfgs['seresnet34'] model = SENet(SEResNetBlock, [3, 4, 6, 3], groups=1, reduction=16, inplanes=64, input_3x3=False, downsample_kernel_size=1, downsample_padding=0, ...
@register_model def seresnet34(pretrained=False, num_classes=1000, in_chans=3, **kwargs):
default_cfg = default_cfgs['seresnet34'] model = SENet(SEResNetBlock, [3, 4, 6, 3], groups=1, reduction=16, inplanes=64, input_3x3=False, downsample_kernel_size=1, downsample_padding=0, num_classes=num_classes, in_chans=in_chans, **kwargs) model.default_...
ans, **kwargs) model.default_cfg = default_cfg if pretrained: load_pretrained(model, default_cfg, num_classes, in_chans) return model @register_model def seresnet34(pretrained=False, num_classes=1000, in_chans=3, **kwargs):
64
64
146
27
36
ptklx/segmentation_models.pytorch
my_timm/models/senet.py
Python
seresnet34
seresnet34
412
422
412
413
3556aaada1eb4a04825fa21d8284addae9a610e0
bigcode/the-stack
train
5736529a595d770c75152fbe
train
class
class SEResNetBottleneck(Bottleneck): """ ResNet bottleneck with a Squeeze-and-Excitation module. It follows Caffe implementation and uses `stride=stride` in `conv1` and not in `conv2` (the latter is used in the torchvision implementation of ResNet). """ expansion = 4 def __init__(self, inp...
class SEResNetBottleneck(Bottleneck):
""" ResNet bottleneck with a Squeeze-and-Excitation module. It follows Caffe implementation and uses `stride=stride` in `conv1` and not in `conv2` (the latter is used in the torchvision implementation of ResNet). """ expansion = 4 def __init__(self, inplanes, planes, groups, reduction, stri...
4, planes * 4, kernel_size=1, bias=False) self.bn3 = nn.BatchNorm2d(planes * 4) self.relu = nn.ReLU(inplace=True) self.se_module = SEModule(planes * 4, reduction=reduction) self.downsample = downsample self.stride = stride class SEResNetBottleneck(Bottleneck):
84
84
283
11
72
ptklx/segmentation_models.pytorch
my_timm/models/senet.py
Python
SEResNetBottleneck
SEResNetBottleneck
141
163
141
141
b62e2743fbf3f359816543101c03ce05011d8f0d
bigcode/the-stack
train
52ba3506de55f538f18e32d1
train
class
class Bottleneck(nn.Module): """ Base class for bottlenecks that implements `forward()` method. """ def forward(self, x): residual = x out = self.conv1(x) out = self.bn1(out) out = self.relu(out) out = self.conv2(out) out = self.bn2(out) out = s...
class Bottleneck(nn.Module):
""" Base class for bottlenecks that implements `forward()` method. """ def forward(self, x): residual = x out = self.conv1(x) out = self.bn1(out) out = self.relu(out) out = self.conv2(out) out = self.bn2(out) out = self.relu(out) out = ...
def forward(self, x): module_input = x x = self.avg_pool(x) x = self.fc1(x) x = self.relu(x) x = self.fc2(x) x = self.sigmoid(x) return module_input * x class Bottleneck(nn.Module):
64
64
137
6
57
ptklx/segmentation_models.pytorch
my_timm/models/senet.py
Python
Bottleneck
Bottleneck
89
114
89
89
6988cbd1ec43dc6fe43e72aff6a72579db777677
bigcode/the-stack
train
e46f13f265445b0c349db867
train
function
@register_model def senet154(pretrained=False, num_classes=1000, in_chans=3, **kwargs): default_cfg = default_cfgs['senet154'] model = SENet(SEBottleneck, [3, 8, 36, 3], groups=64, reduction=16, num_classes=num_classes, in_chans=in_chans, **kwargs) model.default_cfg = default_cfg if pr...
@register_model def senet154(pretrained=False, num_classes=1000, in_chans=3, **kwargs):
default_cfg = default_cfgs['senet154'] model = SENet(SEBottleneck, [3, 8, 36, 3], groups=64, reduction=16, num_classes=num_classes, in_chans=in_chans, **kwargs) model.default_cfg = default_cfg if pretrained: load_pretrained(model, default_cfg, num_classes, in_chans) return ...
ans, **kwargs) model.default_cfg = default_cfg if pretrained: load_pretrained(model, default_cfg, num_classes, in_chans) return model @register_model def senet154(pretrained=False, num_classes=1000, in_chans=3, **kwargs):
64
64
117
27
36
ptklx/segmentation_models.pytorch
my_timm/models/senet.py
Python
senet154
senet154
464
472
464
465
01cd77245e5e3405d92d96815f52649fc8d519eb
bigcode/the-stack
train
3b6c9c68962080d4bc4e9d73
train
function
@register_model def seresnet101(pretrained=False, num_classes=1000, in_chans=3, **kwargs): default_cfg = default_cfgs['seresnet101'] model = SENet(SEResNetBottleneck, [3, 4, 23, 3], groups=1, reduction=16, inplanes=64, input_3x3=False, downsample_kernel_size=1, downsample_pad...
@register_model def seresnet101(pretrained=False, num_classes=1000, in_chans=3, **kwargs):
default_cfg = default_cfgs['seresnet101'] model = SENet(SEResNetBottleneck, [3, 4, 23, 3], groups=1, reduction=16, inplanes=64, input_3x3=False, downsample_kernel_size=1, downsample_padding=0, num_classes=num_classes, in_chans=in_chans, **kwargs) model.d...
ans, **kwargs) model.default_cfg = default_cfg if pretrained: load_pretrained(model, default_cfg, num_classes, in_chans) return model @register_model def seresnet101(pretrained=False, num_classes=1000, in_chans=3, **kwargs):
64
64
148
27
36
ptklx/segmentation_models.pytorch
my_timm/models/senet.py
Python
seresnet101
seresnet101
438
448
438
439
b0e7d4da189187e7122466a196a24b5a7e4ea3f1
bigcode/the-stack
train
57257a2dd9b0fbbdd486fa5a
train
function
@register_model def seresnext26_32x4d(pretrained=False, num_classes=1000, in_chans=3, **kwargs): default_cfg = default_cfgs['seresnext26_32x4d'] model = SENet(SEResNeXtBottleneck, [2, 2, 2, 2], groups=32, reduction=16, inplanes=64, input_3x3=False, downsample_kernel_size=1, d...
@register_model def seresnext26_32x4d(pretrained=False, num_classes=1000, in_chans=3, **kwargs):
default_cfg = default_cfgs['seresnext26_32x4d'] model = SENet(SEResNeXtBottleneck, [2, 2, 2, 2], groups=32, reduction=16, inplanes=64, input_3x3=False, downsample_kernel_size=1, downsample_padding=0, num_classes=num_classes, in_chans=in_chans, **kwargs) ...
model.default_cfg = default_cfg if pretrained: load_pretrained(model, default_cfg, num_classes, in_chans) return model @register_model def seresnext26_32x4d(pretrained=False, num_classes=1000, in_chans=3, **kwargs):
64
64
159
32
31
ptklx/segmentation_models.pytorch
my_timm/models/senet.py
Python
seresnext26_32x4d
seresnext26_32x4d
475
485
475
476
8fd831494960c8e804c0b79093e44b061035a209
bigcode/the-stack
train
0cd246ee83976bb68832a3f3
train
function
def _cfg(url='', **kwargs): return { 'url': url, 'num_classes': 1000, 'input_size': (3, 224, 224), 'pool_size': (7, 7), 'crop_pct': 0.875, 'interpolation': 'bilinear', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'layer0.conv1', 'classifier': 'last_linear...
def _cfg(url='', **kwargs):
return { 'url': url, 'num_classes': 1000, 'input_size': (3, 224, 224), 'pool_size': (7, 7), 'crop_pct': 0.875, 'interpolation': 'bilinear', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'layer0.conv1', 'classifier': 'last_linear', **kwargs }
as F from .registry import register_model from .helpers import load_pretrained from .layers import SelectAdaptivePool2d from my_timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD __all__ = ['SENet'] def _cfg(url='', **kwargs):
64
64
110
8
56
ptklx/segmentation_models.pytorch
my_timm/models/senet.py
Python
_cfg
_cfg
25
32
25
25
76bcc35b3f07ccd49dd21092ddbb60034a1d476f
bigcode/the-stack
train
4b45616d03de5cffe18627e4
train
class
class SENet(nn.Module): def __init__(self, block, layers, groups, reduction, drop_rate=0.2, in_chans=3, inplanes=128, input_3x3=True, downsample_kernel_size=3, downsample_padding=1, num_classes=1000, global_pool='avg'): """ Parameters ---------- blo...
class SENet(nn.Module):
def __init__(self, block, layers, groups, reduction, drop_rate=0.2, in_chans=3, inplanes=128, input_3x3=True, downsample_kernel_size=3, downsample_padding=1, num_classes=1000, global_pool='avg'): """ Parameters ---------- block (nn.Module): Bottlenec...
, groups, reduction, stride=1, downsample=None): super(SEResNetBlock, self).__init__() self.conv1 = nn.Conv2d( inplanes, planes, kernel_size=3, padding=1, stride=stride, bias=False) self.bn1 = nn.BatchNorm2d(planes) self.conv2 = nn.Conv2d( planes, planes, kernel_s...
256
256
1,624
6
249
ptklx/segmentation_models.pytorch
my_timm/models/senet.py
Python
SENet
SENet
226
396
226
227
e3dd92940884a712de75b185ae7634a7ecc9623a
bigcode/the-stack
train
75fc04ebfd266e731aba28cc
train
function
@register_model def seresnet152(pretrained=False, num_classes=1000, in_chans=3, **kwargs): default_cfg = default_cfgs['seresnet152'] model = SENet(SEResNetBottleneck, [3, 8, 36, 3], groups=1, reduction=16, inplanes=64, input_3x3=False, downsample_kernel_size=1, downsample_pad...
@register_model def seresnet152(pretrained=False, num_classes=1000, in_chans=3, **kwargs):
default_cfg = default_cfgs['seresnet152'] model = SENet(SEResNetBottleneck, [3, 8, 36, 3], groups=1, reduction=16, inplanes=64, input_3x3=False, downsample_kernel_size=1, downsample_padding=0, num_classes=num_classes, in_chans=in_chans, **kwargs) model.d...
ans, **kwargs) model.default_cfg = default_cfg if pretrained: load_pretrained(model, default_cfg, num_classes, in_chans) return model @register_model def seresnet152(pretrained=False, num_classes=1000, in_chans=3, **kwargs):
64
64
148
27
36
ptklx/segmentation_models.pytorch
my_timm/models/senet.py
Python
seresnet152
seresnet152
451
461
451
452
29ab01d9fd11b8ba85634938ecccd8117dc2cf0e
bigcode/the-stack
train
1aa53c3bb4fc4e4d374c6630
train
class
class SEModule(nn.Module): def __init__(self, channels, reduction): super(SEModule, self).__init__() self.avg_pool = nn.AdaptiveAvgPool2d(1) self.fc1 = nn.Conv2d( channels, channels // reduction, kernel_size=1, padding=0) self.relu = nn.ReLU(inplace=True) self.fc...
class SEModule(nn.Module):
def __init__(self, channels, reduction): super(SEModule, self).__init__() self.avg_pool = nn.AdaptiveAvgPool2d(1) self.fc1 = nn.Conv2d( channels, channels // reduction, kernel_size=1, padding=0) self.relu = nn.ReLU(inplace=True) self.fc2 = nn.Conv2d( c...
d): nn.init.kaiming_normal_(m.weight, mode='fan_out', nonlinearity='relu') elif isinstance(m, nn.BatchNorm2d): nn.init.constant_(m.weight, 1.) nn.init.constant_(m.bias, 0.) class SEModule(nn.Module):
63
64
172
6
57
ptklx/segmentation_models.pytorch
my_timm/models/senet.py
Python
SEModule
SEModule
67
86
67
68
309d26c2e9563cb785a11bf83234e394f1542e1d
bigcode/the-stack
train
87e4076e2f43fe248cb85ae9
train
class
class SEBottleneck(Bottleneck): """ Bottleneck for SENet154. """ expansion = 4 def __init__(self, inplanes, planes, groups, reduction, stride=1, downsample=None): super(SEBottleneck, self).__init__() self.conv1 = nn.Conv2d(inplanes, planes * 2, kernel_size=1, bias=F...
class SEBottleneck(Bottleneck):
""" Bottleneck for SENet154. """ expansion = 4 def __init__(self, inplanes, planes, groups, reduction, stride=1, downsample=None): super(SEBottleneck, self).__init__() self.conv1 = nn.Conv2d(inplanes, planes * 2, kernel_size=1, bias=False) self.bn1 = nn.Batc...
2(out) out = self.relu(out) out = self.conv3(out) out = self.bn3(out) if self.downsample is not None: residual = self.downsample(x) out = self.se_module(out) + residual out = self.relu(out) return out class SEBottleneck(Bottleneck):
74
74
249
9
64
ptklx/segmentation_models.pytorch
my_timm/models/senet.py
Python
SEBottleneck
SEBottleneck
117
138
117
117
5681f3369f85ff1c365e5eaa73a101ec57c53f4e
bigcode/the-stack
train
1fb3c2b60927e748983aece8
train
function
@register_model def seresnet50(pretrained=False, num_classes=1000, in_chans=3, **kwargs): default_cfg = default_cfgs['seresnet50'] model = SENet(SEResNetBottleneck, [3, 4, 6, 3], groups=1, reduction=16, inplanes=64, input_3x3=False, downsample_kernel_size=1, downsample_paddin...
@register_model def seresnet50(pretrained=False, num_classes=1000, in_chans=3, **kwargs):
default_cfg = default_cfgs['seresnet50'] model = SENet(SEResNetBottleneck, [3, 4, 6, 3], groups=1, reduction=16, inplanes=64, input_3x3=False, downsample_kernel_size=1, downsample_padding=0, num_classes=num_classes, in_chans=in_chans, **kwargs) model.def...
ans, **kwargs) model.default_cfg = default_cfg if pretrained: load_pretrained(model, default_cfg, num_classes, in_chans) return model @register_model def seresnet50(pretrained=False, num_classes=1000, in_chans=3, **kwargs):
64
64
148
27
36
ptklx/segmentation_models.pytorch
my_timm/models/senet.py
Python
seresnet50
seresnet50
425
435
425
426
7600dba017c1b41d3b8e5ac9b2aa2abf1fe2c7e5
bigcode/the-stack
train
cd4f210b489ede500d17f351
train
class
class SEResNetBlock(nn.Module): expansion = 1 def __init__(self, inplanes, planes, groups, reduction, stride=1, downsample=None): super(SEResNetBlock, self).__init__() self.conv1 = nn.Conv2d( inplanes, planes, kernel_size=3, padding=1, stride=stride, bias=False) self.bn1 = n...
class SEResNetBlock(nn.Module):
expansion = 1 def __init__(self, inplanes, planes, groups, reduction, stride=1, downsample=None): super(SEResNetBlock, self).__init__() self.conv1 = nn.Conv2d( inplanes, planes, kernel_size=3, padding=1, stride=stride, bias=False) self.bn1 = nn.BatchNorm2d(planes) se...
d(width, planes * 4, kernel_size=1, bias=False) self.bn3 = nn.BatchNorm2d(planes * 4) self.relu = nn.ReLU(inplace=True) self.se_module = SEModule(planes * 4, reduction=reduction) self.downsample = downsample self.stride = stride class SEResNetBlock(nn.Module):
82
82
275
8
73
ptklx/segmentation_models.pytorch
my_timm/models/senet.py
Python
SEResNetBlock
SEResNetBlock
190
223
190
190
7cce64c037c4d44efc659f109c99ca4404cbd936
bigcode/the-stack
train
ea236d3135445e430a879a3b
train
function
def _weight_init(m): if isinstance(m, nn.Conv2d): nn.init.kaiming_normal_(m.weight, mode='fan_out', nonlinearity='relu') elif isinstance(m, nn.BatchNorm2d): nn.init.constant_(m.weight, 1.) nn.init.constant_(m.bias, 0.)
def _weight_init(m):
if isinstance(m, nn.Conv2d): nn.init.kaiming_normal_(m.weight, mode='fan_out', nonlinearity='relu') elif isinstance(m, nn.BatchNorm2d): nn.init.constant_(m.weight, 1.) nn.init.constant_(m.bias, 0.)
b3a4.pth'), 'seresnext101_32x4d': _cfg(url='http://data.lip6.fr/cadene/pretrainedmodels/se_resnext101_32x4d-3b2fe3d8.pth'), } def _weight_init(m):
64
64
71
6
58
ptklx/segmentation_models.pytorch
my_timm/models/senet.py
Python
_weight_init
_weight_init
59
64
59
59
a1a6fd7fc7a376337f953c911fb50114df13e07e
bigcode/the-stack
train
389d51356e9f7285a6cf157a
train
function
@register_model def seresnet18(pretrained=False, num_classes=1000, in_chans=3, **kwargs): default_cfg = default_cfgs['seresnet18'] model = SENet(SEResNetBlock, [2, 2, 2, 2], groups=1, reduction=16, inplanes=64, input_3x3=False, downsample_kernel_size=1, downsample_padding=0, ...
@register_model def seresnet18(pretrained=False, num_classes=1000, in_chans=3, **kwargs):
default_cfg = default_cfgs['seresnet18'] model = SENet(SEResNetBlock, [2, 2, 2, 2], groups=1, reduction=16, inplanes=64, input_3x3=False, downsample_kernel_size=1, downsample_padding=0, num_classes=num_classes, in_chans=in_chans, **kwargs) model.default_...
= self.last_linear(x) return x def forward(self, x): x = self.forward_features(x) x = self.logits(x) return x @register_model def seresnet18(pretrained=False, num_classes=1000, in_chans=3, **kwargs):
64
64
146
27
36
ptklx/segmentation_models.pytorch
my_timm/models/senet.py
Python
seresnet18
seresnet18
399
409
399
400
4bb973040482471b7b1501e8e87edce215603ee7
bigcode/the-stack
train
9705ded8ce6e3fa0fa389907
train
class
class SEResNeXtBottleneck(Bottleneck): """ ResNeXt bottleneck type C with a Squeeze-and-Excitation module. """ expansion = 4 def __init__(self, inplanes, planes, groups, reduction, stride=1, downsample=None, base_width=4): super(SEResNeXtBottleneck, self).__init__() ...
class SEResNeXtBottleneck(Bottleneck):
""" ResNeXt bottleneck type C with a Squeeze-and-Excitation module. """ expansion = 4 def __init__(self, inplanes, planes, groups, reduction, stride=1, downsample=None, base_width=4): super(SEResNeXtBottleneck, self).__init__() width = math.floor(planes * (base_widt...
4, kernel_size=1, bias=False) self.bn3 = nn.BatchNorm2d(planes * 4) self.relu = nn.ReLU(inplace=True) self.se_module = SEModule(planes * 4, reduction=reduction) self.downsample = downsample self.stride = stride class SEResNeXtBottleneck(Bottleneck):
81
81
272
12
68
ptklx/segmentation_models.pytorch
my_timm/models/senet.py
Python
SEResNeXtBottleneck
SEResNeXtBottleneck
166
187
166
166
323bf2c5c7c3714211ad2b71b841e08b9d0dba1a
bigcode/the-stack
train
ee711b83e4f953872a86e6b6
train
function
@register_model def seresnext101_32x4d(pretrained=False, num_classes=1000, in_chans=3, **kwargs): default_cfg = default_cfgs['seresnext101_32x4d'] model = SENet(SEResNeXtBottleneck, [3, 4, 23, 3], groups=32, reduction=16, inplanes=64, input_3x3=False, downsample_kernel_size=1...
@register_model def seresnext101_32x4d(pretrained=False, num_classes=1000, in_chans=3, **kwargs):
default_cfg = default_cfgs['seresnext101_32x4d'] model = SENet(SEResNeXtBottleneck, [3, 4, 23, 3], groups=32, reduction=16, inplanes=64, input_3x3=False, downsample_kernel_size=1, downsample_padding=0, num_classes=num_classes, in_chans=in_chans, **kwargs) ...
model.default_cfg = default_cfg if pretrained: load_pretrained(model, default_cfg, num_classes, in_chans) return model @register_model def seresnext101_32x4d(pretrained=False, num_classes=1000, in_chans=3, **kwargs):
64
64
159
32
31
ptklx/segmentation_models.pytorch
my_timm/models/senet.py
Python
seresnext101_32x4d
seresnext101_32x4d
501
511
501
502
e079727e705474dd32b28b6d011291c13d4b7f12
bigcode/the-stack
train
260a8204fadf5527b6424be2
train
class
class ErrorCodes(type): """Metaclass for :class:`APIError` documenting error codes.""" _CODES = { 0: 'Invalid command parameters number', 1: 'The specified passphrase is blank.', 2: 'The address version number currently must be 3, 4, or 0' ' (which means auto-select).', 3...
class ErrorCodes(type):
"""Metaclass for :class:`APIError` documenting error codes.""" _CODES = { 0: 'Invalid command parameters number', 1: 'The specified passphrase is blank.', 2: 'The address version number currently must be 3, 4, or 0' ' (which means auto-select).', 3: 'The stream number mus...
fwork import queues import shared import shutdown import state from addresses import ( addBMIfNotPresent, calculateInventoryHash, decodeAddress, decodeVarint, varintDecodeError ) from bmconfigparser import BMConfigParser from debug import logger from helper_sql import SqlBulkExecute, sqlExecute, sql...
184
185
617
5
179
vishalbelsare/PyBitmessage
src/api.py
Python
ErrorCodes
ErrorCodes
111
162
111
111
df1c737a177cef6f7e2ff98dcb15501ad737ca0c
bigcode/the-stack
train
4d9e1623f8af20a2c14f4010
train
class
class CommandHandler(type): """ The metaclass for `BMRPCDispatcher` which fills _handlers dict by methods decorated with @command """ def __new__(mcs, name, bases, namespace): # pylint: disable=protected-access result = super(CommandHandler, mcs).__new__( mcs, name, bases...
class CommandHandler(type):
""" The metaclass for `BMRPCDispatcher` which fills _handlers dict by methods decorated with @command """ def __new__(mcs, name, bases, namespace): # pylint: disable=protected-access result = super(CommandHandler, mcs).__new__( mcs, name, bases, namespace) result....
Up"]) except OSError: logger.warning( 'Failed to call %s, removing apinotifypath setting', apiNotifyPath) BMConfigParser().remove_option( 'bitmessagesettings', 'apinotifypath') se.serve_forever() class Comma...
64
64
185
5
59
vishalbelsare/PyBitmessage
src/api.py
Python
CommandHandler
CommandHandler
280
304
280
280
8a5c6feae95765bcb5fc99a1939e0737031f1b1b
bigcode/the-stack
train
8a7e32f9cd568610be9fdbd5
train
class
class BMRPCDispatcher(object): """This class is used to dispatch API commands""" __metaclass__ = CommandHandler @staticmethod def _decode(text, decode_type): try: if decode_type == 'hex': return unhexlify(text) elif decode_type == 'base64': ...
class BMRPCDispatcher(object):
"""This class is used to dispatch API commands""" __metaclass__ = CommandHandler @staticmethod def _decode(text, decode_type): try: if decode_type == 'hex': return unhexlify(text) elif decode_type == 'base64': return base64.b64decode(text)...
if self.cookies: for cookie in self.cookies: self.send_header('Set-Cookie', cookie.output(header='')) # HACK :end self.end_headers() self.wfile.write(response) # shut down the connection self.wfile.flush() ...
256
256
9,693
7
248
vishalbelsare/PyBitmessage
src/api.py
Python
BMRPCDispatcher
BMRPCDispatcher
461
1,537
461
461
5c7aefb2fb2cdd5a16b92d8bac83116b089da29f
bigcode/the-stack
train
ccdea243fed36a612adcc189
train
class
class APIError(xmlrpclib.Fault): """ APIError exception class .. list-table:: Possible error values :header-rows: 1 :widths: auto * - Error Number - Message """ __metaclass__ = ErrorCodes def __str__(self): return "API Error %04i: %s" % (self.faultCode, s...
class APIError(xmlrpclib.Fault):
""" APIError exception class .. list-table:: Possible error values :header-rows: 1 :widths: auto * - Error Number - Message """ __metaclass__ = ErrorCodes def __str__(self): return "API Error %04i: %s" % (self.faultCode, self.faultString)
, namespace) for code in mcs._CODES.iteritems(): # beware: the formatting is adjusted for list-table result.__doc__ += """ * - %04i - %s """ % code return result class APIError(xmlrpclib.Fault):
64
64
95
10
53
vishalbelsare/PyBitmessage
src/api.py
Python
APIError
APIError
165
179
165
165
0f46ee6a9430249da15481d481e2a214a064e5ed
bigcode/the-stack
train
0b0626453a2b84b9867ea433
train
class
class singleAPI(StoppableThread): """API thread""" name = "singleAPI" def stopThread(self): super(singleAPI, self).stopThread() s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: s.connect(( BMConfigParser().get('bitmessagesettings', 'apiinterfac...
class singleAPI(StoppableThread):
"""API thread""" name = "singleAPI" def stopThread(self): super(singleAPI, self).stopThread() s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: s.connect(( BMConfigParser().get('bitmessagesettings', 'apiinterface'), BMConfigParse...
27: 'Message is too long.' } def __new__(mcs, name, bases, namespace): result = super(ErrorCodes, mcs).__new__(mcs, name, bases, namespace) for code in mcs._CODES.iteritems(): # beware: the formatting is adjusted for list-table result.__doc__ += """ * - %04i -...
213
213
713
7
206
vishalbelsare/PyBitmessage
src/api.py
Python
singleAPI
singleAPI
183
277
183
183
320d6130ada136a2b23e2afa3ba719af97511446
bigcode/the-stack
train
f7cfb8f9038bd71218775629
train
class
class command(object): # pylint: disable=too-few-public-methods """Decorator for API command method""" def __init__(self, *aliases): self.aliases = aliases def __call__(self, func): if BMConfigParser().safeGet( 'bitmessagesettings', 'apivariant') == 'legacy': d...
class command(object): # pylint: disable=too-few-public-methods
"""Decorator for API command method""" def __init__(self, *aliases): self.aliases = aliases def __call__(self, func): if BMConfigParser().safeGet( 'bitmessagesettings', 'apivariant') == 'legacy': def wrapper(*args): """ A wrapper ...
self.aliases = aliases def __call__(self, func): """Testmode call method""" if not state.testmode: return None return command(self.aliases[0]).__call__(func) class command(object): # pylint: disable=too-few-public-methods
64
64
205
17
47
vishalbelsare/PyBitmessage
src/api.py
Python
command
command
321
346
321
321
5c7446966a147607340b74776c44f6acef77a38c
bigcode/the-stack
train