body
stringlengths
26
98.2k
body_hash
int64
-9,222,864,604,528,158,000
9,221,803,474B
docstring
stringlengths
1
16.8k
path
stringlengths
5
230
name
stringlengths
1
96
repository_name
stringlengths
7
89
lang
stringclasses
1 value
body_without_docstring
stringlengths
20
98.2k
def __decide_h_extension(self): "\n Decides which language 'owns' how many .h files\n\n :returns: The report with divided header files\n " report = self.__report h_files = report['C']['.h'] if (h_files > 0): c_files = (sum(report['C'].values()) - h_files) cpp_files =...
5,973,847,334,793,231,000
Decides which language 'owns' how many .h files :returns: The report with divided header files
gitScrabber/scrabTasks/file/languageDetector.py
__decide_h_extension
Eyenseo/gitScrabber
python
def __decide_h_extension(self): "\n Decides which language 'owns' how many .h files\n\n :returns: The report with divided header files\n " report = self.__report h_files = report['C']['.h'] if (h_files > 0): c_files = (sum(report['C'].values()) - h_files) cpp_files =...
def __calculate_main_language(self, report): '\n Calculates the main language (maximum of files extensions)\n\n :param report: The report\n\n :returns: The main language.\n ' max_files = 0 max_lang = None for language in report: lang_fiels = sum(report[language].v...
8,954,739,240,078,890,000
Calculates the main language (maximum of files extensions) :param report: The report :returns: The main language.
gitScrabber/scrabTasks/file/languageDetector.py
__calculate_main_language
Eyenseo/gitScrabber
python
def __calculate_main_language(self, report): '\n Calculates the main language (maximum of files extensions)\n\n :param report: The report\n\n :returns: The main language.\n ' max_files = 0 max_lang = None for language in report: lang_fiels = sum(report[language].v...
def __calculate_used_languages(self, report): '\n Calculates the used languages by throwing away the extension counts and\n collapsing them to the language. Only languages that have at least one\n file extension are kept and will appear in the report\n\n :param report: The report\n\n...
8,194,500,951,750,470,000
Calculates the used languages by throwing away the extension counts and collapsing them to the language. Only languages that have at least one file extension are kept and will appear in the report :param report: The report :returns: The used languages.
gitScrabber/scrabTasks/file/languageDetector.py
__calculate_used_languages
Eyenseo/gitScrabber
python
def __calculate_used_languages(self, report): '\n Calculates the used languages by throwing away the extension counts and\n collapsing them to the language. Only languages that have at least one\n file extension are kept and will appear in the report\n\n :param report: The report\n\n...
def scrab(self, project, filepath, file): '\n Counts the files that have an extension of one of the languages\n\n :param project: The project that the scrab task shall analyse\n :param filepath: The filepath to the file that can be analysed\n :param file: The file as str...
9,044,298,979,763,655,000
Counts the files that have an extension of one of the languages :param project: The project that the scrab task shall analyse :param filepath: The filepath to the file that can be analysed :param file: The file as string that can be analysed :returns: Report that contains the scrabbed information of ...
gitScrabber/scrabTasks/file/languageDetector.py
scrab
Eyenseo/gitScrabber
python
def scrab(self, project, filepath, file): '\n Counts the files that have an extension of one of the languages\n\n :param project: The project that the scrab task shall analyse\n :param filepath: The filepath to the file that can be analysed\n :param file: The file as str...
def report(self): '\n Decides which headers files are (probable) from which language,\n calculates the main language and removes redundant / unnecessary\n detailed information from the report\n\n :param report: The complete report this task created\n\n :returns: Report that c...
3,744,189,683,670,182,400
Decides which headers files are (probable) from which language, calculates the main language and removes redundant / unnecessary detailed information from the report :param report: The complete report this task created :returns: Report that contains all scrabbed information eg.: LanguageDetec...
gitScrabber/scrabTasks/file/languageDetector.py
report
Eyenseo/gitScrabber
python
def report(self): '\n Decides which headers files are (probable) from which language,\n calculates the main language and removes redundant / unnecessary\n detailed information from the report\n\n :param report: The complete report this task created\n\n :returns: Report that c...
def main(): 'Hep Mortality Prediction App' st.markdown(html_temp.format('royalblue'), unsafe_allow_html=True) menu = ['Home', 'Login', 'SignUp'] sub_menu = ['Plot', 'Prediction'] choice = st.sidebar.selectbox('Menu', menu) if (choice == 'Home'): st.subheader('Home') st.markdown(d...
1,479,472,205,569,399,300
Hep Mortality Prediction App
app.py
main
Let-Me-Code/Hepatitis-B-Mortality-Prediction
python
def main(): st.markdown(html_temp.format('royalblue'), unsafe_allow_html=True) menu = ['Home', 'Login', 'SignUp'] sub_menu = ['Plot', 'Prediction'] choice = st.sidebar.selectbox('Menu', menu) if (choice == 'Home'): st.subheader('Home') st.markdown(descriptive_message_temp, unsaf...
@property def num_preds(self): 'int: the number of predictions in this assignment' return len(self.gt_inds)
7,780,834,999,563,918,000
int: the number of predictions in this assignment
mmdet3d/models/dense_heads/assigner/assign_result.py
num_preds
yangzilongdmgy/merge_monster_3d
python
@property def num_preds(self): return len(self.gt_inds)
def set_extra_property(self, key, value): 'Set user-defined new property.' assert (key not in self.info) self._extra_properties[key] = value
393,492,990,254,824,600
Set user-defined new property.
mmdet3d/models/dense_heads/assigner/assign_result.py
set_extra_property
yangzilongdmgy/merge_monster_3d
python
def set_extra_property(self, key, value): assert (key not in self.info) self._extra_properties[key] = value
def get_extra_property(self, key): 'Get user-defined property.' return self._extra_properties.get(key, None)
-7,626,049,926,330,966,000
Get user-defined property.
mmdet3d/models/dense_heads/assigner/assign_result.py
get_extra_property
yangzilongdmgy/merge_monster_3d
python
def get_extra_property(self, key): return self._extra_properties.get(key, None)
@property def info(self): 'dict: a dictionary of info about the object' basic_info = {'num_gts': self.num_gts, 'num_preds': self.num_preds, 'gt_inds': self.gt_inds, 'max_overlaps': self.max_overlaps, 'labels': self.labels} basic_info.update(self._extra_properties) return basic_info
8,762,152,943,817,003,000
dict: a dictionary of info about the object
mmdet3d/models/dense_heads/assigner/assign_result.py
info
yangzilongdmgy/merge_monster_3d
python
@property def info(self): basic_info = {'num_gts': self.num_gts, 'num_preds': self.num_preds, 'gt_inds': self.gt_inds, 'max_overlaps': self.max_overlaps, 'labels': self.labels} basic_info.update(self._extra_properties) return basic_info
def __nice__(self): 'str: a "nice" summary string describing this assign result' parts = [] parts.append(f'num_gts={self.num_gts!r}') if (self.gt_inds is None): parts.append(f'gt_inds={self.gt_inds!r}') else: parts.append(f'gt_inds.shape={tuple(self.gt_inds.shape)!r}') if (self.m...
-2,866,129,337,503,404,000
str: a "nice" summary string describing this assign result
mmdet3d/models/dense_heads/assigner/assign_result.py
__nice__
yangzilongdmgy/merge_monster_3d
python
def __nice__(self): parts = [] parts.append(f'num_gts={self.num_gts!r}') if (self.gt_inds is None): parts.append(f'gt_inds={self.gt_inds!r}') else: parts.append(f'gt_inds.shape={tuple(self.gt_inds.shape)!r}') if (self.max_overlaps is None): parts.append(f'max_overlaps={s...
@classmethod def random(cls, **kwargs): 'Create random AssignResult for tests or debugging.\n\n Args:\n num_preds: number of predicted boxes\n num_gts: number of true boxes\n p_ignore (float): probability of a predicted box assinged to an\n ignored truth\n ...
1,650,000,623,902,313,500
Create random AssignResult for tests or debugging. Args: num_preds: number of predicted boxes num_gts: number of true boxes p_ignore (float): probability of a predicted box assinged to an ignored truth p_assigned (float): probability of a predicted box not being assigned p_use_label...
mmdet3d/models/dense_heads/assigner/assign_result.py
random
yangzilongdmgy/merge_monster_3d
python
@classmethod def random(cls, **kwargs): 'Create random AssignResult for tests or debugging.\n\n Args:\n num_preds: number of predicted boxes\n num_gts: number of true boxes\n p_ignore (float): probability of a predicted box assinged to an\n ignored truth\n ...
def add_gt_(self, gt_labels): 'Add ground truth as assigned results.\n\n Args:\n gt_labels (torch.Tensor): Labels of gt boxes\n ' self_inds = torch.arange(1, (len(gt_labels) + 1), dtype=torch.long, device=gt_labels.device) self.gt_inds = torch.cat([self_inds, self.gt_inds]) self...
6,881,752,854,443,798,000
Add ground truth as assigned results. Args: gt_labels (torch.Tensor): Labels of gt boxes
mmdet3d/models/dense_heads/assigner/assign_result.py
add_gt_
yangzilongdmgy/merge_monster_3d
python
def add_gt_(self, gt_labels): 'Add ground truth as assigned results.\n\n Args:\n gt_labels (torch.Tensor): Labels of gt boxes\n ' self_inds = torch.arange(1, (len(gt_labels) + 1), dtype=torch.long, device=gt_labels.device) self.gt_inds = torch.cat([self_inds, self.gt_inds]) self...
def glue(self, pos): '\n Behaves like simple line port, but for folded interface suggests\n connection to the middle point of a port.\n ' if self.is_folded(): px = ((self.start.x + self.end.x) / 2) py = ((self.start.y + self.end.y) / 2) d = distance_point_point((px, ...
8,054,494,464,208,342,000
Behaves like simple line port, but for folded interface suggests connection to the middle point of a port.
gaphor/diagram/classes/interface.py
glue
987Frogh/Makehuman
python
def glue(self, pos): '\n Behaves like simple line port, but for folded interface suggests\n connection to the middle point of a port.\n ' if self.is_folded(): px = ((self.start.x + self.end.x) / 2) py = ((self.start.y + self.end.y) / 2) d = distance_point_point((px, ...
def _set_folded(self, folded): '\n Set folded notation.\n\n :param folded: Folded state, see Folded.* enum.\n ' if (self._folded == folded): return self._folded = folded if (folded == Folded.NONE): movable = True else: if (self._folded == Folded.PROVIDED)...
614,404,046,103,405,400
Set folded notation. :param folded: Folded state, see Folded.* enum.
gaphor/diagram/classes/interface.py
_set_folded
987Frogh/Makehuman
python
def _set_folded(self, folded): '\n Set folded notation.\n\n :param folded: Folded state, see Folded.* enum.\n ' if (self._folded == folded): return self._folded = folded if (folded == Folded.NONE): movable = True else: if (self._folded == Folded.PROVIDED)...
def main(argv): '\n Main function.\n ' (result_dir, src_dir) = options_script(argv) run(result_dir, src_dir)
7,503,100,500,502,827,000
Main function.
Outils/TRIOXDATA/XTriou/Extract_xdata.py
main
cea-trust-platform/trust-code
python
def main(argv): '\n \n ' (result_dir, src_dir) = options_script(argv) run(result_dir, src_dir)
def assert_matches_stdout(actual, expected_stdout, normalize_fn=(lambda elem: elem), label=''): 'Asserts a PCollection of strings matches the expected stdout elements.\n\n Args:\n actual (beam.PCollection): A PCollection.\n expected (List[str]): A list of stdout elements, one line per element.\n normalize...
-4,696,306,568,593,374,000
Asserts a PCollection of strings matches the expected stdout elements. Args: actual (beam.PCollection): A PCollection. expected (List[str]): A list of stdout elements, one line per element. normalize_fn (Function[any]): A function to normalize elements before comparing them. Can be used to sort lists befor...
sdks/python/apache_beam/examples/snippets/util.py
assert_matches_stdout
DevangiDas/beam
python
def assert_matches_stdout(actual, expected_stdout, normalize_fn=(lambda elem: elem), label=): 'Asserts a PCollection of strings matches the expected stdout elements.\n\n Args:\n actual (beam.PCollection): A PCollection.\n expected (List[str]): A list of stdout elements, one line per element.\n normalize_f...
def run_shell_commands(commands, **kwargs): 'Runs a list of Notebook-like shell commands.\n\n Lines starting with `#` are ignored as comments.\n Lines starting with `!` are run as commands.\n Variables like `{variable}` are substituted with **kwargs.\n ' for cmd in commands: cmd = cmd.strip().lstrip...
8,061,451,941,788,008,000
Runs a list of Notebook-like shell commands. Lines starting with `#` are ignored as comments. Lines starting with `!` are run as commands. Variables like `{variable}` are substituted with **kwargs.
sdks/python/apache_beam/examples/snippets/util.py
run_shell_commands
DevangiDas/beam
python
def run_shell_commands(commands, **kwargs): 'Runs a list of Notebook-like shell commands.\n\n Lines starting with `#` are ignored as comments.\n Lines starting with `!` are run as commands.\n Variables like `{variable}` are substituted with **kwargs.\n ' for cmd in commands: cmd = cmd.strip().lstrip...
def __init__(self, parnames=[], name=''): '\n :param parnames:\n A list of names of the kernel params, used to alias the intrinsic\n parameter names. This way different instances of the same kernel\n can have different parameter names.\n ' if (len(parnames) == 0):...
80,885,053,197,826,180
:param parnames: A list of names of the kernel params, used to alias the intrinsic parameter names. This way different instances of the same kernel can have different parameter names.
prospect/likelihood/kernels.py
__init__
errai34/prospector
python
def __init__(self, parnames=[], name=): '\n :param parnames:\n A list of names of the kernel params, used to alias the intrinsic\n parameter names. This way different instances of the same kernel\n can have different parameter names.\n ' if (len(parnames) == 0): ...
def update(self, **kwargs): 'Take a dictionary of parameters, pick out the properly named\n parameters according to the alias, and put them in the param state\n dictionary.\n ' for k in self.kernel_params: self.params[k] = kwargs[self.param_alias[k]]
-4,019,182,405,496,869,400
Take a dictionary of parameters, pick out the properly named parameters according to the alias, and put them in the param state dictionary.
prospect/likelihood/kernels.py
update
errai34/prospector
python
def update(self, **kwargs): 'Take a dictionary of parameters, pick out the properly named\n parameters according to the alias, and put them in the param state\n dictionary.\n ' for k in self.kernel_params: self.params[k] = kwargs[self.param_alias[k]]
def __call__(self, metric, weights=None, ndim=2, **extras): 'Return a covariance matrix, given a metric. Optionally, multiply\n the output kernel by a weight function to induce non-stationarity.\n ' k = self.construct_kernel(metric) if (ndim != k.ndim): k = np.diag(k) if (weights ...
1,769,017,840,861,649,200
Return a covariance matrix, given a metric. Optionally, multiply the output kernel by a weight function to induce non-stationarity.
prospect/likelihood/kernels.py
__call__
errai34/prospector
python
def __call__(self, metric, weights=None, ndim=2, **extras): 'Return a covariance matrix, given a metric. Optionally, multiply\n the output kernel by a weight function to induce non-stationarity.\n ' k = self.construct_kernel(metric) if (ndim != k.ndim): k = np.diag(k) if (weights ...
def construct_kernel(self, metric): 'Construct an exponential squared covariance matrix.\n ' (a, l) = (self.params['amplitude'], self.params['length']) Sigma = ((a ** 2) * np.exp(((- ((metric[:, None] - metric[None, :]) ** 2)) / (2 * (l ** 2))))) return Sigma
-3,748,341,603,669,811,000
Construct an exponential squared covariance matrix.
prospect/likelihood/kernels.py
construct_kernel
errai34/prospector
python
def construct_kernel(self, metric): '\n ' (a, l) = (self.params['amplitude'], self.params['length']) Sigma = ((a ** 2) * np.exp(((- ((metric[:, None] - metric[None, :]) ** 2)) / (2 * (l ** 2))))) return Sigma
def construct_kernel(self, metric): 'Construct a Matern kernel covariance matrix, for \nu=3/2.\n ' (a, l) = (self.params['amplitude'], self.params['length']) Sigma = ((np.sqrt(3) * np.abs((metric[:, None] - metric[None, :]))) / l) Sigma = (((a ** 2) * (1 + Sigma)) * np.exp((- Sigma))) return ...
-2,407,672,587,236,184,600
Construct a Matern kernel covariance matrix, for u=3/2.
prospect/likelihood/kernels.py
construct_kernel
errai34/prospector
python
def construct_kernel(self, metric): 'Construct a Matern kernel covariance matrix, for \nu=3/2.\n ' (a, l) = (self.params['amplitude'], self.params['length']) Sigma = ((np.sqrt(3) * np.abs((metric[:, None] - metric[None, :]))) / l) Sigma = (((a ** 2) * (1 + Sigma)) * np.exp((- Sigma))) return ...
def print(self): " Method prints person's data.\n\n :return: None\n " print('Name: {}, age: {}, phone: {}'.format(self.name, self.age, self.phone))
2,257,337,300,328,433,200
Method prints person's data. :return: None
person.py
print
jhsaraja/testiprojekti
python
def print(self): " Method prints person's data.\n\n :return: None\n " print('Name: {}, age: {}, phone: {}'.format(self.name, self.age, self.phone))
def set_name(self, name): ' Method saves a new name for the person.\n\n :param name: new name for the person, string\n :return: None\n ' self.name = name
-8,456,299,319,435,507,000
Method saves a new name for the person. :param name: new name for the person, string :return: None
person.py
set_name
jhsaraja/testiprojekti
python
def set_name(self, name): ' Method saves a new name for the person.\n\n :param name: new name for the person, string\n :return: None\n ' self.name = name
def get_name(self): ' Method returns the name of the person.\n\n :return: name, string\n ' return self.name
8,722,847,781,120,407,000
Method returns the name of the person. :return: name, string
person.py
get_name
jhsaraja/testiprojekti
python
def get_name(self): ' Method returns the name of the person.\n\n :return: name, string\n ' return self.name
def set_age(self, age): ' Method saves a new age for the person.\n\n :param age: new age for the person, integer\n :return: None\n ' if (type(age) != int): print('not valid age {}'.format(age)) return if (age >= 0): self.age = age else: print('not val...
2,367,029,125,253,940,000
Method saves a new age for the person. :param age: new age for the person, integer :return: None
person.py
set_age
jhsaraja/testiprojekti
python
def set_age(self, age): ' Method saves a new age for the person.\n\n :param age: new age for the person, integer\n :return: None\n ' if (type(age) != int): print('not valid age {}'.format(age)) return if (age >= 0): self.age = age else: print('not val...
def get_age(self): ' Method returns the age of the person.\n\n :return: age, integer\n ' return self.age
5,929,410,324,352,048,000
Method returns the age of the person. :return: age, integer
person.py
get_age
jhsaraja/testiprojekti
python
def get_age(self): ' Method returns the age of the person.\n\n :return: age, integer\n ' return self.age
def set_phone(self, phone): ' Method saves a new phone for the person.\n\n :param phone: new phone for the person, string\n :return: None\n ' self.phone = phone
8,880,604,806,047,877,000
Method saves a new phone for the person. :param phone: new phone for the person, string :return: None
person.py
set_phone
jhsaraja/testiprojekti
python
def set_phone(self, phone): ' Method saves a new phone for the person.\n\n :param phone: new phone for the person, string\n :return: None\n ' self.phone = phone
def get_phone(self): ' Method returns the phone of the person.\n\n :return: phone, string\n ' return self.phone
-1,529,533,477,153,461,500
Method returns the phone of the person. :return: phone, string
person.py
get_phone
jhsaraja/testiprojekti
python
def get_phone(self): ' Method returns the phone of the person.\n\n :return: phone, string\n ' return self.phone
def get_title(self): ' Method returns the title of the person.\n\n :return: title, string\n ' return self.title
7,125,931,693,280,901,000
Method returns the title of the person. :return: title, string
person.py
get_title
jhsaraja/testiprojekti
python
def get_title(self): ' Method returns the title of the person.\n\n :return: title, string\n ' return self.title
def set_title(self, title): ' Method saves a new title for the person.\n\n :param title: new title for the person, string\n :return: None\n ' self.title = title
-5,331,485,032,930,876,000
Method saves a new title for the person. :param title: new title for the person, string :return: None
person.py
set_title
jhsaraja/testiprojekti
python
def set_title(self, title): ' Method saves a new title for the person.\n\n :param title: new title for the person, string\n :return: None\n ' self.title = title
def get_salary(self): ' Method returns the salary of the person.\n\n :return: salary, string\n ' return self.salary
-3,578,107,366,643,422,000
Method returns the salary of the person. :return: salary, string
person.py
get_salary
jhsaraja/testiprojekti
python
def get_salary(self): ' Method returns the salary of the person.\n\n :return: salary, string\n ' return self.salary
def set_salary(self, salary): ' Method saves a new salary for the person.\n\n :param salary: new salary for the person, string\n :return: None\n ' if (salary >= 0): self.salary = salary
4,689,736,759,264,431,000
Method saves a new salary for the person. :param salary: new salary for the person, string :return: None
person.py
set_salary
jhsaraja/testiprojekti
python
def set_salary(self, salary): ' Method saves a new salary for the person.\n\n :param salary: new salary for the person, string\n :return: None\n ' if (salary >= 0): self.salary = salary
def get_location(self): ' Method returns the location of the person.\n\n :return: location, string\n ' return self.location
1,266,652,687,538,883,800
Method returns the location of the person. :return: location, string
person.py
get_location
jhsaraja/testiprojekti
python
def get_location(self): ' Method returns the location of the person.\n\n :return: location, string\n ' return self.location
def set_location(self, location): ' Method saves a new location for the person.\n\n :param location: new location for the person, string\n :return: None\n ' self.location = location
5,467,453,087,817,736,000
Method saves a new location for the person. :param location: new location for the person, string :return: None
person.py
set_location
jhsaraja/testiprojekti
python
def set_location(self, location): ' Method saves a new location for the person.\n\n :param location: new location for the person, string\n :return: None\n ' self.location = location
def print_businesscard(self): ' Method prints a business card information.\n\n :return: None\n ' print(' Name: {}\n Title: {}\n Phone: {}'.format(self.name, self.title, self.phone))
-6,489,935,535,142,710,000
Method prints a business card information. :return: None
person.py
print_businesscard
jhsaraja/testiprojekti
python
def print_businesscard(self): ' Method prints a business card information.\n\n :return: None\n ' print(' Name: {}\n Title: {}\n Phone: {}'.format(self.name, self.title, self.phone))
def get_defaults(lang): 'Get the language-specific defaults, if available in spaCy. This allows\n using lexical attribute getters that depend on static language data, e.g.\n Token.like_num, Token.is_stop, Doc.noun_chunks etc.\n\n lang (unicode): The language code.\n RETURNS (Language.Defaults): The lang...
-7,850,812,653,197,558,000
Get the language-specific defaults, if available in spaCy. This allows using lexical attribute getters that depend on static language data, e.g. Token.like_num, Token.is_stop, Doc.noun_chunks etc. lang (unicode): The language code. RETURNS (Language.Defaults): The language defaults.
spacy_stanfordnlp/language.py
get_defaults
mehmetilker/spacy-stanfordnlp
python
def get_defaults(lang): 'Get the language-specific defaults, if available in spaCy. This allows\n using lexical attribute getters that depend on static language data, e.g.\n Token.like_num, Token.is_stop, Doc.noun_chunks etc.\n\n lang (unicode): The language code.\n RETURNS (Language.Defaults): The lang...
def __init__(self, snlp, meta=None, **kwargs): 'Initialize the Language class.\n\n Instead of "en" etc. we call the language "stanfordnlp_en" to not\n cause conflicts with spaCy\'s built-in languages. Using entry points,\n this also allows serializing and deserializing the language class\n ...
-5,133,790,172,121,754,000
Initialize the Language class. Instead of "en" etc. we call the language "stanfordnlp_en" to not cause conflicts with spaCy's built-in languages. Using entry points, this also allows serializing and deserializing the language class and "lang": "stanfordnlp_en" in the meta.json will automatically instantiate this class...
spacy_stanfordnlp/language.py
__init__
mehmetilker/spacy-stanfordnlp
python
def __init__(self, snlp, meta=None, **kwargs): 'Initialize the Language class.\n\n Instead of "en" etc. we call the language "stanfordnlp_en" to not\n cause conflicts with spaCy\'s built-in languages. Using entry points,\n this also allows serializing and deserializing the language class\n ...
def __init__(self, snlp, vocab): 'Initialize the tokenizer.\n\n snlp (stanfordnlp.Pipeline): The initialized StanfordNLP pipeline.\n vocab (spacy.vocab.Vocab): The vocabulary to use.\n RETURNS (Tokenizer): The custom tokenizer.\n ' self.snlp = snlp self.vocab = vocab
-2,122,144,844,259,570,200
Initialize the tokenizer. snlp (stanfordnlp.Pipeline): The initialized StanfordNLP pipeline. vocab (spacy.vocab.Vocab): The vocabulary to use. RETURNS (Tokenizer): The custom tokenizer.
spacy_stanfordnlp/language.py
__init__
mehmetilker/spacy-stanfordnlp
python
def __init__(self, snlp, vocab): 'Initialize the tokenizer.\n\n snlp (stanfordnlp.Pipeline): The initialized StanfordNLP pipeline.\n vocab (spacy.vocab.Vocab): The vocabulary to use.\n RETURNS (Tokenizer): The custom tokenizer.\n ' self.snlp = snlp self.vocab = vocab
def __call__(self, text): 'Convert a StanfordNLP Doc to a spaCy Doc.\n\n text (unicode): The text to process.\n RETURNS (spacy.tokens.Doc): The spaCy Doc object.\n ' snlp_doc = self.snlp(text) text = snlp_doc.text (tokens, heads) = self.get_tokens_with_heads(snlp_doc) if (not le...
621,916,058,141,886,700
Convert a StanfordNLP Doc to a spaCy Doc. text (unicode): The text to process. RETURNS (spacy.tokens.Doc): The spaCy Doc object.
spacy_stanfordnlp/language.py
__call__
mehmetilker/spacy-stanfordnlp
python
def __call__(self, text): 'Convert a StanfordNLP Doc to a spaCy Doc.\n\n text (unicode): The text to process.\n RETURNS (spacy.tokens.Doc): The spaCy Doc object.\n ' snlp_doc = self.snlp(text) text = snlp_doc.text (tokens, heads) = self.get_tokens_with_heads(snlp_doc) if (not le...
def get_tokens_with_heads(self, snlp_doc): 'Flatten the tokens in the StanfordNLP Doc and extract the token indices\n of the sentence start tokens to set is_sent_start.\n\n snlp_doc (stanfordnlp.Document): The processed StanfordNLP doc.\n RETURNS (list): The tokens (words).\n ' token...
-4,882,335,766,437,383,000
Flatten the tokens in the StanfordNLP Doc and extract the token indices of the sentence start tokens to set is_sent_start. snlp_doc (stanfordnlp.Document): The processed StanfordNLP doc. RETURNS (list): The tokens (words).
spacy_stanfordnlp/language.py
get_tokens_with_heads
mehmetilker/spacy-stanfordnlp
python
def get_tokens_with_heads(self, snlp_doc): 'Flatten the tokens in the StanfordNLP Doc and extract the token indices\n of the sentence start tokens to set is_sent_start.\n\n snlp_doc (stanfordnlp.Document): The processed StanfordNLP doc.\n RETURNS (list): The tokens (words).\n ' token...
def create_socket_pair(self): '\n Creates a local socket listening on a random port.\n ' server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.addCleanup(server.close) client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.addCleanup(client.close) return (server,...
-8,949,072,660,331,688,000
Creates a local socket listening on a random port.
tests/test_ws2_32/test_events.py
create_socket_pair
opalmer/pycffiwin32
python
def create_socket_pair(self): '\n \n ' server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.addCleanup(server.close) client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.addCleanup(client.close) return (server, client)
def check_config_status(self): "Check this subframe's configuration status.\n\n\n By default, incorrectly configured subframes in the database are not returned from\n :any:`Frame.mux_subframes` because they cannot be used in the bus communication.\n You can change this behavior by setting :any:...
-6,809,806,336,883,870,000
Check this subframe's configuration status. By default, incorrectly configured subframes in the database are not returned from :any:`Frame.mux_subframes` because they cannot be used in the bus communication. You can change this behavior by setting :any:`Database.show_invalid_from_open` to `True`. When a subframe conf...
nixnet/database/_subframe.py
check_config_status
bigoulours/nixnet-python
python
def check_config_status(self): "Check this subframe's configuration status.\n\n\n By default, incorrectly configured subframes in the database are not returned from\n :any:`Frame.mux_subframes` because they cannot be used in the bus communication.\n You can change this behavior by setting :any:...
def find(self, object_class, object_name): 'Finds an object in the database.\n\n This function finds a database object relative to this parent object.\n This object may be a grandparent or great-grandparent.\n\n If this object is a direct parent\n (for example, :any:`Frame<_frame.Frame>`...
2,359,012,860,875,746,000
Finds an object in the database. This function finds a database object relative to this parent object. This object may be a grandparent or great-grandparent. If this object is a direct parent (for example, :any:`Frame<_frame.Frame>` for :any:`Signal<_signal.Signal>`), the ``object_name`` to search for can be short, a...
nixnet/database/_subframe.py
find
bigoulours/nixnet-python
python
def find(self, object_class, object_name): 'Finds an object in the database.\n\n This function finds a database object relative to this parent object.\n This object may be a grandparent or great-grandparent.\n\n If this object is a direct parent\n (for example, :any:`Frame<_frame.Frame>`...
@property def dyn_signals(self): ':any:`DbCollection`: Returns a collection of dynamic :any:`Signal<_signal.Signal>` objects in the subframe.\n\n Those signals are transmitted when the multiplexer signal\n in the frame has the multiplexer value defined in the subframe.\n ' return self._dyn_...
-7,876,208,852,592,375,000
:any:`DbCollection`: Returns a collection of dynamic :any:`Signal<_signal.Signal>` objects in the subframe. Those signals are transmitted when the multiplexer signal in the frame has the multiplexer value defined in the subframe.
nixnet/database/_subframe.py
dyn_signals
bigoulours/nixnet-python
python
@property def dyn_signals(self): ':any:`DbCollection`: Returns a collection of dynamic :any:`Signal<_signal.Signal>` objects in the subframe.\n\n Those signals are transmitted when the multiplexer signal\n in the frame has the multiplexer value defined in the subframe.\n ' return self._dyn_...
@property def frm(self): ':any:`Frame<_frame.Frame>`: Returns the reference to the parent frame.\n\n The parent frame is defined when the subframe is created,\n and you cannot change it afterwards.\n ' handle = _props.get_subframe_frm_ref(self._handle) return _frame.Frame(_handle=handle...
747,096,797,756,296,700
:any:`Frame<_frame.Frame>`: Returns the reference to the parent frame. The parent frame is defined when the subframe is created, and you cannot change it afterwards.
nixnet/database/_subframe.py
frm
bigoulours/nixnet-python
python
@property def frm(self): ':any:`Frame<_frame.Frame>`: Returns the reference to the parent frame.\n\n The parent frame is defined when the subframe is created,\n and you cannot change it afterwards.\n ' handle = _props.get_subframe_frm_ref(self._handle) return _frame.Frame(_handle=handle...
@property def mux_value(self): 'int: Get or set the multiplexer value for this subframe.\n\n This property specifies the multiplexer signal value used when the\n dynamic signals in this subframe are transmitted in the frame.\n Only one subframe is transmitted at a time in the frame.\n\n ...
-2,052,745,770,387,338,800
int: Get or set the multiplexer value for this subframe. This property specifies the multiplexer signal value used when the dynamic signals in this subframe are transmitted in the frame. Only one subframe is transmitted at a time in the frame. There also is a multiplexer value for a signal object as a read-only prope...
nixnet/database/_subframe.py
mux_value
bigoulours/nixnet-python
python
@property def mux_value(self): 'int: Get or set the multiplexer value for this subframe.\n\n This property specifies the multiplexer signal value used when the\n dynamic signals in this subframe are transmitted in the frame.\n Only one subframe is transmitted at a time in the frame.\n\n ...
@property def name(self): 'str: Get or set the name of the subframe object.\n\n Lowercase letters, uppercase letters, numbers,\n and the underscore (_) are valid characters for the short name.\n The space ( ), period (.), and other special characters are not supported within the name.\n ...
-6,174,104,265,428,616,000
str: Get or set the name of the subframe object. Lowercase letters, uppercase letters, numbers, and the underscore (_) are valid characters for the short name. The space ( ), period (.), and other special characters are not supported within the name. The short name must begin with a letter (uppercase or lowercase) or ...
nixnet/database/_subframe.py
name
bigoulours/nixnet-python
python
@property def name(self): 'str: Get or set the name of the subframe object.\n\n Lowercase letters, uppercase letters, numbers,\n and the underscore (_) are valid characters for the short name.\n The space ( ), period (.), and other special characters are not supported within the name.\n ...
@property def pdu(self): ":any:`Pdu`: Returns the subframe's parent PDU.\n\n This property returns the reference to the subframe's parent PDU.\n The parent PDU is defined when the subframe object is created.\n You cannot change it afterwards.\n " from nixnet.database import _pdu ...
4,860,405,005,379,393,000
:any:`Pdu`: Returns the subframe's parent PDU. This property returns the reference to the subframe's parent PDU. The parent PDU is defined when the subframe object is created. You cannot change it afterwards.
nixnet/database/_subframe.py
pdu
bigoulours/nixnet-python
python
@property def pdu(self): ":any:`Pdu`: Returns the subframe's parent PDU.\n\n This property returns the reference to the subframe's parent PDU.\n The parent PDU is defined when the subframe object is created.\n You cannot change it afterwards.\n " from nixnet.database import _pdu ...
@property def name_unique_to_cluster(self): 'str: Returns a subframe name unique to the cluster that contains the subframe.\n\n If the single name is not unique within the cluster, the name is <frame-name>.<subframe-name>.\n\n You can pass the name to the `find` function to retrieve the reference to t...
9,096,425,762,100,041,000
str: Returns a subframe name unique to the cluster that contains the subframe. If the single name is not unique within the cluster, the name is <frame-name>.<subframe-name>. You can pass the name to the `find` function to retrieve the reference to the object, while the single name is not guaranteed success in `find` ...
nixnet/database/_subframe.py
name_unique_to_cluster
bigoulours/nixnet-python
python
@property def name_unique_to_cluster(self): 'str: Returns a subframe name unique to the cluster that contains the subframe.\n\n If the single name is not unique within the cluster, the name is <frame-name>.<subframe-name>.\n\n You can pass the name to the `find` function to retrieve the reference to t...
def log_gaussian(x, mean, sigma): '\n Computes the log-probability of X=x for a Gaussian of mean=mean and sigma=sigma\n Parameters\n ----------\n x\n mean\n sigma\n\n Returns\n -------\n\n ' log_pdf = ((- ((x - mean) ** 2)) / (2 * (sigma ** 2))) log_pdf = (log_pdf - np.log((np.sqr...
-581,951,873,479,949,700
Computes the log-probability of X=x for a Gaussian of mean=mean and sigma=sigma Parameters ---------- x mean sigma Returns -------
lstchain/image/pdf.py
log_gaussian
calispac/cta-lstchain
python
def log_gaussian(x, mean, sigma): '\n Computes the log-probability of X=x for a Gaussian of mean=mean and sigma=sigma\n Parameters\n ----------\n x\n mean\n sigma\n\n Returns\n -------\n\n ' log_pdf = ((- ((x - mean) ** 2)) / (2 * (sigma ** 2))) log_pdf = (log_pdf - np.log((np.sqr...
def set_seed(seed: int): '\n Helper function for reproducible behavior to set the seed in ``random``, ``numpy``, ``torch`` and/or ``tf`` (if\n installed).\n\n Args:\n seed (:obj:`int`): The seed to set.\n ' random.seed(seed) np.random.seed(seed) if is_torch_available(): torch....
1,569,534,815,772,305,700
Helper function for reproducible behavior to set the seed in ``random``, ``numpy``, ``torch`` and/or ``tf`` (if installed). Args: seed (:obj:`int`): The seed to set.
machine-learning/nlp/bert-text-classification/train.py
set_seed
AJuneSlop/pythoncode-tutorials
python
def set_seed(seed: int): '\n Helper function for reproducible behavior to set the seed in ``random``, ``numpy``, ``torch`` and/or ``tf`` (if\n installed).\n\n Args:\n seed (:obj:`int`): The seed to set.\n ' random.seed(seed) np.random.seed(seed) if is_torch_available(): torch....
def main(): '\n Unit tests\n ' max_depth = 4.0 numFrames = 10 height_ratio = 0.5 sub_sample = 1 reduce_to = 'middle_lower' print('Program settings:') print(('\tmax_depth: ' + str(max_depth))) print(('\tnumFrames: ' + str(numFrames))) print(('\theight_ratio: ' + str(height_r...
-4,685,269,840,475,023,000
Unit tests
Camera/camera.py
main
marioliu/AutonomousQuadblade
python
def main(): '\n \n ' max_depth = 4.0 numFrames = 10 height_ratio = 0.5 sub_sample = 1 reduce_to = 'middle_lower' print('Program settings:') print(('\tmax_depth: ' + str(max_depth))) print(('\tnumFrames: ' + str(numFrames))) print(('\theight_ratio: ' + str(height_ratio))) ...
def __init__(self, max_depth=4.0, save_images=False, t_buffer=5, output_dir='./Trials/'): '\n Intitalizes Camera object \n ' self.max_depth = max_depth self.save_images = save_images self.clock = time.time() self.t_buffer = t_buffer self.output_dir = output_dir self.data_dir = ...
559,276,931,801,889,150
Intitalizes Camera object
Camera/camera.py
__init__
marioliu/AutonomousQuadblade
python
def __init__(self, max_depth=4.0, save_images=False, t_buffer=5, output_dir='./Trials/'): '\n \n ' self.max_depth = max_depth self.save_images = save_images self.clock = time.time() self.t_buffer = t_buffer self.output_dir = output_dir self.data_dir = path.join(self.output_dir...
def connect(self): '\n Establishes connection to R200 camera\n ' logging.info('Cam.py: connecting components') self.serv = pyrs.Service() self.dev = self.serv.Device(device_id=0, streams=[pyrs.stream.DepthStream(fps=60), pyrs.stream.ColorStream(fps=60)])
8,347,761,966,569,549,000
Establishes connection to R200 camera
Camera/camera.py
connect
marioliu/AutonomousQuadblade
python
def connect(self): '\n \n ' logging.info('Cam.py: connecting components') self.serv = pyrs.Service() self.dev = self.serv.Device(device_id=0, streams=[pyrs.stream.DepthStream(fps=60), pyrs.stream.ColorStream(fps=60)])
def disconnect(self): '\n Disconnects from R200 camera\n ' self.dev.stop() self.serv.stop() logging.info('Cam.py: camera disconnected')
4,568,159,224,948,574,000
Disconnects from R200 camera
Camera/camera.py
disconnect
marioliu/AutonomousQuadblade
python
def disconnect(self): '\n \n ' self.dev.stop() self.serv.stop() logging.info('Cam.py: camera disconnected')
def getFrames(self, frames=5, rgb=False): '\n Retrieves depth frames (and RGB if true) from R200 input, cleans and averages depth images\n ' self.dev.wait_for_frames() depth = (self.dev.depth * self.dev.depth_scale) col = self.dev.color if (self.save_images and ((time.time() - self.clo...
-6,442,358,346,834,681,000
Retrieves depth frames (and RGB if true) from R200 input, cleans and averages depth images
Camera/camera.py
getFrames
marioliu/AutonomousQuadblade
python
def getFrames(self, frames=5, rgb=False): '\n \n ' self.dev.wait_for_frames() depth = (self.dev.depth * self.dev.depth_scale) col = self.dev.color if (self.save_images and ((time.time() - self.clock) > self.t_buffer)): np.save(path.join(self.data_dir, (str(time.time()) + '_d'))...
def reduceFrame(self, depth, height_ratio=0.5, sub_sample=0.3, reduce_to='lower'): '\n Takes in a depth image and rescales it\n\n Args:\n height_ratio: Determines fraction of rows to keep\n sub_sample: Scaling factor for image\n ' if ((height_ratio > 1.0) or (height_ra...
-3,983,497,567,927,168,500
Takes in a depth image and rescales it Args: height_ratio: Determines fraction of rows to keep sub_sample: Scaling factor for image
Camera/camera.py
reduceFrame
marioliu/AutonomousQuadblade
python
def reduceFrame(self, depth, height_ratio=0.5, sub_sample=0.3, reduce_to='lower'): '\n Takes in a depth image and rescales it\n\n Args:\n height_ratio: Determines fraction of rows to keep\n sub_sample: Scaling factor for image\n ' if ((height_ratio > 1.0) or (height_ra...
def parse_options(): 'process command line options.' parser = optparse.OptionParser('usage: %prog [options]') parser.add_option('--verbose', action='store_true', help='List lock files found and deleted') (options, args) = parser.parse_args() return (options, args)
4,582,584,220,910,883,000
process command line options.
tools/clean_file_locks.py
parse_options
bopopescu/extra-specs-1
python
def parse_options(): parser = optparse.OptionParser('usage: %prog [options]') parser.add_option('--verbose', action='store_true', help='List lock files found and deleted') (options, args) = parser.parse_args() return (options, args)
def main(): 'Main loop.' (options, args) = parse_options() verbose = options.verbose if verbose: LOG.logger.setLevel(logging.DEBUG) else: LOG.logger.setLevel(logging.INFO) LOG.info(('Cleaning stale locks from %s' % FLAGS.lock_path)) utils.cleanup_file_locks() LOG.info('Fi...
9,010,034,981,460,363,000
Main loop.
tools/clean_file_locks.py
main
bopopescu/extra-specs-1
python
def main(): (options, args) = parse_options() verbose = options.verbose if verbose: LOG.logger.setLevel(logging.DEBUG) else: LOG.logger.setLevel(logging.INFO) LOG.info(('Cleaning stale locks from %s' % FLAGS.lock_path)) utils.cleanup_file_locks() LOG.info('Finished')
def cli(self, interface='', output=None): 'parsing mechanism: cli\n\n Function cli() defines the cli type output parsing mechanism which\n typically contains 3 steps: exe\n cuting, transforming, returning\n ' parsed_dict = {} if (output is None): if interface: ...
-608,989,924,387,144,300
parsing mechanism: cli Function cli() defines the cli type output parsing mechanism which typically contains 3 steps: exe cuting, transforming, returning
src/genie/libs/parser/iosxe/show_interface.py
cli
Tristou27/genieparser
python
def cli(self, interface=, output=None): 'parsing mechanism: cli\n\n Function cli() defines the cli type output parsing mechanism which\n typically contains 3 steps: exe\n cuting, transforming, returning\n ' parsed_dict = {} if (output is None): if interface: c...
def yang(self): ' parsing mechanism: yang\n\n Function yang() defines the yang type output parsing mechanism which\n typically contains 3 steps: executing, transforming, returning\n ' pass
116,842,370,709,678,300
parsing mechanism: yang Function yang() defines the yang type output parsing mechanism which typically contains 3 steps: executing, transforming, returning
src/genie/libs/parser/iosxe/show_interface.py
yang
Tristou27/genieparser
python
def yang(self): ' parsing mechanism: yang\n\n Function yang() defines the yang type output parsing mechanism which\n typically contains 3 steps: executing, transforming, returning\n ' pass
def yang(self): 'parsing mechanism: yang\n\n Function yang() defines the yang type output parsing mechanism which\n typically contains 3 steps: executing, transforming, returning\n ' ret = {} cmd = '<native><interface><Vlan/></interface></native>' output = self.device.get(('subtree'...
4,722,897,063,672,879,000
parsing mechanism: yang Function yang() defines the yang type output parsing mechanism which typically contains 3 steps: executing, transforming, returning
src/genie/libs/parser/iosxe/show_interface.py
yang
Tristou27/genieparser
python
def yang(self): 'parsing mechanism: yang\n\n Function yang() defines the yang type output parsing mechanism which\n typically contains 3 steps: executing, transforming, returning\n ' ret = {} cmd = '<native><interface><Vlan/></interface></native>' output = self.device.get(('subtree'...
def _gather(params, indices, validate_indices=None, axis=None, batch_dims=0, name=None): 'gather.' indices = ops.convert_to_tensor(indices, dtype_hint=np.int32) if (validate_indices is not None): raise NotImplementedError('Argument `validate_indices != None` is currently unimplemented.') if (bat...
1,254,113,188,679,910,000
gather.
tensorflow_probability/python/internal/backend/numpy/numpy_array.py
_gather
michalbrys/probability
python
def _gather(params, indices, validate_indices=None, axis=None, batch_dims=0, name=None): indices = ops.convert_to_tensor(indices, dtype_hint=np.int32) if (validate_indices is not None): raise NotImplementedError('Argument `validate_indices != None` is currently unimplemented.') if (batch_dims <...
def _args_to_matching_arrays(args_list, dtype_hint=None): 'Converts a list to array using the first element for dtype.\n\n This method is used to match the behavior of `tf.concat`.\n\n Args:\n args_list: A list or tuple of arguments.\n dtype_hint: An optional hint used when converting the args to tensors.\n...
5,353,915,506,816,408,000
Converts a list to array using the first element for dtype. This method is used to match the behavior of `tf.concat`. Args: args_list: A list or tuple of arguments. dtype_hint: An optional hint used when converting the args to tensors. Returns: A list of tensors.
tensorflow_probability/python/internal/backend/numpy/numpy_array.py
_args_to_matching_arrays
michalbrys/probability
python
def _args_to_matching_arrays(args_list, dtype_hint=None): 'Converts a list to array using the first element for dtype.\n\n This method is used to match the behavior of `tf.concat`.\n\n Args:\n args_list: A list or tuple of arguments.\n dtype_hint: An optional hint used when converting the args to tensors.\n...
def _gather_nd(params, indices, batch_dims=0, name=None): 'gather_nd.' indices = ops.convert_to_tensor(indices, dtype_hint=np.int32) if (batch_dims < 0): raise NotImplementedError('Negative `batch_dims` is currently unsupported.') if ((not JAX_MODE) and (batch_dims > 0)): raise NotImplem...
-6,853,863,073,649,036,000
gather_nd.
tensorflow_probability/python/internal/backend/numpy/numpy_array.py
_gather_nd
michalbrys/probability
python
def _gather_nd(params, indices, batch_dims=0, name=None): indices = ops.convert_to_tensor(indices, dtype_hint=np.int32) if (batch_dims < 0): raise NotImplementedError('Negative `batch_dims` is currently unsupported.') if ((not JAX_MODE) and (batch_dims > 0)): raise NotImplementedError('...
def _linspace(start, stop, num, name=None, axis=0): 'Match TF behavior with np.linspace.' start = ops.convert_to_tensor(start) if np.issubdtype(start.dtype, np.integer): start = start.astype(np.float64) stop = ops.convert_to_tensor(stop, dtype=start.dtype) num = ops.convert_to_tensor(num, dt...
-7,066,821,717,063,519,000
Match TF behavior with np.linspace.
tensorflow_probability/python/internal/backend/numpy/numpy_array.py
_linspace
michalbrys/probability
python
def _linspace(start, stop, num, name=None, axis=0): start = ops.convert_to_tensor(start) if np.issubdtype(start.dtype, np.integer): start = start.astype(np.float64) stop = ops.convert_to_tensor(stop, dtype=start.dtype) num = ops.convert_to_tensor(num, dtype_hint=np.int32) if (not np.iss...
def _one_hot(indices, depth, on_value=None, off_value=None, axis=None, dtype=None, name=None): 'One hot.' if (on_value is None): on_value = 1 if (off_value is None): off_value = 0 if (dtype is None): dtype = utils.common_dtype([on_value, off_value], np.float32) indices = np.a...
1,411,797,174,937,303,300
One hot.
tensorflow_probability/python/internal/backend/numpy/numpy_array.py
_one_hot
michalbrys/probability
python
def _one_hot(indices, depth, on_value=None, off_value=None, axis=None, dtype=None, name=None): if (on_value is None): on_value = 1 if (off_value is None): off_value = 0 if (dtype is None): dtype = utils.common_dtype([on_value, off_value], np.float32) indices = np.array(indic...
def _range(start, limit=None, delta=1, dtype=None, name='range'): 'Emulates tf.range.' dtype = utils.numpy_dtype(dtype) start = ops.convert_to_tensor(start, dtype=dtype) limit = (None if (limit is None) else ops.convert_to_tensor(limit, dtype=dtype)) delta = ops.convert_to_tensor(delta, dtype=dtype)...
5,974,374,142,208,092,000
Emulates tf.range.
tensorflow_probability/python/internal/backend/numpy/numpy_array.py
_range
michalbrys/probability
python
def _range(start, limit=None, delta=1, dtype=None, name='range'): dtype = utils.numpy_dtype(dtype) start = ops.convert_to_tensor(start, dtype=dtype) limit = (None if (limit is None) else ops.convert_to_tensor(limit, dtype=dtype)) delta = ops.convert_to_tensor(delta, dtype=dtype) if (dtype is No...
def _searchsorted(sorted_sequence, values, side='left', out_type=np.int32, name=None): 'Find indices for insertion for list to remain sorted.' if JAX_MODE: try: func = _searchsorted_vmap_sides[side] except KeyError: raise ValueError(("'%s' is an invalid value for keyword ...
-3,334,490,459,446,652,000
Find indices for insertion for list to remain sorted.
tensorflow_probability/python/internal/backend/numpy/numpy_array.py
_searchsorted
michalbrys/probability
python
def _searchsorted(sorted_sequence, values, side='left', out_type=np.int32, name=None): if JAX_MODE: try: func = _searchsorted_vmap_sides[side] except KeyError: raise ValueError(("'%s' is an invalid value for keyword 'side'" % side)) sorted_sequence_2d = np.reshap...
def _split(value, num_or_size_splits, axis=0, num=None, name='split'): 'Map tf.split -> np.split.' indices_or_sections = np.array(num_or_size_splits) if (indices_or_sections.ndim == 1): if any(((idx == (- 1)) for idx in indices_or_sections)): total_splits = sum((idx for idx in indices_or...
6,905,526,348,121,598,000
Map tf.split -> np.split.
tensorflow_probability/python/internal/backend/numpy/numpy_array.py
_split
michalbrys/probability
python
def _split(value, num_or_size_splits, axis=0, num=None, name='split'): indices_or_sections = np.array(num_or_size_splits) if (indices_or_sections.ndim == 1): if any(((idx == (- 1)) for idx in indices_or_sections)): total_splits = sum((idx for idx in indices_or_sections if (idx != (- 1))...
@staticmethod def run(path, code=None, params=None, **meta): 'Check code with pycodestyle.\n\n :return list: List of errors.\n ' parser = get_parser() for option in parser.option_list: if (option.dest and (option.dest in params)): value = params[option.dest] if ...
7,664,685,662,998,880,000
Check code with pycodestyle. :return list: List of errors.
vimfiles/bundle/vim-python/submodules/pylama/pylama/lint/pylama_pycodestyle.py
run
BHills15/vimrc
python
@staticmethod def run(path, code=None, params=None, **meta): 'Check code with pycodestyle.\n\n :return list: List of errors.\n ' parser = get_parser() for option in parser.option_list: if (option.dest and (option.dest in params)): value = params[option.dest] if ...
def init_file(self, filename, lines, expected, line_offset): 'Prepare storage for errors.' super(_PycodestyleReport, self).init_file(filename, lines, expected, line_offset) self.errors = []
-8,009,620,792,537,842,000
Prepare storage for errors.
vimfiles/bundle/vim-python/submodules/pylama/pylama/lint/pylama_pycodestyle.py
init_file
BHills15/vimrc
python
def init_file(self, filename, lines, expected, line_offset): super(_PycodestyleReport, self).init_file(filename, lines, expected, line_offset) self.errors = []
def error(self, line_number, offset, text, check): 'Save errors.' code = super(_PycodestyleReport, self).error(line_number, offset, text, check) if code: self.errors.append(dict(text=text, type=code.replace('E', 'C'), col=(offset + 1), lnum=line_number))
-7,287,559,401,521,401,000
Save errors.
vimfiles/bundle/vim-python/submodules/pylama/pylama/lint/pylama_pycodestyle.py
error
BHills15/vimrc
python
def error(self, line_number, offset, text, check): code = super(_PycodestyleReport, self).error(line_number, offset, text, check) if code: self.errors.append(dict(text=text, type=code.replace('E', 'C'), col=(offset + 1), lnum=line_number))
def get_file_results(self): 'Get errors.\n\n :return list: List of errors.\n\n ' return self.errors
6,514,165,612,194,767,000
Get errors. :return list: List of errors.
vimfiles/bundle/vim-python/submodules/pylama/pylama/lint/pylama_pycodestyle.py
get_file_results
BHills15/vimrc
python
def get_file_results(self): 'Get errors.\n\n :return list: List of errors.\n\n ' return self.errors
def load_conf_from_file(conf_file_path, conf=__conf__): '\n Load conf file from: conf_file_path\n ' if (os.path.isfile(conf_file_path) == False): raise AgentConfigError('Missing configuration in {0}'.format(conf_file_path)) try: content = fileutil.read_file(conf_file_path) conf...
-1,907,993,394,519,222,800
Load conf file from: conf_file_path
azurelinuxagent/common/conf.py
load_conf_from_file
vittyvk/WALinuxAgent
python
def load_conf_from_file(conf_file_path, conf=__conf__): '\n \n ' if (os.path.isfile(conf_file_path) == False): raise AgentConfigError('Missing configuration in {0}'.format(conf_file_path)) try: content = fileutil.read_file(conf_file_path) conf.load(content) except IOError a...
@tf_export('block_lstm') def block_lstm(seq_len_max, x, cs_prev, h_prev, w, wci, wcf, wco, b, forget_bias=1, cell_clip=3, use_peephole=False, name=None): "Computes the LSTM cell forward propagation for all the time steps.\n\n This is equivalent to applying LSTMBlockCell in a loop, like so:\n\n ```python\n for x1...
-259,147,601,963,394,300
Computes the LSTM cell forward propagation for all the time steps. This is equivalent to applying LSTMBlockCell in a loop, like so: ```python for x1 in unpack(x): i1, cs1, f1, o1, ci1, co1, h1 = LSTMBlock( x1, cs_prev, h_prev, w, wci, wcf, wco, b) cs_prev = cs1 h_prev = h1 i.append(i1) cs.append(cs1) ...
Plugins/UnrealEnginePython/Binaries/Win64/Lib/site-packages/tensorflow/contrib/rnn/ops/gen_lstm_ops.py
block_lstm
JustinACoder/H22-GR3-UnrealAI
python
@tf_export('block_lstm') def block_lstm(seq_len_max, x, cs_prev, h_prev, w, wci, wcf, wco, b, forget_bias=1, cell_clip=3, use_peephole=False, name=None): "Computes the LSTM cell forward propagation for all the time steps.\n\n This is equivalent to applying LSTMBlockCell in a loop, like so:\n\n ```python\n for x1...
def block_lstm_eager_fallback(seq_len_max, x, cs_prev, h_prev, w, wci, wcf, wco, b, forget_bias=1, cell_clip=3, use_peephole=False, name=None, ctx=None): 'This is the slowpath function for Eager mode.\n This is for function block_lstm\n ' _ctx = (ctx if ctx else _context.context()) if (forget_bias is None...
-8,994,183,612,343,482,000
This is the slowpath function for Eager mode. This is for function block_lstm
Plugins/UnrealEnginePython/Binaries/Win64/Lib/site-packages/tensorflow/contrib/rnn/ops/gen_lstm_ops.py
block_lstm_eager_fallback
JustinACoder/H22-GR3-UnrealAI
python
def block_lstm_eager_fallback(seq_len_max, x, cs_prev, h_prev, w, wci, wcf, wco, b, forget_bias=1, cell_clip=3, use_peephole=False, name=None, ctx=None): 'This is the slowpath function for Eager mode.\n This is for function block_lstm\n ' _ctx = (ctx if ctx else _context.context()) if (forget_bias is None...
@tf_export('block_lstm_grad') def block_lstm_grad(seq_len_max, x, cs_prev, h_prev, w, wci, wcf, wco, b, i, cs, f, o, ci, co, h, cs_grad, h_grad, use_peephole, name=None): 'Computes the LSTM cell backward propagation for the entire time sequence.\n\n This implementation is to be used in conjunction of LSTMBlock.\n\...
-8,757,221,502,674,187,000
Computes the LSTM cell backward propagation for the entire time sequence. This implementation is to be used in conjunction of LSTMBlock. Args: seq_len_max: A `Tensor` of type `int64`. Maximum time length actually used by this input. Outputs are padded with zeros beyond this length. x: A `Tensor`. Must be ...
Plugins/UnrealEnginePython/Binaries/Win64/Lib/site-packages/tensorflow/contrib/rnn/ops/gen_lstm_ops.py
block_lstm_grad
JustinACoder/H22-GR3-UnrealAI
python
@tf_export('block_lstm_grad') def block_lstm_grad(seq_len_max, x, cs_prev, h_prev, w, wci, wcf, wco, b, i, cs, f, o, ci, co, h, cs_grad, h_grad, use_peephole, name=None): 'Computes the LSTM cell backward propagation for the entire time sequence.\n\n This implementation is to be used in conjunction of LSTMBlock.\n\...
def block_lstm_grad_eager_fallback(seq_len_max, x, cs_prev, h_prev, w, wci, wcf, wco, b, i, cs, f, o, ci, co, h, cs_grad, h_grad, use_peephole, name=None, ctx=None): 'This is the slowpath function for Eager mode.\n This is for function block_lstm_grad\n ' _ctx = (ctx if ctx else _context.context()) use_pe...
1,323,251,434,971,964,000
This is the slowpath function for Eager mode. This is for function block_lstm_grad
Plugins/UnrealEnginePython/Binaries/Win64/Lib/site-packages/tensorflow/contrib/rnn/ops/gen_lstm_ops.py
block_lstm_grad_eager_fallback
JustinACoder/H22-GR3-UnrealAI
python
def block_lstm_grad_eager_fallback(seq_len_max, x, cs_prev, h_prev, w, wci, wcf, wco, b, i, cs, f, o, ci, co, h, cs_grad, h_grad, use_peephole, name=None, ctx=None): 'This is the slowpath function for Eager mode.\n This is for function block_lstm_grad\n ' _ctx = (ctx if ctx else _context.context()) use_pe...
@tf_export('lstm_block_cell') def lstm_block_cell(x, cs_prev, h_prev, w, wci, wcf, wco, b, forget_bias=1, cell_clip=3, use_peephole=False, name=None): "Computes the LSTM cell forward propagation for 1 time step.\n\n This implementation uses 1 weight matrix and 1 bias vector, and there's an\n optional peephole con...
-5,341,519,731,373,629,000
Computes the LSTM cell forward propagation for 1 time step. This implementation uses 1 weight matrix and 1 bias vector, and there's an optional peephole connection. This kernel op implements the following mathematical equations: ```python xh = [x, h_prev] [i, f, ci, o] = xh * w + b f = f + forget_bias if not use_pe...
Plugins/UnrealEnginePython/Binaries/Win64/Lib/site-packages/tensorflow/contrib/rnn/ops/gen_lstm_ops.py
lstm_block_cell
JustinACoder/H22-GR3-UnrealAI
python
@tf_export('lstm_block_cell') def lstm_block_cell(x, cs_prev, h_prev, w, wci, wcf, wco, b, forget_bias=1, cell_clip=3, use_peephole=False, name=None): "Computes the LSTM cell forward propagation for 1 time step.\n\n This implementation uses 1 weight matrix and 1 bias vector, and there's an\n optional peephole con...
def lstm_block_cell_eager_fallback(x, cs_prev, h_prev, w, wci, wcf, wco, b, forget_bias=1, cell_clip=3, use_peephole=False, name=None, ctx=None): 'This is the slowpath function for Eager mode.\n This is for function lstm_block_cell\n ' _ctx = (ctx if ctx else _context.context()) if (forget_bias is None): ...
5,588,209,277,027,045,000
This is the slowpath function for Eager mode. This is for function lstm_block_cell
Plugins/UnrealEnginePython/Binaries/Win64/Lib/site-packages/tensorflow/contrib/rnn/ops/gen_lstm_ops.py
lstm_block_cell_eager_fallback
JustinACoder/H22-GR3-UnrealAI
python
def lstm_block_cell_eager_fallback(x, cs_prev, h_prev, w, wci, wcf, wco, b, forget_bias=1, cell_clip=3, use_peephole=False, name=None, ctx=None): 'This is the slowpath function for Eager mode.\n This is for function lstm_block_cell\n ' _ctx = (ctx if ctx else _context.context()) if (forget_bias is None): ...
@tf_export('lstm_block_cell_grad') def lstm_block_cell_grad(x, cs_prev, h_prev, w, wci, wcf, wco, b, i, cs, f, o, ci, co, cs_grad, h_grad, use_peephole, name=None): 'Computes the LSTM cell backward propagation for 1 timestep.\n\n This implementation is to be used in conjunction of LSTMBlockCell.\n\n Args:\n x:...
5,906,303,798,717,116,000
Computes the LSTM cell backward propagation for 1 timestep. This implementation is to be used in conjunction of LSTMBlockCell. Args: x: A `Tensor`. Must be one of the following types: `half`, `float32`. The input to the LSTM cell, shape (batch_size, num_inputs). cs_prev: A `Tensor`. Must have the same type as...
Plugins/UnrealEnginePython/Binaries/Win64/Lib/site-packages/tensorflow/contrib/rnn/ops/gen_lstm_ops.py
lstm_block_cell_grad
JustinACoder/H22-GR3-UnrealAI
python
@tf_export('lstm_block_cell_grad') def lstm_block_cell_grad(x, cs_prev, h_prev, w, wci, wcf, wco, b, i, cs, f, o, ci, co, cs_grad, h_grad, use_peephole, name=None): 'Computes the LSTM cell backward propagation for 1 timestep.\n\n This implementation is to be used in conjunction of LSTMBlockCell.\n\n Args:\n x:...
def lstm_block_cell_grad_eager_fallback(x, cs_prev, h_prev, w, wci, wcf, wco, b, i, cs, f, o, ci, co, cs_grad, h_grad, use_peephole, name=None, ctx=None): 'This is the slowpath function for Eager mode.\n This is for function lstm_block_cell_grad\n ' _ctx = (ctx if ctx else _context.context()) use_peephole...
-1,909,998,256,456,007,400
This is the slowpath function for Eager mode. This is for function lstm_block_cell_grad
Plugins/UnrealEnginePython/Binaries/Win64/Lib/site-packages/tensorflow/contrib/rnn/ops/gen_lstm_ops.py
lstm_block_cell_grad_eager_fallback
JustinACoder/H22-GR3-UnrealAI
python
def lstm_block_cell_grad_eager_fallback(x, cs_prev, h_prev, w, wci, wcf, wco, b, i, cs, f, o, ci, co, cs_grad, h_grad, use_peephole, name=None, ctx=None): 'This is the slowpath function for Eager mode.\n This is for function lstm_block_cell_grad\n ' _ctx = (ctx if ctx else _context.context()) use_peephole...
def get_or_create_session_key(self): '\n Get or create the session key from the request object.\n\n When not present yet, this initializes the session for the user.\n As a result, the request then returns session cookie to the user\n via session middleware.\n ' session_key = s...
9,179,766,036,658,682,000
Get or create the session key from the request object. When not present yet, this initializes the session for the user. As a result, the request then returns session cookie to the user via session middleware.
sqrl/sqrl.py
get_or_create_session_key
JamesonNetworks/django-sqrl
python
def get_or_create_session_key(self): '\n Get or create the session key from the request object.\n\n When not present yet, this initializes the session for the user.\n As a result, the request then returns session cookie to the user\n via session middleware.\n ' session_key = s...
@property def nut(self): '\n Cached property for getting :obj:`.models.SQRLNut`.\n\n When accessed for the first time, this property either replaces or creates\n new :obj:`.models.SQRLNut` by using :meth:`.managers.SQRLNutManager.replace_or_create`.\n All the data for the creation of the...
3,638,656,951,657,241,000
Cached property for getting :obj:`.models.SQRLNut`. When accessed for the first time, this property either replaces or creates new :obj:`.models.SQRLNut` by using :meth:`.managers.SQRLNutManager.replace_or_create`. All the data for the creation of the nut is created by using :meth:`.generate_nut_kwargs`.
sqrl/sqrl.py
nut
JamesonNetworks/django-sqrl
python
@property def nut(self): '\n Cached property for getting :obj:`.models.SQRLNut`.\n\n When accessed for the first time, this property either replaces or creates\n new :obj:`.models.SQRLNut` by using :meth:`.managers.SQRLNutManager.replace_or_create`.\n All the data for the creation of the...
def generate_nut_kwargs(self): '\n Generate kwargs which can be used to create new :obj:`.models.SQRLNut`.\n\n Returns\n -------\n dict\n All required kwargs to instantiate and create :obj:`.models.SQRLNut`.\n ' randomness = generate_randomness(64) l = (len(rand...
2,031,614,310,051,996,000
Generate kwargs which can be used to create new :obj:`.models.SQRLNut`. Returns ------- dict All required kwargs to instantiate and create :obj:`.models.SQRLNut`.
sqrl/sqrl.py
generate_nut_kwargs
JamesonNetworks/django-sqrl
python
def generate_nut_kwargs(self): '\n Generate kwargs which can be used to create new :obj:`.models.SQRLNut`.\n\n Returns\n -------\n dict\n All required kwargs to instantiate and create :obj:`.models.SQRLNut`.\n ' randomness = generate_randomness(64) l = (len(rand...
def get_sqrl_url(self): '\n Get the server URL of where SQRL client will make first request.\n\n This method should be customized when a custom namespace should be used\n by the SQRL client when generating on the fly per-site public-private keypair.\n For example this can be used when a ...
3,748,251,528,209,340,400
Get the server URL of where SQRL client will make first request. This method should be customized when a custom namespace should be used by the SQRL client when generating on the fly per-site public-private keypair. For example this can be used when a web site is a SAAS in which different "sub-sites" are determined te...
sqrl/sqrl.py
get_sqrl_url
JamesonNetworks/django-sqrl
python
def get_sqrl_url(self): '\n Get the server URL of where SQRL client will make first request.\n\n This method should be customized when a custom namespace should be used\n by the SQRL client when generating on the fly per-site public-private keypair.\n For example this can be used when a ...
def get_sqrl_url_params(self): '\n Get SQRL url params to be added as querystring params in the SQRL url.\n\n By default this only adds ``nut=<nut>``.\n\n Returns\n -------\n str\n URLEncoded querystring params\n ' qd = QueryDict('', mutable=True) qd.upda...
8,559,213,639,511,226,000
Get SQRL url params to be added as querystring params in the SQRL url. By default this only adds ``nut=<nut>``. Returns ------- str URLEncoded querystring params
sqrl/sqrl.py
get_sqrl_url_params
JamesonNetworks/django-sqrl
python
def get_sqrl_url_params(self): '\n Get SQRL url params to be added as querystring params in the SQRL url.\n\n By default this only adds ``nut=<nut>``.\n\n Returns\n -------\n str\n URLEncoded querystring params\n ' qd = QueryDict(, mutable=True) qd.update...
@property def url(self): '\n Property for getting only server-side SQRL auth view URL.\n\n This does not include the full domain within the URL.\n The URL is always relative to the current domain of the site.\n ' return '{url}?{params}'.format(url=self.get_sqrl_url(), params=self.get...
-2,513,625,284,204,591,000
Property for getting only server-side SQRL auth view URL. This does not include the full domain within the URL. The URL is always relative to the current domain of the site.
sqrl/sqrl.py
url
JamesonNetworks/django-sqrl
python
@property def url(self): '\n Property for getting only server-side SQRL auth view URL.\n\n This does not include the full domain within the URL.\n The URL is always relative to the current domain of the site.\n ' return '{url}?{params}'.format(url=self.get_sqrl_url(), params=self.get...
@property def sqrl_url(self): '\n Property for getting full SQRL auth view URL including SQRL scheme and full domain with port.\n ' return '{scheme}://{host}{url}'.format(scheme=('sqrl' if self.request.is_secure() else 'qrl'), host=self.request.get_host(), url=self.url)
-4,712,704,604,675,991,000
Property for getting full SQRL auth view URL including SQRL scheme and full domain with port.
sqrl/sqrl.py
sqrl_url
JamesonNetworks/django-sqrl
python
@property def sqrl_url(self): '\n \n ' return '{scheme}://{host}{url}'.format(scheme=('sqrl' if self.request.is_secure() else 'qrl'), host=self.request.get_host(), url=self.url)
def count_flops_attn(model, _x, y): '\n A counter for the `thop` package to count the operations in an\n attention operation.\n Meant to be used like:\n macs, params = thop.profile(\n model,\n inputs=(inputs, timestamps),\n custom_ops={QKVAttention: QKVAttention.coun...
5,236,202,715,761,533,000
A counter for the `thop` package to count the operations in an attention operation. Meant to be used like: macs, params = thop.profile( model, inputs=(inputs, timestamps), custom_ops={QKVAttention: QKVAttention.count_flops}, )
diff_dalle/unet.py
count_flops_attn
AranKomat/Diff-DALLE
python
def count_flops_attn(model, _x, y): '\n A counter for the `thop` package to count the operations in an\n attention operation.\n Meant to be used like:\n macs, params = thop.profile(\n model,\n inputs=(inputs, timestamps),\n custom_ops={QKVAttention: QKVAttention.coun...
@abstractmethod def forward(self, x, emb): '\n Apply the module to `x` given `emb` timestep embeddings.\n '
774,829,112,089,547,400
Apply the module to `x` given `emb` timestep embeddings.
diff_dalle/unet.py
forward
AranKomat/Diff-DALLE
python
@abstractmethod def forward(self, x, emb): '\n \n '
@abstractmethod def forward(self, x, y): '\n Apply the module to `x` given `y`.\n '
-9,143,765,492,867,446,000
Apply the module to `x` given `y`.
diff_dalle/unet.py
forward
AranKomat/Diff-DALLE
python
@abstractmethod def forward(self, x, y): '\n \n '
def forward(self, x, emb): '\n Apply the block to a Tensor, conditioned on a timestep embedding.\n\n :param x: an [N x C x ...] Tensor of features.\n :param emb: an [N x emb_channels] Tensor of timestep embeddings.\n :return: an [N x C x ...] Tensor of outputs.\n ' return chec...
8,049,035,836,621,033,000
Apply the block to a Tensor, conditioned on a timestep embedding. :param x: an [N x C x ...] Tensor of features. :param emb: an [N x emb_channels] Tensor of timestep embeddings. :return: an [N x C x ...] Tensor of outputs.
diff_dalle/unet.py
forward
AranKomat/Diff-DALLE
python
def forward(self, x, emb): '\n Apply the block to a Tensor, conditioned on a timestep embedding.\n\n :param x: an [N x C x ...] Tensor of features.\n :param emb: an [N x emb_channels] Tensor of timestep embeddings.\n :return: an [N x C x ...] Tensor of outputs.\n ' return chec...
def forward(self, qkv, y): '\n Apply QKV attention.\n\n :param qkv: an [N x (H * 3 * C) x T] tensor of Qs, Ks, and Vs.\n :return: an [N x (H * C) x T] tensor after attention.\n ' (bs, width, length) = qkv.shape if (y is None): assert ((width % (3 * self.n_heads)) == 0) ...
-546,739,622,385,842,200
Apply QKV attention. :param qkv: an [N x (H * 3 * C) x T] tensor of Qs, Ks, and Vs. :return: an [N x (H * C) x T] tensor after attention.
diff_dalle/unet.py
forward
AranKomat/Diff-DALLE
python
def forward(self, qkv, y): '\n Apply QKV attention.\n\n :param qkv: an [N x (H * 3 * C) x T] tensor of Qs, Ks, and Vs.\n :return: an [N x (H * C) x T] tensor after attention.\n ' (bs, width, length) = qkv.shape if (y is None): assert ((width % (3 * self.n_heads)) == 0) ...
def forward(self, qkv): '\n Apply QKV attention.\n\n :param qkv: an [N x (3 * H * C) x T] tensor of Qs, Ks, and Vs.\n :return: an [N x (H * C) x T] tensor after attention.\n ' (bs, width, length) = qkv.shape assert ((width % (3 * self.n_heads)) == 0) ch = (width // (3 * self....
-4,963,406,732,217,807,000
Apply QKV attention. :param qkv: an [N x (3 * H * C) x T] tensor of Qs, Ks, and Vs. :return: an [N x (H * C) x T] tensor after attention.
diff_dalle/unet.py
forward
AranKomat/Diff-DALLE
python
def forward(self, qkv): '\n Apply QKV attention.\n\n :param qkv: an [N x (3 * H * C) x T] tensor of Qs, Ks, and Vs.\n :return: an [N x (H * C) x T] tensor after attention.\n ' (bs, width, length) = qkv.shape assert ((width % (3 * self.n_heads)) == 0) ch = (width // (3 * self....
def convert_to_fp16(self): '\n Convert the torso of the model to float16.\n ' self.input_blocks.apply(convert_module_to_f16) self.middle_block.apply(convert_module_to_f16) self.output_blocks.apply(convert_module_to_f16) if hasattr(self, 'text_encoder'): self.text_encoder.apply(...
-6,390,348,050,961,245,000
Convert the torso of the model to float16.
diff_dalle/unet.py
convert_to_fp16
AranKomat/Diff-DALLE
python
def convert_to_fp16(self): '\n \n ' self.input_blocks.apply(convert_module_to_f16) self.middle_block.apply(convert_module_to_f16) self.output_blocks.apply(convert_module_to_f16) if hasattr(self, 'text_encoder'): self.text_encoder.apply(convert_module_to_f16_2)
def convert_to_fp32(self): '\n Convert the torso of the model to float32.\n ' self.input_blocks.apply(convert_module_to_f32) self.middle_block.apply(convert_module_to_f32) self.output_blocks.apply(convert_module_to_f32) if hasattr(self, 'text_encoder'): self.text_encoder.apply(...
-1,808,874,455,012,511,700
Convert the torso of the model to float32.
diff_dalle/unet.py
convert_to_fp32
AranKomat/Diff-DALLE
python
def convert_to_fp32(self): '\n \n ' self.input_blocks.apply(convert_module_to_f32) self.middle_block.apply(convert_module_to_f32) self.output_blocks.apply(convert_module_to_f32) if hasattr(self, 'text_encoder'): self.text_encoder.apply(convert_module_to_f32)