code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class RandomZoomTransformer(BaseSequenceTransformer): <NEW_LINE> <INDENT> def __init__(self, zoom_range): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.zoom_range = zoom_range <NEW_LINE> self.transformation = random_zoom <NEW_LINE> <DEDENT> def get_args(self): <NEW_LINE> <INDENT> if self.zoom_range[0] == 1 and... | Transformer to do random zoom.
# Arguments
zoom_range: Tuple of floats; zoom range for width and height. | 62598fa6cc0a2c111447aef5 |
class User(): <NEW_LINE> <INDENT> __password = None <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self.id = str(uuid.uuid4()) <NEW_LINE> <DEDENT> @property <NEW_LINE> def password(self): <NEW_LINE> <INDENT> return self.__password <NEW_LINE> <DEDENT> @password.setter <NEW_LINE> def password(self, pwd): <NEW_LINE> <... | User class:
- id: public string unique (uuid)
- password: private string hash in MD5 | 62598fa68a43f66fc4bf2062 |
class ApiError(Model): <NEW_LINE> <INDENT> _attribute_map = { 'details': {'key': 'details', 'type': '[ApiErrorBase]'}, 'innererror': {'key': 'innererror', 'type': 'InnerError'}, 'code': {'key': 'code', 'type': 'str'}, 'target': {'key': 'target', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, } <NEW_LINE>... | Api error.
:param details: The Api error details
:type details:
list[~azure.mgmt.compute.v2016_04_30_preview.models.ApiErrorBase]
:param innererror: The Api inner error
:type innererror:
~azure.mgmt.compute.v2016_04_30_preview.models.InnerError
:param code: The error code.
:type code: str
:param target: The target o... | 62598fa63539df3088ecc19a |
class AdaptiveMetropolisLearnScale(AdaptiveMetropolis): <NEW_LINE> <INDENT> is_symmetric=True <NEW_LINE> adapt_scale = True <NEW_LINE> def __init__(self, distribution, mean_est=None, cov_est=None, sample_discard=500, sample_lag=20, accstar=0.234): <NEW_LINE> <INDENT> AdaptiveMetropolis._... | Plain Adaptive Metropolis by Haario et al
adapt_scale=True adapts scaling to reach "optimal acceptance rate" | 62598fa623849d37ff850f9a |
class ComparisonTestFramework(BitcoinTestFramework): <NEW_LINE> <INDENT> def set_test_params(self): <NEW_LINE> <INDENT> self.num_nodes = 2 <NEW_LINE> self.setup_clean_chain = True <NEW_LINE> <DEDENT> def add_options(self, parser): <NEW_LINE> <INDENT> parser.add_option("--testbinary", dest="testbinary", default=os.geten... | Test framework for doing p2p comparison testing
Sets up some donud binaries:
- 1 binary: test binary
- 2 binaries: 1 test binary, 1 ref binary
- n>2 binaries: 1 test binary, n-1 ref binaries | 62598fa6dd821e528d6d8e1b |
class Rotate(object): <NEW_LINE> <INDENT> def __init__(self, angle): <NEW_LINE> <INDENT> self.angle = angle <NEW_LINE> <DEDENT> def __call__(self, img, bboxes): <NEW_LINE> <INDENT> angle = self.angle <NEW_LINE> w,h = img.shape[1], img.shape[0] <NEW_LINE> cx, cy = w//2, h//2 <NEW_LINE> corners = get_corners(bboxes) <NEW... | Rotates an image
Bounding boxes which have an area of less than 25% in the remaining in the
transformed image is dropped. The resolution is maintained, and the remaining
area if any is filled by black color.
Parameters
----------
angle: float
The angle by which the image is to be rotated
Returns
... | 62598fa699cbb53fe6830dbb |
class DocFeaturizer(object): <NEW_LINE> <INDENT> def __init__(self, vocab_embedding): <NEW_LINE> <INDENT> self.ve = vocab_embedding <NEW_LINE> <DEDENT> def doc2embedding(self, doc): <NEW_LINE> <INDENT> return pd.DataFrame({'order': range(len(doc))}, index=doc ).join(self.ve, how='left').sort_values('order').drop('order... | Methods to derive numerical features for a tokenized document (i.e. a list of strings) | 62598fa6b7558d5895463515 |
class QuestionSuggestionAdmin(admin.ModelAdmin): <NEW_LINE> <INDENT> list_display = ["__str__", "author_email", "created_at"] <NEW_LINE> ordering = ["created_at"] <NEW_LINE> actions = ["make_published"] <NEW_LINE> def get_queryset(self, request: HttpRequest) -> QuerySet: <NEW_LINE> <INDENT> qs = super().get_queryset(re... | Admin model for question suggestion category. | 62598fa676e4537e8c3ef492 |
class CopyGenerator(nn.Module): <NEW_LINE> <INDENT> def __init__(self, output_size, input_size, pad_idx): <NEW_LINE> <INDENT> super(CopyGenerator, self).__init__() <NEW_LINE> self.linear = nn.Linear(input_size, output_size) <NEW_LINE> self.linear_copy = nn.Linear(input_size, 1) <NEW_LINE> self.softmax = nn.LogSoftmax(d... | An implementation of pointer-generator networks
:cite:`DBLP:journals/corr/SeeLM17`.
These networks consider copying words
directly from the source sequence.
The copy generator is an extended version of the standard
generator that computes three values.
* :math:`p_{softmax}` the standard softmax over `tgt_dict`
* :math:... | 62598fa6bd1bec0571e15036 |
class DataBase(Base): <NEW_LINE> <INDENT> __abstract__ = True <NEW_LINE> @declared_attr <NEW_LINE> def __tablename__(cls): <NEW_LINE> <INDENT> return cls.__name__.lower() <NEW_LINE> <DEDENT> id = Column(Integer, primary_key=True) <NEW_LINE> def as_dictionary(self): <NEW_LINE> <INDENT> return { column.name : getattr(se... | A mixin class for nebulous SQLAlchemy objects. | 62598fa67d847024c075c2ab |
class TwitterSearchRequest(Request): <NEW_LINE> <INDENT> def __init__(self, *args: Any, q: str, max_id: Optional[str] = None, **kwargs: Any) -> None: <NEW_LINE> <INDENT> self.q = q <NEW_LINE> self.max_id = max_id <NEW_LINE> super(TwitterSearchRequest, self).__init__('http://twitter.com', *args, dont_filter=True, **kwar... | Request adapter for search requests | 62598fa6adb09d7d5dc0a471 |
class Average(VariableAccumulation): <NEW_LINE> <INDENT> def __init__(self, output_transform: Callable = lambda x: x, device: Optional[Union[str, torch.device]] = 'cpu'): <NEW_LINE> <INDENT> def _mean_op(a, x): <NEW_LINE> <INDENT> if isinstance(x, torch.Tensor) and x.ndim > 1: <NEW_LINE> <INDENT> x = x.sum(dim=0) <NEW_... | Helper class to compute arithmetic average of a single variable.
- ``update`` must receive output of the form `x`.
- `x` can be a number or `torch.Tensor`.
Note:
Number of samples is updated following the rule:
- `+1` if input is a number
- `+1` if input is a 1D `torch.Tensor`
- `+batch_size` if input i... | 62598fa6e5267d203ee6b7f2 |
class LookupError(bb.Union): <NEW_LINE> <INDENT> _catch_all = 'other' <NEW_LINE> not_found = None <NEW_LINE> not_file = None <NEW_LINE> not_folder = None <NEW_LINE> restricted_content = None <NEW_LINE> other = None <NEW_LINE> @classmethod <NEW_LINE> def malformed_path(cls, val): <NEW_LINE> <INDENT> return cls('malforme... | This class acts as a tagged union. Only one of the ``is_*`` methods will
return true. To get the associated value of a tag (if one exists), use the
corresponding ``get_*`` method.
:ivar file_properties.LookupError.not_found: There is nothing at the given
path.
:ivar file_properties.LookupError.not_file: We were ex... | 62598fa6627d3e7fe0e06d93 |
class FileNotFoundInSuccessor(Exception): <NEW_LINE> <INDENT> def __init__(self, **args): <NEW_LINE> <INDENT> self.msg = 'FILE WAS NOT FOUND IN SUCCESSOR' <NEW_LINE> super(self.__class__, self).__init__(self.msg) | To be raised if a file is no longer traceable for whatever reason. | 62598fa62c8b7c6e89bd36ac |
class NudgeAxis(object): <NEW_LINE> <INDENT> def __init__(self, origin, length, targets): <NEW_LINE> <INDENT> super(NudgeAxis, self).__init__() <NEW_LINE> self.origin = origin <NEW_LINE> self.length = length <NEW_LINE> self.targets = targets <NEW_LINE> <DEDENT> def serve(self, plotter, location): <NEW_LINE> <INDENT> di... | Defines a nudge axis
| 62598fa6435de62698e9bcdb |
class Category(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=255) <NEW_LINE> slug = models.SlugField(unique=True) <NEW_LINE> timestamp = models.DateTimeField(auto_now_add=True) <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return self.name | Category registration model | 62598fa663d6d428bbee2698 |
class EarlyStoppingFScore(Callback): <NEW_LINE> <INDENT> def __init__(self, val_data, dumpfn, baseline=0, patience=3, min_delta=0): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.val_data = val_data <NEW_LINE> self.dumpfn = str(dumpfn) <NEW_LINE> self.patience = patience <NEW_LINE> self.min_delta = min_delta <N... | Stop training when CR F-score has stopped improving.
Based on keras.callbacks.EarlyStopping. | 62598fa667a9b606de545eb2 |
class Tamano(models.Model): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(Tamano, self).__init__(*args, **kwargs) <NEW_LINE> <DEDENT> descripcion = models.CharField(max_length=100, unique=True) <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return self.descripcion <NEW_LINE> <DED... | docstring for Tamano | 62598fa656ac1b37e63020d3 |
class Filter(Block): <NEW_LINE> <INDENT> def block_code(self): <NEW_LINE> <INDENT> inputs = self._get_all_input_values() <NEW_LINE> filter_result = self.user_function(**inputs) <NEW_LINE> if filter_result: <NEW_LINE> <INDENT> self.pass_data_through(inputs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.clear_output... | User function should return a Boolean.
If True, all input args will be passed unmodified as output args.
If False, all output args will have a value of None. | 62598fa616aa5153ce4003e9 |
class Subtract(StochasticParameter): <NEW_LINE> <INDENT> def __init__(self, other_param, val, elementwise=False): <NEW_LINE> <INDENT> super(Subtract, self).__init__() <NEW_LINE> self.other_param = handle_continuous_param(other_param, "other_param") <NEW_LINE> self.val = handle_continuous_param(val, "val") <NEW_LINE> se... | Parameter to subtract from another parameter's results.
Parameters
----------
other_param : number or tuple of two number or list of number or StochasticParameter
Other parameter which's sampled values are to be
modified.
val : number or tuple of two number or list of number or StochasticParameter
Value t... | 62598fa607f4c71912baf32a |
class Mortgage(object): <NEW_LINE> <INDENT> def __init__(self, loan, annRate, months): <NEW_LINE> <INDENT> self.loan = loan <NEW_LINE> self.rate = annRate/12.0 <NEW_LINE> self.months = months <NEW_LINE> self.paid = [0.0] <NEW_LINE> self.owed = [loan] <NEW_LINE> self.payment = findPayment(loan, self.rate, months) <NEW_L... | Abstract class for building different kinds of mortgates | 62598fa644b2445a339b68e2 |
class SSLClientTestsMixin(TLSMixin, ReactorBuilder, ConnectionTestsMixin): <NEW_LINE> <INDENT> def serverEndpoint(self, reactor): <NEW_LINE> <INDENT> return SSL4ServerEndpoint(reactor, 0, self.getServerContext()) <NEW_LINE> <DEDENT> def clientEndpoint(self, reactor, serverAddress): <NEW_LINE> <INDENT> return SSL4Client... | Mixin defining tests relating to L{ITLSTransport}. | 62598fa676e4537e8c3ef493 |
class SQLQueryTriggered(Exception): <NEW_LINE> <INDENT> pass | Thrown when template panel triggers a query | 62598fa67047854f4633f2c0 |
class ConfigurationValues(db.Model, DbMixin): <NEW_LINE> <INDENT> __tablename__='configurationvalues' <NEW_LINE> friendly_name="Configuration Values" <NEW_LINE> id = db.Column(db.Integer, primary_key=True) <NEW_LINE> version = db.Column(db.String(15)) <NEW_LINE> model = db.Column(db.String(20)) <NEW_LINE> configuration... | Represents value from config file | 62598fa6009cb60464d0140a |
class BaudRates(enum.Enum): <NEW_LINE> <INDENT> DISABLED = -1 <NEW_LINE> B0 = 0 <NEW_LINE> B110 = 110 <NEW_LINE> B300 = 300 <NEW_LINE> B600 = 600 <NEW_LINE> B1200 = 1200 <NEW_LINE> B2400 = 2400 <NEW_LINE> B4800 = 4800 <NEW_LINE> B9600 = 9600 <NEW_LINE> B14400 = 14400 <NEW_LINE> B19200 = 19200 <NEW_LINE> B38400 = 38400 ... | This enum describes all baud rates which are commonly used. | 62598fa6aad79263cf42e6bc |
class CommonOptionGroup(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.options = [] <NEW_LINE> self.pass_state = click.make_pass_decorator(State, ensure=True) <NEW_LINE> <DEDENT> def add(self, *args, **kwargs): <NEW_LINE> <INDENT> def decorator(f): <NEW_LINE> <INDENT> def callback(ctx, param,... | Generate common options and decorate the command with the resulting object.
Use thus::
>>> common_options = CommonOptionGroup()
>>> common_options.add('--some-option', '-s', type=int, default=10, nargs=1,
... help="Here's an interesting option.",
... extra_callback=lambda ctx, param, value: val... | 62598fa6a8370b77170f02c2 |
class TestReadme(object): <NEW_LINE> <INDENT> def test_readme(self): <NEW_LINE> <INDENT> GP = gs.Github_Profile() <NEW_LINE> url = 'https://api.github.com/repos/silburt/DeepMoon/contents' <NEW_LINE> gf.get_readme_length(url, GP) <NEW_LINE> assert GP.readme_lines == 99 | Test readme length feature. | 62598fa610dbd63aa1c70a99 |
class State: <NEW_LINE> <INDENT> __slots__ = "arcs", "letter_set" <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self.arcs = dict() <NEW_LINE> self.letter_set = set() <NEW_LINE> <DEDENT> def __iter__(self): <NEW_LINE> <INDENT> for char in self.arcs: <NEW_LINE> <INDENT> yield self.arcs[char] <NEW_LINE> <DEDENT> <DED... | a state in a GADDAG | 62598fa63cc13d1c6d465653 |
class SourceCatalog3FHL(SourceCatalog): <NEW_LINE> <INDENT> name = '3fhl' <NEW_LINE> description = 'LAT third high-energy source catalog' <NEW_LINE> source_object_class = SourceCatalogObject3FHL <NEW_LINE> source_categories = { 'galactic': ['glc', 'hmb', 'psr', 'pwn', 'sfr', 'snr', 'spp'], 'extra-galactic': ['agn', 'bc... | Fermi-LAT 3FHL source catalog.
One source is represented by `~gammapy.catalog.SourceCatalogObject3FHL`. | 62598fa64e4d56256637230c |
class GetKeys(Method): <NEW_LINE> <INDENT> roles = ['admin', 'pi', 'user', 'tech', 'node'] <NEW_LINE> accepts = [ Auth(), Mixed([Mixed(Key.fields['key_id'])], Filter(Key.fields)), Parameter([str], "List of fields to return", nullok = True) ] <NEW_LINE> returns = [Key.fields] <NEW_LINE> def call(self, auth, key_filter =... | Returns an array of structs containing details about keys. If
key_filter is specified and is an array of key identifiers, or a
struct of key attributes, only keys matching the filter will be
returned. If return_fields is specified, only the specified
details will be returned.
Admin may query all keys. Non-admins may o... | 62598fa60c0af96317c5626a |
class TestLDAPGroupWrite(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def testLDAPGroupWrite(self): <NEW_LINE> <INDENT> pass | LDAPGroupWrite unit test stubs | 62598fa6379a373c97d98efa |
@register_relay_attr_node <NEW_LINE> class L2NormalizeAttrs(Attrs): <NEW_LINE> <INDENT> pass | Attributes for nn.l2_normalize | 62598fa64e4d56256637230d |
class GradeCell(Base): <NEW_LINE> <INDENT> __tablename__ = "grade_cell" <NEW_LINE> __table_args__ = (UniqueConstraint('name', 'notebook_id'),) <NEW_LINE> id = Column(String(32), primary_key=True, default=new_uuid) <NEW_LINE> name = Column(String(128), nullable=False) <NEW_LINE> max_score = Column(Float(), nullable=Fals... | Database representation of the master/source version of a grade cell. | 62598fa601c39578d7f12c68 |
class LineObjTestCase(MapPrimitivesTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.points = (mapscript.pointObj(0.0, 1.0), mapscript.pointObj(2.0, 3.0)) <NEW_LINE> self.line = mapscript.lineObj() <NEW_LINE> self.addPointToLine(self.line, self.points[0]) <NEW_LINE> self.addPointToLine(self.line,... | Testing the lineObj class in stand-alone mode | 62598fa663d6d428bbee269a |
class TaskView(CreateView): <NEW_LINE> <INDENT> model = Task <NEW_LINE> form_class = TaskForm <NEW_LINE> success_url = "/" <NEW_LINE> template_name = "task.html" <NEW_LINE> context_object_name = "tasks" <NEW_LINE> def form_valid(self, form): <NEW_LINE> <INDENT> task = form.save() <NEW_LINE> parse.delay(task.pk, task.wo... | Отображение и обработка формы ввода новой задачи | 62598fa66e29344779b00545 |
class SetUpTestesDadosValidos(EstoqueTest): <NEW_LINE> <INDENT> def test_quantidade_de_categorias_criadas(self): <NEW_LINE> <INDENT> self.assertEqual(9, len(self.todas_categorias)) <NEW_LINE> <DEDENT> def test_quantidade_de_subcategorias_criadas(self): <NEW_LINE> <INDENT> self.assertEqual(8, len(self.todas_subcategoria... | Testes com dados válidos informados | 62598fa6ac7a0e7691f723f3 |
class UciShowWireless(rootfs_boot.RootFSBootTest): <NEW_LINE> <INDENT> def runTest(self): <NEW_LINE> <INDENT> wlan_iface = wifi_interface(board) <NEW_LINE> if wlan_iface is None: <NEW_LINE> <INDENT> self.skipTest("No wifi interfaces detected, skipping..") <NEW_LINE> <DEDENT> board.sendline('\nuci show wireless') <NEW_L... | UCI lists wifi interfaces. | 62598fa6097d151d1a2c0f10 |
class ApiRoot(APIView): <NEW_LINE> <INDENT> def get(self, request, format=None): <NEW_LINE> <INDENT> data = OrderedDict() <NEW_LINE> for method in API_METHODS: <NEW_LINE> <INDENT> data[method] = reverse(method, request=request, format=format) <NEW_LINE> <DEDENT> return Response(data) | # Welcome to The Good Foot Club API
Welcome to The Good Foot Club project REST API!
## Explore
Down below you can see the list of available api methods. Feel free to
follow each url and learn details about each method. | 62598fa644b2445a339b68e3 |
class Described(WavesBaseModel): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> abstract = True <NEW_LINE> <DEDENT> description = RichTextField('Description', null=True, blank=True, help_text='Description (HTML)') <NEW_LINE> short_description = models.TextField('Short Description', null=True, blank=True, help_text... | A model object which inherit from this class add two description fields to model objects | 62598fa6e76e3b2f99fd891f |
class Machine(Resource): <NEW_LINE> <INDENT> ENDPOINT = '/machines' <NEW_LINE> def get(self, machine_id): <NEW_LINE> <INDENT> machine_res = {} <NEW_LINE> with database.session() as session: <NEW_LINE> <INDENT> machine = session.query(ModelMachine) .filter_by(id=machine_id) ... | List details of the machine with specific machine id | 62598fa6d58c6744b42dc249 |
class FFMpegRecipe(Recipe): <NEW_LINE> <INDENT> version = 'libpng16' <NEW_LINE> url = 'git+https://github.com/brussee/ffmpeg-android.git' <NEW_LINE> patches = ['settings.patch'] <NEW_LINE> def should_build(self, arch): <NEW_LINE> <INDENT> return not exists(self.get_build_bin(arch)) <NEW_LINE> <DEDENT> def build_arch(se... | FFmpeg for Android compiled with x264, libass, fontconfig, freetype, fribidi and lame (Supports Android 4.1+)
http://writingminds.github.io/ffmpeg-android/ | 62598fa64f6381625f199432 |
class CopyToBoot(Actor): <NEW_LINE> <INDENT> name = 'copy_to_boot' <NEW_LINE> consumes = () <NEW_LINE> produces = (BootContent,) <NEW_LINE> tags = (IPUWorkflowTag, InterimPreparationPhaseTag) <NEW_LINE> def process(self): <NEW_LINE> <INDENT> copy_to_boot() | Copy Leapp provided initramfs to boot partition.
In order to execute upgrade, Leapp provides a special initramfs and kernel to be used during
the process. Such artifacts need to be placed inside boot partition. | 62598fa65fdd1c0f98e5de81 |
class IRCEvent(O): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> O.__init__(self, *args, **kwargs) <NEW_LINE> self.parse() <NEW_LINE> <DEDENT> def parse(self): <NEW_LINE> <INDENT> if not self.input: raise NoInput() <NEW_LINE> rawstr = self.input <NEW_LINE> self.servermsg = False <NEW_LINE... | represents an IRC event. | 62598fa660cbc95b06364235 |
class LBXPlus(LBX, object): <NEW_LINE> <INDENT> def __init__(self, formula, use_cld=False, use_timer=False): <NEW_LINE> <INDENT> super(LBXPlus, self).__init__(formula, use_cld=use_cld, solver_name='mc', use_timer=use_timer) <NEW_LINE> for am in formula.atms: <NEW_LINE> <INDENT> self.oracle.add_atmost(*am) | Algorithm LBX for CNF+/WCNF+ formulas. | 62598fa6009cb60464d0140b |
class PerformanceInfo(Structure): <NEW_LINE> <INDENT> _fields_ = [ ('size', c_ulong), ('CommitTotal', c_size_t), ('CommitLimit', c_size_t), ('CommitPeak', c_size_t), ('PhysicalTotal', c_size_t), ('PhysicalAvailable', c_size_t), ('SystemCache', c_size_t), ('KernelTotal', c_size_t), ('KernelPaged', c_size_t), ('KernelNon... | I/O struct for Windows .GetPerformanceInfo() call.
Docs:
http://msdn.microsoft.com/en-us/library/ms684824 | 62598fa626068e7796d4c842 |
class Account(_BaseCerp): <NEW_LINE> <INDENT> ROOT_NAME = 'Account' <NEW_LINE> XSD_SCHEMA = 'http://www.history.ncdcr.gov/SHRAB/ar/emailpreservation/mail-account/mail-account.xsd' <NEW_LINE> email_address = xmlmap.StringField('xm:EmailAddress') <NEW_LINE> global_id = xmlmap.StringField('xm:GlobalId') <NEW_LINE> referen... | A single email account associated with a single email address and
composed of multiple :class:`Folder` objects and additional metadata. | 62598fa6cc0a2c111447aef9 |
class HistoricalDataObj: <NEW_LINE> <INDENT> vOpen = array([]) <NEW_LINE> vClose = array([]) <NEW_LINE> stockTicker = "" <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self.stockTicker= "" <NEW_LINE> self.vDateInt = array([]) <NEW_LINE> self.vDate = array([]) <NEW_LINE> self.vOpen = array([]) <NEW_LINE... | Historical Finance Data Object | 62598fa63cc13d1c6d465655 |
class ConversationProcessView(http.HomeAssistantView): <NEW_LINE> <INDENT> url = '/api/conversation/process' <NEW_LINE> name = "api:conversation:process" <NEW_LINE> @asyncio.coroutine <NEW_LINE> def post(self, request): <NEW_LINE> <INDENT> hass = request.app['hass'] <NEW_LINE> try: <NEW_LINE> <INDENT> data = yield from... | View to retrieve shopping list content. | 62598fa6090684286d593650 |
class ABC(Network): <NEW_LINE> <INDENT> def get_show(self, show_info): <NEW_LINE> <INDENT> if not super(self.__class__, self).get_show(show_info): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> base_url = "http://abc.go.com" <NEW_LINE> show_title = show_info['show_title'] <NEW_LINE> show_url = "{0}/shows/{1}/epis... | ABC network class | 62598fa61f037a2d8b9e3fd5 |
class Planet: <NEW_LINE> <INDENT> def __init__(self, initialPosition, initialVelocity, initialAcceleration, Name, mass, method): <NEW_LINE> <INDENT> if len(initialPosition) != 3: <NEW_LINE> <INDENT> raise ValueError("The initial position array must be of length 3") <NEW_LINE> <DEDENT> self.position = np.array(initialPo... | Class of methods including the Force to iterate over and the acceleration. Setting method = 1 uses Euler-Cromer, and setting method = 2 uses Euler-Forward. | 62598fa6d486a94d0ba2beb7 |
class override_method(object): <NEW_LINE> <INDENT> def __init__(self, view, request, method): <NEW_LINE> <INDENT> self.view = view <NEW_LINE> self.request = request <NEW_LINE> self.method = method <NEW_LINE> self.action = getattr(view, 'action', None) <NEW_LINE> <DEDENT> def __enter__(self): <NEW_LINE> <INDENT> self.vi... | A context manager that temporarily overrides the method on a request,
additionally setting the `view.request` attribute.
Usage:
with override_method(view, request, 'POST') as request:
... # Do stuff with `view` and `request` | 62598fa6dd821e528d6d8e1f |
class QualnameTest(CoverageTest): <NEW_LINE> <INDENT> run_in_temp_dir = False <NEW_LINE> def test_method(self): <NEW_LINE> <INDENT> assert Parent().meth() == "tests.test_context.Parent.meth" <NEW_LINE> <DEDENT> def test_inherited_method(self): <NEW_LINE> <INDENT> assert Child().meth() == "tests.test_context.Parent.meth... | Tests of qualname_from_frame. | 62598fa67d43ff2487427377 |
class BadImage(CloudRecoException): <NEW_LINE> <INDENT> pass | Exception raised when Vuforia returns a response with a result code
'BadImage'. | 62598fa64a966d76dd5eedcd |
class Solution(object): <NEW_LINE> <INDENT> def sortColors(self, nums): <NEW_LINE> <INDENT> color_count = [0] * 3 <NEW_LINE> for c in nums: <NEW_LINE> <INDENT> color_count[c] += 1 <NEW_LINE> <DEDENT> ind = 0 <NEW_LINE> for c in range(3): <NEW_LINE> <INDENT> for i in range(0, color_count[c]): <NEW_LINE> <INDENT> nums[in... | :type nums: List[int]
:rtype: None Do not return anything, modify nums in-place instead. | 62598fa676e4537e8c3ef496 |
class StringListView(object_rectangle.ObjectRectangle): <NEW_LINE> <INDENT> def __init__(self, rect, items, row_num): <NEW_LINE> <INDENT> object_rectangle.ObjectRectangle.__init__(self, rect) <NEW_LINE> self.row_num = row_num <NEW_LINE> self.items = [] <NEW_LINE> self._items_font = None <NEW_LINE> self.string_items = i... | classdocs | 62598fa6be383301e02536e2 |
class Rogue(Character): <NEW_LINE> <INDENT> def __init__(self, name: str, battle_queue: 'BattleQueue', playstyle: 'Playstlyle') -> None: <NEW_LINE> <INDENT> super().__init__(name, battle_queue, playstyle) <NEW_LINE> self.defense = 10 <NEW_LINE> self.style = 'Rogue' <NEW_LINE> self.sprite = 'rogue' <NEW_LINE> <DEDENT> d... | A rogue type character class. Inherits from character | 62598fa6796e427e5384e67e |
class TestThreadGetByUser(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.group = mommy.make('groups.Group', private=True) <NEW_LINE> self.user = mommy.make( 'accounts.User', is_active=True, invite_verified=True) <NEW_LINE> self.thread = mommy.make( 'connectmessages.Thread', group=self.group) <... | Tests for Thread.get_by_user. | 62598fa692d797404e388ada |
class ContactRowSerializer(serializers.Serializer): <NEW_LINE> <INDENT> addresses = serializers.ListField(child=serializers.CharField(), help_text=( 'A list of the contact row\'s addresses. This will never be null, but it may be an ' 'empty list.')) <NEW_LINE> bold = serializers.BooleanField( help_text='Flag indicating... | Serializer for IbisContactRow. | 62598fa68e71fb1e983bb99c |
class V1ReloadableComponentConfiguration(object): <NEW_LINE> <INDENT> swagger_types = { 'rest_client': 'V1RESTClientConfiguration' } <NEW_LINE> attribute_map = { 'rest_client': 'restClient' } <NEW_LINE> def __init__(self, rest_client=None): <NEW_LINE> <INDENT> self._rest_client = None <NEW_LINE> if rest_client is not N... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598fa64f88993c371f047f |
class LiveEventInputTrackSelection(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'property': {'key': 'property', 'type': 'str'}, 'operation': {'key': 'operation', 'type': 'str'}, 'value': {'key': 'value', 'type': 'str'}, } <NEW_LINE> def __init__( self, *, property: Optional[str] = None, operation... | A track selection condition. This property is reserved for future use, any value set on this property will be ignored.
:param property: Property name to select. This property is reserved for future use, any value
set on this property will be ignored.
:type property: str
:param operation: Comparing operation. This pro... | 62598fa616aa5153ce4003ed |
class RosterGroup(object): <NEW_LINE> <INDENT> def __init__(self, name, contacts=None, folded=False): <NEW_LINE> <INDENT> if not contacts: <NEW_LINE> <INDENT> contacts = [] <NEW_LINE> <DEDENT> self.contacts = set(contacts) <NEW_LINE> self.name = name if name is not None else '' <NEW_LINE> self.folded = folded <NEW_LINE... | A RosterGroup is a group containing contacts
It can be Friends/Family etc, but also can be
Online/Offline or whatever | 62598fa656b00c62f0fb279d |
class cmd_processes(Command): <NEW_LINE> <INDENT> synopsis = "%prog [options]" <NEW_LINE> takes_optiongroups = { "sambaopts": options.SambaOptions, "versionopts": options.VersionOptions } <NEW_LINE> takes_options = [ Option("--name", type=str, help="Return only processes associated with one particular name"), Option("-... | List processes (to aid debugging on systems without setproctitle). | 62598fa6fff4ab517ebcd6cf |
class UploadCopy(object): <NEW_LINE> <INDENT> def __init__(self, upload, group=None): <NEW_LINE> <INDENT> self.directory = None <NEW_LINE> self.upload = upload <NEW_LINE> self.group = group <NEW_LINE> <DEDENT> def export(self, directory, mode=None, symlink=True, ignore_existing=False): <NEW_LINE> <INDENT> with Filesyst... | export a policy queue upload
This class can be used in a with-statement::
with UploadCopy(...) as copy:
...
Doing so will provide a temporary copy of the upload in the directory
given by the C{directory} attribute. The copy will be removed on leaving
the with-block. | 62598fa6d58c6744b42dc24a |
class SafePluginTester(SafeTester): <NEW_LINE> <INDENT> def __init__(self, test_name): <NEW_LINE> <INDENT> SafeTester.__init__(self, test_name) <NEW_LINE> <DEDENT> def set_dir(self): <NEW_LINE> <INDENT> self.working_dir = os.path.join(os.path.join(os.path.join(os.path.dirname(__file__), 'tmp'), self.test_class), self.t... | General template for safe "Plugin" modules testing | 62598fa64f6381625f199433 |
class ModelRefMixin: <NEW_LINE> <INDENT> def __init__(self, **kwargs) -> None: <NEW_LINE> <INDENT> super().__init__(**kwargs) <NEW_LINE> self._model = lambda: None <NEW_LINE> <DEDENT> @property <NEW_LINE> def model(self) -> "Model": <NEW_LINE> <INDENT> return self.get_model() <NEW_LINE> <DEDENT> @property <NEW_LINE> de... | Define a model reference mixin. | 62598fa65166f23b2e2432c2 |
class CurrentGradesByUser(CurrentGrades): <NEW_LINE> <INDENT> def __init__(self, current_grade_list): <NEW_LINE> <INDENT> super(CurrentGradesByUser, self).__init__(current_grade_list) <NEW_LINE> self.username = None <NEW_LINE> self.current_grades = {} <NEW_LINE> for current_grade in current_grade_list: <NEW_LINE> <INDE... | Represents the current grades for a specific user | 62598fa60a50d4780f7052c7 |
class Domain(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._tasks = {} <NEW_LINE> <DEDENT> def add_task(self, task): <NEW_LINE> <INDENT> if task.name in self._tasks.keys(): <NEW_LINE> <INDENT> print('Warning: overriding %s with a new task' % task.name) <NEW_LINE> <DEDENT> self._tasks[task.na... | A set if possible tasks, some of which can be decomposed
into other tasks. | 62598fa6f548e778e596b490 |
class TestV1EnvFromSource(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def testV1EnvFromSource(self): <NEW_LINE> <INDENT> model = kubernetes.client.models.v1_env_from_source.V1EnvFromSource() | V1EnvFromSource unit test stubs | 62598fa60a50d4780f7052c8 |
class ImageSchemaField(FileSchemaField): <NEW_LINE> <INDENT> pass | An image field.
| 62598fa610dbd63aa1c70a9d |
class TestCkanIndex: <NEW_LINE> <INDENT> __external__ = True <NEW_LINE> index = dpm.index.ckan.CkanIndex('http://thedatahub.org/api/') <NEW_LINE> def test_get(self): <NEW_LINE> <INDENT> name = u'ckan' <NEW_LINE> out = self.index.get(name) <NEW_LINE> assert out.name == name <NEW_LINE> <DEDENT> def test_search(self): <NE... | Read only test.
Don't want to duplicate too much of what is in ckanclient tests | 62598fa67b25080760ed7397 |
class Hive_Device_Heating_Boost(Entity): <NEW_LINE> <INDENT> def __init__(self, HiveComponent_HiveObjects): <NEW_LINE> <INDENT> self.HiveObjects = HiveComponent_HiveObjects <NEW_LINE> <DEDENT> @property <NEW_LINE> def name(self): <NEW_LINE> <INDENT> return 'Hive Heating Boost' <NEW_LINE> <DEDENT> @property <NEW_LINE> d... | Hive Heating current Boost (ON / OFF) | 62598fa691f36d47f2230e19 |
class Movie: <NEW_LINE> <INDENT> def __init__(self, title, poster_image_url, trailer_youtube_url): <NEW_LINE> <INDENT> self.title = title <NEW_LINE> self.poster_image_url = poster_image_url <NEW_LINE> self.trailer_youtube_url = trailer_youtube_url <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return '%s' %... | Movie template for individual movies | 62598fa61f037a2d8b9e3fd7 |
class Actor(nn.Module): <NEW_LINE> <INDENT> def __init__(self, state_size, action_size, seed, fc1_units=200, fc2_units=150): <NEW_LINE> <INDENT> super(Actor, self).__init__() <NEW_LINE> self.seed = torch.manual_seed(seed) <NEW_LINE> self.fc1 = nn.Linear(state_size, fc1_units) <NEW_LINE> self.fc2 = nn.Linear(fc1_units, ... | Actor (Policy) Model. | 62598fa64e4d562566372310 |
class AuthorizeKey(object): <NEW_LINE> <INDENT> def __init__(self, ssh_key, user="root"): <NEW_LINE> <INDENT> self.attributes = {} <NEW_LINE> self.attributes["user"] = user <NEW_LINE> self.attributes["key"] = ssh_key <NEW_LINE> <DEDENT> def run(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> runner = ansible_module... | AuthorizeKey class is used to copy the given ssh-key
to particular user. A default user is root.
Here ssh_key is mandatory and user is optional.
At the time of initalize it will take user and ssh-key as
parameter.
input:
ssh_key
user(optional)
output:
True/False, None/error | 62598fa61b99ca400228f4a5 |
class ThreeLayerConvNet(object): <NEW_LINE> <INDENT> def __init__(self, input_dim=(3, 32, 32), num_filters=32, filter_size=7, hidden_dim=100, num_classes=10, weight_scale=1e-3, reg=0.0, dtype=np.float32): <NEW_LINE> <INDENT> self.params = {} <NEW_LINE> self.reg = reg <NEW_LINE> self.dtype = dtype <NEW_LINE> C, H, W = i... | A three-layer convolutional network with the following architecture:
conv - relu - 2x2 max pool - affine - relu - affine - softmax
The network operates on minibatches of data that have shape (N, C, H, W)
consisting of N images, each with height H and width W and with C input
channels. | 62598fa6d486a94d0ba2beba |
class ProgressMeter(object): <NEW_LINE> <INDENT> def __init__(self, num_batches, meters, prefix=""): <NEW_LINE> <INDENT> self.batch_fmtstr = self._get_batch_fmtstr(num_batches) <NEW_LINE> self.meters = meters <NEW_LINE> self.prefix = prefix <NEW_LINE> <DEDENT> def display(self, batch): <NEW_LINE> <INDENT> entries = [se... | Default PyTorch pogress meter | 62598fa68a43f66fc4bf2069 |
class SourceType(Enum): <NEW_LINE> <INDENT> NONE = None <NEW_LINE> PUSH = None <NEW_LINE> PULL = None <NEW_LINE> def __init__(self, string): <NEW_LINE> <INDENT> Enum.__init__(string) | The ``File.SourceType`` class defines how the file content is retrieved.
.. note::
This class represents an enumerated type in the interface language
definition. The class contains class attributes which represent the
values in the current version of the enumerated type. Newer versions of
the enumerate... | 62598fa67d43ff2487427378 |
class ActiveProfileManager(models.Manager): <NEW_LINE> <INDENT> def get_queryset(self): <NEW_LINE> <INDENT> qs = super(ActiveProfileManager, self).get_queryset() <NEW_LINE> return qs.filter(user__is_active=True) | A custom model manager limited only to active profiles | 62598fa67047854f4633f2c5 |
class GameObject(ABC): <NEW_LINE> <INDENT> def __init__(self, pos: typing.Tuple[int, int] = (0, 0), render: str = '', size: typing.Tuple[int, int] = (0, 0)): <NEW_LINE> <INDENT> self.x: int = pos[0] <NEW_LINE> self.y: int = pos[1] <NEW_LINE> self.render: str = render <NEW_LINE> self.delta_time = 0 <NEW_LINE> self.width... | An abstract base class for pyplayscii game objects. | 62598fa6a219f33f346c6704 |
class Ui_Dialog_Quit(QDialog): <NEW_LINE> <INDENT> save_as_signal = pyqtSignal() <NEW_LINE> do_not_save_signal = pyqtSignal() <NEW_LINE> cancel_signal = pyqtSignal() <NEW_LINE> def __init__(self, database): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.database = database <NEW_LINE> self.bool_exit = False <NEW... | Is called when the user closes the software and the current project
has been modified | 62598fa63317a56b869be4c0 |
class ListCosEnableRegionResponse(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.EnableRegions = None <NEW_LINE> self.RequestId = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> if params.get("EnableRegions") is not None: <NEW_LINE> <INDENT> self.EnableRegi... | `ListCosEnableRegion` response parameters structure
| 62598fa6eab8aa0e5d30bc76 |
class BoundPinnedRow(BoundRow): <NEW_LINE> <INDENT> @property <NEW_LINE> def attrs(self): <NEW_LINE> <INDENT> row_attrs = computed_values(self._table.pinned_row_attrs, self._record) <NEW_LINE> css_class = ' '.join([ self.get_even_odd_css_class(), 'pinned-row', row_attrs.get('class', '') ]) <NEW_LINE> row_attrs['class']... | Represents a *pinned* row in a table.
Inherited from BoundRow. | 62598fa6b7558d589546351c |
class none(): <NEW_LINE> <INDENT> def run(self, model): <NEW_LINE> <INDENT> pass | Just output populate without do nonthing | 62598fa616aa5153ce4003ef |
class IgnoreAttribute: <NEW_LINE> <INDENT> def __iter__(self): <NEW_LINE> <INDENT> return iter([self, ]) | This is a hack to let Spyne not append elements, which weren't asked in the scope. | 62598fa63539df3088ecc1a1 |
@dataclasses.dataclass(frozen=True) <NEW_LINE> class UserApplicationService: <NEW_LINE> <INDENT> _user_repository: Final[IUserRepository] <NEW_LINE> _user_service: Final[UserService] <NEW_LINE> def register(self, name: str): <NEW_LINE> <INDENT> user : User = User(UserName(name)) <NEW_LINE> if self._user_service.exists(... | ユーザのアプリケーションサービス
Attributes:
_user_repository (IUserRepository): ユーザのレポジトリ
_user_service (UserService): ユーザのドメインサービス | 62598fa6e5267d203ee6b7f9 |
class QNNParam: <NEW_LINE> <INDENT> def __init__(self, weight, bias, scale, zero_point): <NEW_LINE> <INDENT> self.weight = weight <NEW_LINE> if bias is not None: <NEW_LINE> <INDENT> self.bias = bias.detach().numpy() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.bias = None <NEW_LINE> <DEDENT> self.scale = _expr.co... | A placeholder for weight quantization parameters | 62598fa676e4537e8c3ef499 |
class ExpectimaxAgent(MultiAgentSearchAgent): <NEW_LINE> <INDENT> def getAction(self, gameState): <NEW_LINE> <INDENT> score, action = self.maxFunction(gameState, self.depth) <NEW_LINE> return action <NEW_LINE> <DEDENT> def maxFunction(self, gameState, depth): <NEW_LINE> <INDENT> if depth == 0 or gameState.isWin() or ga... | Your expectimax agent (question 4) | 62598fa67cff6e4e811b5916 |
class GDCClient(object): <NEW_LINE> <INDENT> def __init__(self, host=GDC_API_HOST, port=GDC_API_PORT, token=None): <NEW_LINE> <INDENT> self.host = host <NEW_LINE> self.port = port <NEW_LINE> self.token = token <NEW_LINE> self.session = requests.Session() <NEW_LINE> agent = " ".join( [ "GDC-Client/{version}".format(vers... | GDC API Requests Client
| 62598fa65fdd1c0f98e5de85 |
class EthereumAddressField(serializers.Field): <NEW_LINE> <INDENT> def __init__(self, allow_zero_address=False, allow_sentinel_address=False, **kwargs): <NEW_LINE> <INDENT> self.allow_zero_address = allow_zero_address <NEW_LINE> self.allow_sentinel_address = allow_sentinel_address <NEW_LINE> super().__init__(**kwargs) ... | Ethereum address checksumed
https://github.com/ethereum/EIPs/blob/master/EIPS/eip-55.md | 62598fa6d58c6744b42dc24b |
class PQuestActionOp(Parsing.Precedence): <NEW_LINE> <INDENT> pass | %left pQuestActionOp >pAttrKey | 62598fa63617ad0b5ee06040 |
class UserIdentity(models.Model): <NEW_LINE> <INDENT> identity = models.CharField(max_length=50, blank=False, unique=True, choices=AUTH_CHOICES, default=VISITOR_USER, verbose_name="身份级别") <NEW_LINE> auth_groups = models.ManyToManyField(User, related_name="identities") <NEW_LINE> class Meta: <NEW_LINE> <INDENT> verbose_... | Login User identity: AdminStaff, AdminSystem, Expert, SchoolTeam, visitor,
Teacher, Student | 62598fa65f7d997b871f9357 |
class Stack(MeanFunction): <NEW_LINE> <INDENT> def __init__(self, list_of_means): <NEW_LINE> <INDENT> output_dim = 0 <NEW_LINE> for m in list_of_means: <NEW_LINE> <INDENT> output_dim += m.output_dim <NEW_LINE> <DEDENT> MeanFunction.__init__(self, output_dim) <NEW_LINE> self.mean_list = ParamList(list_of_means) <NEW_LIN... | Mean function that returns multiple kinds of mean values, stacked
vertically.
Input for the initializer is a list of MeanFunctions, [m_1,m_2,...,m_M].
The function call returns [m_1(X),m_2(X),...,m_M(X)].
The size of the return is n x (sum_i m_i.output_dim). | 62598fa626068e7796d4c847 |
class GRNTestNtf(GRANITEISIMessage): <NEW_LINE> <INDENT> notify = None <NEW_LINE> def __init__(self, **isi_message_fields): <NEW_LINE> <INDENT> debug.vrb("GRNTestNtf: __init__()") <NEW_LINE> GRANITEISIMessage.__init__(self, **isi_message_fields) <NEW_LINE> self.initDefaults( msg_id = None) <NEW_LINE> self.assertFields(... | ISI message class for GRN_TEST_NTF
Parameters Data type
- isi_message ISIMessage instance
Fields Data type
- msg_id integer
- notify integer (not an isi field) | 62598fa6fff4ab517ebcd6d2 |
class Device(_AttributeKind): <NEW_LINE> <INDENT> pass | Represents a device for ``AutoDB`` to process.
| 62598fa666673b3332c302b7 |
class valoresViewSet(APIView): <NEW_LINE> <INDENT> def post(self, request, format=None): <NEW_LINE> <INDENT> datos = (request.data) <NEW_LINE> password = datos['password'] <NEW_LINE> register = User(username = datos['username'], first_name = datos['first_name'], last_name = datos['last_name'], is_staff = datos['is_staf... | Recollemos valores do formulario de alta | 62598fa691f36d47f2230e1a |
class Room(Enum): <NEW_LINE> <INDENT> BALLROOM = 'BALLROOM' <NEW_LINE> BILLIARD_ROOM = 'BILLIARD_ROOM' <NEW_LINE> CONSERVATORY = 'CONSERVATORY' <NEW_LINE> DINING_ROOM = 'DINING_ROOM' <NEW_LINE> HALL = 'HALL' <NEW_LINE> KITCHEN = 'KITCHEN' <NEW_LINE> LIBRARY = 'LIBRARY' <NEW_LINE> LOUNGE = 'LOUNGE' <NEW_LINE> STUDY = 'S... | The set of locations where the murder may have occurred. | 62598fa685dfad0860cbf9eb |
class CreateTargetGroupResponse(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.TargetGroupId = None <NEW_LINE> self.RequestId = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.TargetGroupId = params.get("TargetGroupId") <NEW_LINE> self.RequestId = para... | CreateTargetGroup返回参数结构体
| 62598fa64e4d562566372312 |
class MaxAndSkip(gym.Wrapper): <NEW_LINE> <INDENT> def __init__(self, env, skip=4): <NEW_LINE> <INDENT> super().__init__(env) <NEW_LINE> self._obs_buffer = np.zeros((2, ) + env.observation_space.shape, dtype=np.uint8) <NEW_LINE> self._skip = skip <NEW_LINE> <DEDENT> def step(self, action): <NEW_LINE> <INDENT> total_rew... | Max and skip wrapper for gym.Env.
It returns only every `skip`-th frame. Action are repeated and rewards are
sum for the skipped frames.
It also takes element-wise maximum over the last two consecutive frames,
which helps algorithm deal with the problem of how certain Atari games only
render their sprites every other... | 62598fa699cbb53fe6830dc3 |
class Attention(nn.Module): <NEW_LINE> <INDENT> def __init__(self, dimensions, attention_type="general", device=torch.device('cpu')): <NEW_LINE> <INDENT> super(Attention, self).__init__() <NEW_LINE> if attention_type not in ["dot", "general"]: <NEW_LINE> <INDENT> raise ValueError("Invalid attention type selected.") <NE... | Applies attention mechanism on the `context` using the `query`.
**Thank you** to IBM for their initial implementation of :class:`Attention`. Here is
their `License
<https://github.com/IBM/pytorch-seq2seq/blob/master/LICENSE>`__.
Args:
dimensions (int): Dimensionality of the query and context.
attention_type (... | 62598fa66aa9bd52df0d4db7 |
class SimpleStemIN(nn.Module): <NEW_LINE> <INDENT> def __init__(self, in_w, out_w): <NEW_LINE> <INDENT> super(SimpleStemIN, self).__init__() <NEW_LINE> self._construct(in_w, out_w) <NEW_LINE> <DEDENT> def _construct(self, in_w, out_w): <NEW_LINE> <INDENT> self.conv = nn.Conv2d( in_w, out_w, kernel_size=3, stride=2, pad... | Simple stem for ImageNet. | 62598fa6dd821e528d6d8e23 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.