Generate a dummy airplane model.

        :param model_mask: Mask of truck model. Here '@' is a
            placeholder of characters and '#' is a placeholder of digits.
        :return: Airplane model.

        :Example:
            Boeing 727.
969253
def airplane(self, model_mask: str = '###') -> str:
        
        model = self.random.custom_code(mask=model_mask)
        plane = self.random.choice(AIRPLANES)
        return '{} {}'.format(plane, model)
400731
def subsequent_mask(size: int, device: str = 'cpu') -> torch.Tensor:
    """"""
    mask = torch.tril(torch.ones(size, size, device=device, dtype=torch.int32)).unsqueeze(0)
    return mask
544325
def fill_model(self, model=None):
        
        normalized_dct = self.normalize()
        if model:
            if not isinstance(model, self._model_class):
                raise ModelFormSecurityError('%s should be %s instance' % (model, self._model_class.__name__))
            model.populate(**normalized_dct)
            return model
        return self._model_class(**normalized_dct)
529726
def decodeMotorInput(self, motorInputPattern):
    
    key = self.motorEncoder.decode(motorInputPattern)[0].keys()[0]
    motorCommand = self.motorEncoder.decode(motorInputPattern)[0][key][1][0]
    return motorCommand
52785
def create_proxy_model(name, model_mixins, base_model, attrs=None, module=None):
    
    from django.apps import apps

    class Meta:
        proxy = True
        app_label = 'cmsplugin_cascade'

    name = str(name + 'Model')
    try:
        Model = apps.get_registered_model(Meta.app_label, name)
    except LookupError:
        bases = model_mixins + (base_model,)
        attrs = dict(attrs or {}, Meta=Meta, __module__=module)
        Model = type(name, bases, attrs)
        fake_proxy_models[name] = bases
    return Model
1007254
def _get_model(vehicle):
    """"""
    model = vehicle['model']
    model = model.replace(vehicle['year'], '')
    model = model.replace(vehicle['make'], '')
    return model.strip().split(' ')[0]
1119736
def make_model(num_layers: int = 6,
               input_size: int = 512,  # Attention size
               hidden_size: int = 2048,  # FF layer size
               heads: int = 8,
               dropout: float = 0.1,
               return_all_layers: bool = False) -> TransformerEncoder:
    """"""
    attn = MultiHeadedAttention(heads, input_size, dropout)
    ff = PositionwiseFeedForward(input_size, hidden_size, dropout)
    model = TransformerEncoder(EncoderLayer(input_size, attn, ff, dropout),
                               num_layers,
                               return_all_layers=return_all_layers)

    # Initialize parameters with Glorot / fan_avg.
    for p in model.parameters():
        if p.dim() > 1:
            torch.nn.init.xavier_uniform_(p)
    return model
901337
def set_classifier_mask(self, v, base_mask=True):
        """"""
        base = self._base
        v = tonparray(v)
        a = np.unique(v)
        if a[0] != -1 or a[1] != 1:
            raise RuntimeError("The labels must be -1 and 1 (%s)" % a)
        mask = np.zeros_like(v)
        cnt = min([(v == x).sum() for x in a]) * base._tr_fraction
        cnt = int(round(cnt))
        for i in a:
            index = np.where((v == i) & base_mask)[0]
            np.random.shuffle(index)
            mask[index[:cnt]] = True
        base._mask = SparseArray.fromlist(mask)
        return SparseArray.fromlist(v)
872034
def fill_with_model(self, model, *fields):
        
        model_dct = model.to_dict(include=self._fields.keys())
        localized_dct = self.localize(*fields, **model_dct)
        if model.key:
            localized_dct['id'] = model.key.id()
        return localized_dct
813014
def _build_mask(self):
        """"""
        self.mask = torch.ones(self.d, self.d).byte()
        for ci in self.c_data.values():
            si, ei = ci["start_index"], ci["end_index"]
            for cj in self.c_data.values():
                sj, ej = cj["start_index"], cj["end_index"]

                # Check if ci and cj are part of the same maximal clique
                # If so, mask out their corresponding blocks in O^{-1}
                if len(ci["max_cliques"].intersection(cj["max_cliques"])) > 0:
                    self.mask[si:ei, sj:ej] = 0
                    self.mask[sj:ej, si:ei] = 0
360658
def specials_mask(self):
        
        mask = self.data >= self.specials['Min']
        mask &= self.data <= self.specials['Max']
        return mask
415906
def hashmodel(model, library=None):
    ''''''
    library = library or 'python-stdnet'
    meta = model._meta
    sha = hashlib.sha1(to_bytes('{0}({1})'.format(library, meta)))
    hash = sha.hexdigest()[:8]
    meta.hash = hash
    if hash in _model_dict:
        raise KeyError('Model "{0}" already in hash table.\
 Rename your model or the module containing the model.'.format(meta))
    _model_dict[hash] = model
473274
def issn(self, mask: str = '####-####') -> str:
        
        return self.random.custom_code(mask=mask)
1071600
def get_model_name(model):
    
    opts = model._meta
    if django.VERSION[:2] < (1, 7):
        model_name = opts.module_name
    else:
        model_name = opts.model_name

    return model_name
563746
def create(blocks, mode='basic', inplanes=64, cardinality=4, image_features=64, divisor=4, num_classes=1000):
    
    block_dict = {
        # 'basic': BasicBlock,
        'bottleneck': ResNeXtBottleneck
    }

    def instantiate(**_):
        return ResNeXt(block_dict[mode], blocks, inplanes=inplanes, image_features=image_features, cardinality=cardinality, divisor=divisor, num_classes=num_classes)

    return ModelFactory.generic(instantiate)
58167
def model_from_str(self, model_str, debug=None,
                       pre_ref_resolution_callback=None):
        

        if type(model_str) is not text:
            raise TextXError("textX accepts only unicode strings.")

        model = self._parser_blueprint.clone().get_model_from_str(
            model_str, debug=debug,
            pre_ref_resolution_callback=pre_ref_resolution_callback)
        for p in self._model_processors:
            p(model, self)
        return model
1160068
def create_model(text_in,
                 labels,
                 timesteps,
                 per_example_weights,
                 phase=pt.Phase.train):
  """"""
  with pt.defaults_scope(phase=phase, l2loss=0.00001):
    # The embedding lookup must be placed on a cpu.
    with tf.device('/cpu:0'):
      embedded = text_in.embedding_lookup(CHARS, [EMBEDDING_SIZE])
    # We need to cleave the sequence because sequence lstm expect each
    # timestep to be in its own Tensor.
    lstm = (embedded.cleave_sequence(timesteps).sequence_lstm(CHARS))

    # The classifier is much more efficient if it runs across the entire
    # batch at once, so we want to squash (i.e. uncleave).
    #
    # Hidden nodes is set to 32 because it seems to work well.
    return (lstm.squash_sequence().fully_connected(32,
                                                   activation_fn=tf.nn.relu)
            .dropout(0.7)
            .softmax_classifier(SEXES,
                                labels,
                                per_example_weights=per_example_weights))