body_hash
stringlengths
64
64
body
stringlengths
23
109k
docstring
stringlengths
1
57k
path
stringlengths
4
198
name
stringlengths
1
115
repository_name
stringlengths
7
111
repository_stars
float64
0
191k
lang
stringclasses
1 value
body_without_docstring
stringlengths
14
108k
unified
stringlengths
45
133k
e9e2ad7ae55fbbdb6036cdb09258c201ed3945f13409777cb04f0582ecb49369
@commands.command(hidden=True) @commands.has_permissions(administrator=True) async def create_table_duolingo_profile(self, ctx: commands.Context) -> None: ' Creates the DuolingoProfile table. ' member = ctx.author (await ctx.message.delete()) if (await self.check_duolingo_profile_exists()): retu...
Creates the DuolingoProfile table.
cogs/duolingo.py
create_table_duolingo_profile
yagomichalak/sloth-bot
21
python
@commands.command(hidden=True) @commands.has_permissions(administrator=True) async def create_table_duolingo_profile(self, ctx: commands.Context) -> None: ' ' member = ctx.author (await ctx.message.delete()) if (await self.check_duolingo_profile_exists()): return (await ctx.send(f'**Table `Duol...
@commands.command(hidden=True) @commands.has_permissions(administrator=True) async def create_table_duolingo_profile(self, ctx: commands.Context) -> None: ' ' member = ctx.author (await ctx.message.delete()) if (await self.check_duolingo_profile_exists()): return (await ctx.send(f'**Table `Duol...
82d8f32888ef6bba57868ef5c618ba4622717a37e99051cb16b421efee39314a
@commands.command(hidden=True) @commands.has_permissions(administrator=True) async def drop_table_duolingo_profile(self, ctx: commands.Context) -> None: ' Creates the DuolingoProfile table. ' member = ctx.author (await ctx.message.delete()) if (not (await self.check_duolingo_profile_exists())): ...
Creates the DuolingoProfile table.
cogs/duolingo.py
drop_table_duolingo_profile
yagomichalak/sloth-bot
21
python
@commands.command(hidden=True) @commands.has_permissions(administrator=True) async def drop_table_duolingo_profile(self, ctx: commands.Context) -> None: ' ' member = ctx.author (await ctx.message.delete()) if (not (await self.check_duolingo_profile_exists())): return (await ctx.send(f"**Table `...
@commands.command(hidden=True) @commands.has_permissions(administrator=True) async def drop_table_duolingo_profile(self, ctx: commands.Context) -> None: ' ' member = ctx.author (await ctx.message.delete()) if (not (await self.check_duolingo_profile_exists())): return (await ctx.send(f"**Table `...
2770b9046f3434489015642eaef1d051fe8f61a8c9ac7fd6ce63a585ca34d66c
@commands.command(hidden=True) @commands.has_permissions(administrator=True) async def reset_table_duolingo_profile(self, ctx: commands.Context) -> None: ' Creates the DuolingoProfile table. ' member = ctx.author (await ctx.message.delete()) if (not (await self.check_duolingo_profile_exists())): ...
Creates the DuolingoProfile table.
cogs/duolingo.py
reset_table_duolingo_profile
yagomichalak/sloth-bot
21
python
@commands.command(hidden=True) @commands.has_permissions(administrator=True) async def reset_table_duolingo_profile(self, ctx: commands.Context) -> None: ' ' member = ctx.author (await ctx.message.delete()) if (not (await self.check_duolingo_profile_exists())): return (await ctx.send(f"**Table ...
@commands.command(hidden=True) @commands.has_permissions(administrator=True) async def reset_table_duolingo_profile(self, ctx: commands.Context) -> None: ' ' member = ctx.author (await ctx.message.delete()) if (not (await self.check_duolingo_profile_exists())): return (await ctx.send(f"**Table ...
b612c7a2b8487dbe7ef0bb768b2a7cd147b4ba67ba2d1986f6ceb0ff47d88209
async def check_duolingo_profile_exists(self) -> bool: ' Checks whether the DuolingoProfile table exists. ' (mycursor, _) = (await the_database()) (await mycursor.execute("SHOW TABLE STATUS LIKE 'DuolingoProfile'")) exists = (await mycursor.fetchone()) (await mycursor.close()) if exists: ...
Checks whether the DuolingoProfile table exists.
cogs/duolingo.py
check_duolingo_profile_exists
yagomichalak/sloth-bot
21
python
async def check_duolingo_profile_exists(self) -> bool: ' ' (mycursor, _) = (await the_database()) (await mycursor.execute("SHOW TABLE STATUS LIKE 'DuolingoProfile'")) exists = (await mycursor.fetchone()) (await mycursor.close()) if exists: return True else: return False
async def check_duolingo_profile_exists(self) -> bool: ' ' (mycursor, _) = (await the_database()) (await mycursor.execute("SHOW TABLE STATUS LIKE 'DuolingoProfile'")) exists = (await mycursor.fetchone()) (await mycursor.close()) if exists: return True else: return False<|doc...
321b80b805f4b0b4d28d60d0a2290b5bbef43e6a8e3e7cd2ceff472b29c40ae7
async def insert_duo_profile(self, user_id: int, duo_name: str) -> None: " Inserts a Duolingo Profile.\n :param user_id: The ID of the user to insert.\n :param duo_name: The user's duolingo username. " (mycursor, db) = (await the_database()) (await mycursor.execute('INSERT INTO DuolingoProfile...
Inserts a Duolingo Profile. :param user_id: The ID of the user to insert. :param duo_name: The user's duolingo username.
cogs/duolingo.py
insert_duo_profile
yagomichalak/sloth-bot
21
python
async def insert_duo_profile(self, user_id: int, duo_name: str) -> None: " Inserts a Duolingo Profile.\n :param user_id: The ID of the user to insert.\n :param duo_name: The user's duolingo username. " (mycursor, db) = (await the_database()) (await mycursor.execute('INSERT INTO DuolingoProfile...
async def insert_duo_profile(self, user_id: int, duo_name: str) -> None: " Inserts a Duolingo Profile.\n :param user_id: The ID of the user to insert.\n :param duo_name: The user's duolingo username. " (mycursor, db) = (await the_database()) (await mycursor.execute('INSERT INTO DuolingoProfile...
5c0eaf8634ea73578b282353f79445d906868c8841cd3d837cc80cec70c17feb
async def get_duo_profile(self, user_id: int) -> List[Union[(int, str)]]: ' Gets a Duolingo Profile.\n :param user_id: The ID of the user to get. ' (mycursor, _) = (await the_database()) (await mycursor.execute('SELECT * FROM DuolingoProfile WHERE user_id = %s', (user_id,))) duo_profile = (await ...
Gets a Duolingo Profile. :param user_id: The ID of the user to get.
cogs/duolingo.py
get_duo_profile
yagomichalak/sloth-bot
21
python
async def get_duo_profile(self, user_id: int) -> List[Union[(int, str)]]: ' Gets a Duolingo Profile.\n :param user_id: The ID of the user to get. ' (mycursor, _) = (await the_database()) (await mycursor.execute('SELECT * FROM DuolingoProfile WHERE user_id = %s', (user_id,))) duo_profile = (await ...
async def get_duo_profile(self, user_id: int) -> List[Union[(int, str)]]: ' Gets a Duolingo Profile.\n :param user_id: The ID of the user to get. ' (mycursor, _) = (await the_database()) (await mycursor.execute('SELECT * FROM DuolingoProfile WHERE user_id = %s', (user_id,))) duo_profile = (await ...
f4c8d6e0a11bc5e1c4e7cd3b3bbb7332209624733b35bf1162865cbb929411ea
async def update_duo_profile(self, user_id: int, duo_name: str) -> None: " Updates a Duolingo Profile.\n :param user_id: The ID of the user to update.\n :param duo_name: The user's new duolingo username. " (mycursor, db) = (await the_database()) (await mycursor.execute('UPDATE DuolingoProfile ...
Updates a Duolingo Profile. :param user_id: The ID of the user to update. :param duo_name: The user's new duolingo username.
cogs/duolingo.py
update_duo_profile
yagomichalak/sloth-bot
21
python
async def update_duo_profile(self, user_id: int, duo_name: str) -> None: " Updates a Duolingo Profile.\n :param user_id: The ID of the user to update.\n :param duo_name: The user's new duolingo username. " (mycursor, db) = (await the_database()) (await mycursor.execute('UPDATE DuolingoProfile ...
async def update_duo_profile(self, user_id: int, duo_name: str) -> None: " Updates a Duolingo Profile.\n :param user_id: The ID of the user to update.\n :param duo_name: The user's new duolingo username. " (mycursor, db) = (await the_database()) (await mycursor.execute('UPDATE DuolingoProfile ...
cf6b725549ed65faf644c60a152962397c3d5adce11fa3d95814e93ec53ddc02
async def delete_duo_profile(self, user_id: int) -> None: ' Deletes a Duolingo Profile.\n :param user_id: The ID of the user to delete. ' (mycursor, db) = (await the_database()) (await mycursor.execute('DELETE FROM DuolingoProfile WHERE user_id = %s', (user_id,))) (await db.commit()) (await m...
Deletes a Duolingo Profile. :param user_id: The ID of the user to delete.
cogs/duolingo.py
delete_duo_profile
yagomichalak/sloth-bot
21
python
async def delete_duo_profile(self, user_id: int) -> None: ' Deletes a Duolingo Profile.\n :param user_id: The ID of the user to delete. ' (mycursor, db) = (await the_database()) (await mycursor.execute('DELETE FROM DuolingoProfile WHERE user_id = %s', (user_id,))) (await db.commit()) (await m...
async def delete_duo_profile(self, user_id: int) -> None: ' Deletes a Duolingo Profile.\n :param user_id: The ID of the user to delete. ' (mycursor, db) = (await the_database()) (await mycursor.execute('DELETE FROM DuolingoProfile WHERE user_id = %s', (user_id,))) (await db.commit()) (await m...
344dbe0ae9b072fe415ecc5b7696ef2935d105593ac9444bf22492a5e8b45299
def score_funct(x): '\n The score function for Iris anneal.\n @param x:\n @return:\n ' global best_score global input_data global output_data network.copy_memory(x) actual_output = [] for input_data in training_input: output_data = network.compute_regression(input_data) ...
The score function for Iris anneal. @param x: @return:
vol2/vol2-python-examples/examples/example_aco_iris.py
score_funct
AbleLynn/AIalgorithm
777
python
def score_funct(x): '\n The score function for Iris anneal.\n @param x:\n @return:\n ' global best_score global input_data global output_data network.copy_memory(x) actual_output = [] for input_data in training_input: output_data = network.compute_regression(input_data) ...
def score_funct(x): '\n The score function for Iris anneal.\n @param x:\n @return:\n ' global best_score global input_data global output_data network.copy_memory(x) actual_output = [] for input_data in training_input: output_data = network.compute_regression(input_data) ...
d6a33f3553506164d9265a98f6ca4bff886cc27f1a568ac9347e650862227cc0
def make_human_survey_class(group): 'Creates a form class for a group of questions\n\n The top-level attributes of the generated class correspond to the question_ids from\n amgut.lib.human_survey_supp structures\n\n Select fields are generated for questions that require a single response, and sets\n of ...
Creates a form class for a group of questions The top-level attributes of the generated class correspond to the question_ids from amgut.lib.human_survey_supp structures Select fields are generated for questions that require a single response, and sets of checkboxes for questions that can have multiple responses
amgut/handlers/human_survey.py
make_human_survey_class
mortonjt/american-gut-web
0
python
def make_human_survey_class(group): 'Creates a form class for a group of questions\n\n The top-level attributes of the generated class correspond to the question_ids from\n amgut.lib.human_survey_supp structures\n\n Select fields are generated for questions that require a single response, and sets\n of ...
def make_human_survey_class(group): 'Creates a form class for a group of questions\n\n The top-level attributes of the generated class correspond to the question_ids from\n amgut.lib.human_survey_supp structures\n\n Select fields are generated for questions that require a single response, and sets\n of ...
ac03054b1307c7ac52b3a8d2d222a80de34d52189324b264b62516c5f069657e
def ignore(self, irc, msg, args): "requires no arguments\n\n Does nothing. Useful sometimes for sequencing commands when you don't\n care about their non-error return values.\n " if irc.nested: msg.tag('ignored') irc.reply('')
requires no arguments Does nothing. Useful sometimes for sequencing commands when you don't care about their non-error return values.
plugins/Utilities/plugin.py
ignore
Supybot/Supybot
40
python
def ignore(self, irc, msg, args): "requires no arguments\n\n Does nothing. Useful sometimes for sequencing commands when you don't\n care about their non-error return values.\n " if irc.nested: msg.tag('ignored') irc.reply()
def ignore(self, irc, msg, args): "requires no arguments\n\n Does nothing. Useful sometimes for sequencing commands when you don't\n care about their non-error return values.\n " if irc.nested: msg.tag('ignored') irc.reply()<|docstring|>requires no arguments Does nothing. ...
c66ccfa423afe34aba88d25a8985b427624e2e61f780ff1ce02c8d66b9fcb35a
def success(self, irc, msg, args, text): "[<text>]\n\n Does nothing except to reply with a success message. This is useful\n when you want to run multiple commands as nested commands, and don't\n care about their output as long as they're successful. An error, of\n course, will break o...
[<text>] Does nothing except to reply with a success message. This is useful when you want to run multiple commands as nested commands, and don't care about their output as long as they're successful. An error, of course, will break out of this command. <text>, if given, will be appended to the end of the success m...
plugins/Utilities/plugin.py
success
Supybot/Supybot
40
python
def success(self, irc, msg, args, text): "[<text>]\n\n Does nothing except to reply with a success message. This is useful\n when you want to run multiple commands as nested commands, and don't\n care about their output as long as they're successful. An error, of\n course, will break o...
def success(self, irc, msg, args, text): "[<text>]\n\n Does nothing except to reply with a success message. This is useful\n when you want to run multiple commands as nested commands, and don't\n care about their output as long as they're successful. An error, of\n course, will break o...
0a0989425d402c4c27f2a4694f541a6d8f50c26490a5f7fd55405e1f9d4461fa
def last(self, irc, msg, args): "<text> [<text> ...]\n\n Returns the last argument given. Useful when you'd like multiple\n nested commands to run, but only the output of the last one to be\n returned.\n " args = filter(None, args) if args: irc.reply(args[(- 1)]) els...
<text> [<text> ...] Returns the last argument given. Useful when you'd like multiple nested commands to run, but only the output of the last one to be returned.
plugins/Utilities/plugin.py
last
Supybot/Supybot
40
python
def last(self, irc, msg, args): "<text> [<text> ...]\n\n Returns the last argument given. Useful when you'd like multiple\n nested commands to run, but only the output of the last one to be\n returned.\n " args = filter(None, args) if args: irc.reply(args[(- 1)]) els...
def last(self, irc, msg, args): "<text> [<text> ...]\n\n Returns the last argument given. Useful when you'd like multiple\n nested commands to run, but only the output of the last one to be\n returned.\n " args = filter(None, args) if args: irc.reply(args[(- 1)]) els...
747d8f0ea97eb33eb461472ca3afc3f3c12ad8fc753b53bb751fd948529bbf97
def echo(self, irc, msg, args, text): '<text>\n\n Returns the arguments given it. Uses our standard substitute on the\n string(s) given to it; $nick (or $who), $randomNick, $randomInt,\n $botnick, $channel, $user, $host, $today, $now, and $randomDate are all\n handled appropriately.\n ...
<text> Returns the arguments given it. Uses our standard substitute on the string(s) given to it; $nick (or $who), $randomNick, $randomInt, $botnick, $channel, $user, $host, $today, $now, and $randomDate are all handled appropriately.
plugins/Utilities/plugin.py
echo
Supybot/Supybot
40
python
def echo(self, irc, msg, args, text): '<text>\n\n Returns the arguments given it. Uses our standard substitute on the\n string(s) given to it; $nick (or $who), $randomNick, $randomInt,\n $botnick, $channel, $user, $host, $today, $now, and $randomDate are all\n handled appropriately.\n ...
def echo(self, irc, msg, args, text): '<text>\n\n Returns the arguments given it. Uses our standard substitute on the\n string(s) given to it; $nick (or $who), $randomNick, $randomInt,\n $botnick, $channel, $user, $host, $today, $now, and $randomDate are all\n handled appropriately.\n ...
355704f24b39ddbcac73581f321eb60d0d83aa65068f0571da7d3be952de2316
def shuffle(self, irc, msg, args, things): '<arg> [<arg> ...]\n\n Shuffles the arguments given it.\n ' random.shuffle(things) irc.reply(' '.join(things))
<arg> [<arg> ...] Shuffles the arguments given it.
plugins/Utilities/plugin.py
shuffle
Supybot/Supybot
40
python
def shuffle(self, irc, msg, args, things): '<arg> [<arg> ...]\n\n Shuffles the arguments given it.\n ' random.shuffle(things) irc.reply(' '.join(things))
def shuffle(self, irc, msg, args, things): '<arg> [<arg> ...]\n\n Shuffles the arguments given it.\n ' random.shuffle(things) irc.reply(' '.join(things))<|docstring|><arg> [<arg> ...] Shuffles the arguments given it.<|endoftext|>
d785d6555d4ee4ca7ef45ffdedcc41777d4875ba4083087880dbb68bf91fb669
def apply(self, irc, msg, args, command, rest): '<command> <text>\n\n Tokenizes <text> and calls <command> with the resulting arguments.\n ' args = [((token and token) or '""') for token in rest] text = ' '.join(args) commands = command.split() commands = map(callbacks.canonicalName, c...
<command> <text> Tokenizes <text> and calls <command> with the resulting arguments.
plugins/Utilities/plugin.py
apply
Supybot/Supybot
40
python
def apply(self, irc, msg, args, command, rest): '<command> <text>\n\n Tokenizes <text> and calls <command> with the resulting arguments.\n ' args = [((token and token) or '') for token in rest] text = ' '.join(args) commands = command.split() commands = map(callbacks.canonicalName, com...
def apply(self, irc, msg, args, command, rest): '<command> <text>\n\n Tokenizes <text> and calls <command> with the resulting arguments.\n ' args = [((token and token) or '') for token in rest] text = ' '.join(args) commands = command.split() commands = map(callbacks.canonicalName, com...
bf4fa41fd18b153c09833bfb0732dc68787d451f89844f08edc99fe0648720c8
def __init__(self, ontology_name: str='base', is_debug: bool=False): "\n Created:\n 26-Mar-2019\n example@example.com\n * based on 'find-entity'\n Updated:\n 15-Jul-2019\n example@example.com\n * add 'find' method\n Updated:\...
Created: 26-Mar-2019 example@example.com * based on 'find-entity' Updated: 15-Jul-2019 example@example.com * add 'find' method Updated: 13-Dec-2019 example@example.com * load dictionaries by ontology name https://github.ibm.com/GTS-CDO/unstructured-analytics/issues/1582
python/datadict/core/svc/find_patterns.py
__init__
jiportilla/ontology
0
python
def __init__(self, ontology_name: str='base', is_debug: bool=False): "\n Created:\n 26-Mar-2019\n example@example.com\n * based on 'find-entity'\n Updated:\n 15-Jul-2019\n example@example.com\n * add 'find' method\n Updated:\...
def __init__(self, ontology_name: str='base', is_debug: bool=False): "\n Created:\n 26-Mar-2019\n example@example.com\n * based on 'find-entity'\n Updated:\n 15-Jul-2019\n example@example.com\n * add 'find' method\n Updated:\...
de3fe529676c34c0ed0e2c62608c871a0973440b10a310636ccfb7178e84d60b
def long_distance(self) -> ValuesView[list]: '\n sample input:\n { \'Aix 5.2 Workload\': [ \'aix+5.2+workload\',\n \'aix_5.2_workload\' ],\n \'Aix 5.2 Workload Partitions\': [ \'aix+5.2+workload+partitions\',\n ...
sample input: { 'Aix 5.2 Workload': [ 'aix+5.2+workload', 'aix_5.2_workload' ], 'Aix 5.2 Workload Partitions': [ 'aix+5.2+workload+partitions', 'aix_5.2_workload_partitions' ], ... } sample output: [ { "p...
python/datadict/core/svc/find_patterns.py
long_distance
jiportilla/ontology
0
python
def long_distance(self) -> ValuesView[list]: '\n sample input:\n { \'Aix 5.2 Workload\': [ \'aix+5.2+workload\',\n \'aix_5.2_workload\' ],\n \'Aix 5.2 Workload Partitions\': [ \'aix+5.2+workload+partitions\',\n ...
def long_distance(self) -> ValuesView[list]: '\n sample input:\n { \'Aix 5.2 Workload\': [ \'aix+5.2+workload\',\n \'aix_5.2_workload\' ],\n \'Aix 5.2 Workload Partitions\': [ \'aix+5.2+workload+partitions\',\n ...
5849e39f4d4939f862b83d7118e04f55b9cce1d20435e798c2add6271e0d722b
def add_special_word_to_embedding_vectors(embedding_vectors, word_map, word): '\n Args:\n embedding_vectors: np.ndarray\n shape: (n_vocab, n_dimension)\n the embedding vectors, always generated by gensim.model.wv.vectors \n ' if (word_map.get(word) is not None): ret...
Args: embedding_vectors: np.ndarray shape: (n_vocab, n_dimension) the embedding vectors, always generated by gensim.model.wv.vectors
tharsis/nn/embedding.py
add_special_word_to_embedding_vectors
neutronest/ml_research_python
0
python
def add_special_word_to_embedding_vectors(embedding_vectors, word_map, word): '\n Args:\n embedding_vectors: np.ndarray\n shape: (n_vocab, n_dimension)\n the embedding vectors, always generated by gensim.model.wv.vectors \n ' if (word_map.get(word) is not None): ret...
def add_special_word_to_embedding_vectors(embedding_vectors, word_map, word): '\n Args:\n embedding_vectors: np.ndarray\n shape: (n_vocab, n_dimension)\n the embedding vectors, always generated by gensim.model.wv.vectors \n ' if (word_map.get(word) is not None): ret...
d4a67a8af210d60d12fb008c024c35963deca1e034b70041a5d00904abb865cb
@click.command(help='Measure runtime of a command. Return statistical data.') @click.option('-s', '--batch-size', default=10, help='How many tests should be run per batch') @click.option('-b', '--batches', default=1000, help='How many batches of tests to run') @click.option('--suppress-stdout/--no-suppress-stdout', def...
Run a command given on the command line. Arguments are parsed from the following list.
ajattara/ajattara.py
run_program
fennekki/ajattara
0
python
@click.command(help='Measure runtime of a command. Return statistical data.') @click.option('-s', '--batch-size', default=10, help='How many tests should be run per batch') @click.option('-b', '--batches', default=1000, help='How many batches of tests to run') @click.option('--suppress-stdout/--no-suppress-stdout', def...
@click.command(help='Measure runtime of a command. Return statistical data.') @click.option('-s', '--batch-size', default=10, help='How many tests should be run per batch') @click.option('-b', '--batches', default=1000, help='How many batches of tests to run') @click.option('--suppress-stdout/--no-suppress-stdout', def...
76931ff7def4afbede024610fa5498db0d1cf5d578b1e5a28132f6065cde873b
def __init__(self, batch_count, batch_size, function, args=[], kwargs={}): 'Initialise an object.\n\n Params:\n function (function): The function to be run and measured\n batch_count (int): The amount of batches to run\n batch_size (int): The number of runs per batch\n ...
Initialise an object. Params: function (function): The function to be run and measured batch_count (int): The amount of batches to run batch_size (int): The number of runs per batch
ajattara/ajattara.py
__init__
fennekki/ajattara
0
python
def __init__(self, batch_count, batch_size, function, args=[], kwargs={}): 'Initialise an object.\n\n Params:\n function (function): The function to be run and measured\n batch_count (int): The amount of batches to run\n batch_size (int): The number of runs per batch\n ...
def __init__(self, batch_count, batch_size, function, args=[], kwargs={}): 'Initialise an object.\n\n Params:\n function (function): The function to be run and measured\n batch_count (int): The amount of batches to run\n batch_size (int): The number of runs per batch\n ...
fe39be336b17c826b8f910554e3cf3a82643e9c70304c1a55ba4edf7fac8035a
def run(self): 'Run the function a specified amount of times.' returns = [] for i in range(self.__batch_count): start = time() for _ in range(self.__batch_size): self.__function(*self.__args, **self.__kwargs) stop = time() returns.append((stop - start)) return...
Run the function a specified amount of times.
ajattara/ajattara.py
run
fennekki/ajattara
0
python
def run(self): returns = [] for i in range(self.__batch_count): start = time() for _ in range(self.__batch_size): self.__function(*self.__args, **self.__kwargs) stop = time() returns.append((stop - start)) return returns
def run(self): returns = [] for i in range(self.__batch_count): start = time() for _ in range(self.__batch_size): self.__function(*self.__args, **self.__kwargs) stop = time() returns.append((stop - start)) return returns<|docstring|>Run the function a specifi...
c5c4ea74ff3ff8e6beb4fe90858ca10b5874b47da7f9ef71bf5fa80ab73f6ae5
def sel_observations(self, idx): 'Select a subset of the observations in idata_orig.\n\n **Not implemented**: This method must be implemented by the SamplingWrapper subclasses.\n It is documented here to show its format and call signature.\n\n Parameters\n ----------\n idx\n ...
Select a subset of the observations in idata_orig. **Not implemented**: This method must be implemented by the SamplingWrapper subclasses. It is documented here to show its format and call signature. Parameters ---------- idx Indexes to separate from the rest of the observed data. Returns ------- modified_observ...
arviz/wrappers/base.py
sel_observations
neha-shah99/arviz
1
python
def sel_observations(self, idx): 'Select a subset of the observations in idata_orig.\n\n **Not implemented**: This method must be implemented by the SamplingWrapper subclasses.\n It is documented here to show its format and call signature.\n\n Parameters\n ----------\n idx\n ...
def sel_observations(self, idx): 'Select a subset of the observations in idata_orig.\n\n **Not implemented**: This method must be implemented by the SamplingWrapper subclasses.\n It is documented here to show its format and call signature.\n\n Parameters\n ----------\n idx\n ...
5fa73bacf00418c78de0bbd4163cff4d8a44ba503ea406c1aa798ebc5b3c3fe1
def sample(self, modified_observed_data): 'Sample ``self.model`` on the ``modified_observed_data`` subset.\n\n **Not implemented**: This method must be implemented by the SamplingWrapper subclasses.\n It is documented here to show its format and call signature.\n\n Parameters\n ---------...
Sample ``self.model`` on the ``modified_observed_data`` subset. **Not implemented**: This method must be implemented by the SamplingWrapper subclasses. It is documented here to show its format and call signature. Parameters ---------- modified_observed_data Data to fit the model on. Returns ------- fitted_model ...
arviz/wrappers/base.py
sample
neha-shah99/arviz
1
python
def sample(self, modified_observed_data): 'Sample ``self.model`` on the ``modified_observed_data`` subset.\n\n **Not implemented**: This method must be implemented by the SamplingWrapper subclasses.\n It is documented here to show its format and call signature.\n\n Parameters\n ---------...
def sample(self, modified_observed_data): 'Sample ``self.model`` on the ``modified_observed_data`` subset.\n\n **Not implemented**: This method must be implemented by the SamplingWrapper subclasses.\n It is documented here to show its format and call signature.\n\n Parameters\n ---------...
1c44b899cc82108943ec1041c3144b2d6db7d6d4c5588c545d1ed7de49f1ca45
def get_inference_data(self, fitted_model): 'Convert the ``fitted_model`` to an InferenceData object.\n\n **Not implemented**: This method must be implemented by the SamplingWrapper subclasses.\n It is documented here to show its format and call signature.\n\n Parameters\n ----------\n ...
Convert the ``fitted_model`` to an InferenceData object. **Not implemented**: This method must be implemented by the SamplingWrapper subclasses. It is documented here to show its format and call signature. Parameters ---------- fitted_model Result of the current fit. Returns ------- idata_current: InferenceData ...
arviz/wrappers/base.py
get_inference_data
neha-shah99/arviz
1
python
def get_inference_data(self, fitted_model): 'Convert the ``fitted_model`` to an InferenceData object.\n\n **Not implemented**: This method must be implemented by the SamplingWrapper subclasses.\n It is documented here to show its format and call signature.\n\n Parameters\n ----------\n ...
def get_inference_data(self, fitted_model): 'Convert the ``fitted_model`` to an InferenceData object.\n\n **Not implemented**: This method must be implemented by the SamplingWrapper subclasses.\n It is documented here to show its format and call signature.\n\n Parameters\n ----------\n ...
595863f04fa7d3c6614c3c62c79bbc0afd9c58547f533320e1e1a69b6b2fcc4b
def point_log_likelihood(self, observation, parameters): 'Pointwise log likelihood function.\n\n Parameters\n ----------\n observation\n Pointwise observation on which to calculate the log likelihood\n parameters\n Parameters on which the log likelihood is condition...
Pointwise log likelihood function. Parameters ---------- observation Pointwise observation on which to calculate the log likelihood parameters Parameters on which the log likelihood is conditioned. Returns ------- point_log_likelihood: float Value of the log likelihood of ``observation`` given ``parameter...
arviz/wrappers/base.py
point_log_likelihood
neha-shah99/arviz
1
python
def point_log_likelihood(self, observation, parameters): 'Pointwise log likelihood function.\n\n Parameters\n ----------\n observation\n Pointwise observation on which to calculate the log likelihood\n parameters\n Parameters on which the log likelihood is condition...
def point_log_likelihood(self, observation, parameters): 'Pointwise log likelihood function.\n\n Parameters\n ----------\n observation\n Pointwise observation on which to calculate the log likelihood\n parameters\n Parameters on which the log likelihood is condition...
5d4063318b96110508d581eafbf5dd24d126570fd5df8b5fbe99d558279b21d3
def log_likelihood__i(self, excluded_obs, idata__i): 'Get the log likelilhood samples :math:`\\log p_{post(-i)}(y_i)`.\n\n Calculate the log likelihood of the data contained in excluded_obs using the\n model fitted with this data excluded, the results of which are stored in ``idata__i``.\n\n Pa...
Get the log likelilhood samples :math:`\log p_{post(-i)}(y_i)`. Calculate the log likelihood of the data contained in excluded_obs using the model fitted with this data excluded, the results of which are stored in ``idata__i``. Parameters ---------- excluded_obs Observations for which to calculate their log likel...
arviz/wrappers/base.py
log_likelihood__i
neha-shah99/arviz
1
python
def log_likelihood__i(self, excluded_obs, idata__i): 'Get the log likelilhood samples :math:`\\log p_{post(-i)}(y_i)`.\n\n Calculate the log likelihood of the data contained in excluded_obs using the\n model fitted with this data excluded, the results of which are stored in ``idata__i``.\n\n Pa...
def log_likelihood__i(self, excluded_obs, idata__i): 'Get the log likelilhood samples :math:`\\log p_{post(-i)}(y_i)`.\n\n Calculate the log likelihood of the data contained in excluded_obs using the\n model fitted with this data excluded, the results of which are stored in ``idata__i``.\n\n Pa...
1b04cca5fafefe8ec5165df962998bee086530aa323edadc9a0c82266eaaf7d8
def _check_method_is_implemented(self, method, *args): 'Check a given method is implemented.' try: getattr(self, method)(*args) except NotImplementedError: return False except: return True return True
Check a given method is implemented.
arviz/wrappers/base.py
_check_method_is_implemented
neha-shah99/arviz
1
python
def _check_method_is_implemented(self, method, *args): try: getattr(self, method)(*args) except NotImplementedError: return False except: return True return True
def _check_method_is_implemented(self, method, *args): try: getattr(self, method)(*args) except NotImplementedError: return False except: return True return True<|docstring|>Check a given method is implemented.<|endoftext|>
0e5876eb54ed0e1abd3766a12f42055c3068b6d1ae8d37772f40473d17ecf014
def check_implemented_methods(self, methods): 'Check that all methods listed are implemented.\n\n Not all functions that require refitting need to have all the methods implemented in\n order to work properly. This function shoulg be used before using the SamplingWrapper and\n its subclasses to ...
Check that all methods listed are implemented. Not all functions that require refitting need to have all the methods implemented in order to work properly. This function shoulg be used before using the SamplingWrapper and its subclasses to get informative error messages. Parameters ---------- methods: list Check ...
arviz/wrappers/base.py
check_implemented_methods
neha-shah99/arviz
1
python
def check_implemented_methods(self, methods): 'Check that all methods listed are implemented.\n\n Not all functions that require refitting need to have all the methods implemented in\n order to work properly. This function shoulg be used before using the SamplingWrapper and\n its subclasses to ...
def check_implemented_methods(self, methods): 'Check that all methods listed are implemented.\n\n Not all functions that require refitting need to have all the methods implemented in\n order to work properly. This function shoulg be used before using the SamplingWrapper and\n its subclasses to ...
28a0aecfc3c1f9966b3bab742d9b16388ed8fb45e8c27adf768162abe049fd14
def AddAnkiTubeButton() -> None: '\n Adds a button to the add card dialogue that opens AnkiTube\n\n Callback function for add_cards_did_init hook\n ' at_button = aqt.qt.QPushButton() at_button.show()
Adds a button to the add card dialogue that opens AnkiTube Callback function for add_cards_did_init hook
__init__.py
AddAnkiTubeButton
hunt0x3r/youtube2gif
1
python
def AddAnkiTubeButton() -> None: '\n Adds a button to the add card dialogue that opens AnkiTube\n\n Callback function for add_cards_did_init hook\n ' at_button = aqt.qt.QPushButton() at_button.show()
def AddAnkiTubeButton() -> None: '\n Adds a button to the add card dialogue that opens AnkiTube\n\n Callback function for add_cards_did_init hook\n ' at_button = aqt.qt.QPushButton() at_button.show()<|docstring|>Adds a button to the add card dialogue that opens AnkiTube Callback function for add_c...
5f50cde4a33ae1306dce2c729eedae01a7953a022fcb7cda4122f39c3b19ffe8
def evaluate_posenet(self, tag='real', valset='s911'): '\n evaluate the performance of posenet on 3 kinds of dataset\n check every clip performance.\n ' start_time = time() with torch.no_grad(): self.model_pos.load_state_dict(self.model_pos_train.state_dict()) self.model...
evaluate the performance of posenet on 3 kinds of dataset check every clip performance.
estimator/posegan_evaluate.py
evaluate_posenet
Garfield-kh/PoseTriplet
9
python
def evaluate_posenet(self, tag='real', valset='s911'): '\n evaluate the performance of posenet on 3 kinds of dataset\n check every clip performance.\n ' start_time = time() with torch.no_grad(): self.model_pos.load_state_dict(self.model_pos_train.state_dict()) self.model...
def evaluate_posenet(self, tag='real', valset='s911'): '\n evaluate the performance of posenet on 3 kinds of dataset\n check every clip performance.\n ' start_time = time() with torch.no_grad(): self.model_pos.load_state_dict(self.model_pos_train.state_dict()) self.model...
2bf63a784397516a3c05720207bde10e2d940aed97a1b6542e3f5fd615980c98
def evaluate_trajnet(self, tag='real', valset='s911'): '\n evaluate the performance of posenet on 3 kinds of dataset\n ' start_time = time() with torch.no_grad(): self.model_traj.load_state_dict(self.model_traj_train.state_dict()) self.model_traj.eval() epoch_p1_3d_vali...
evaluate the performance of posenet on 3 kinds of dataset
estimator/posegan_evaluate.py
evaluate_trajnet
Garfield-kh/PoseTriplet
9
python
def evaluate_trajnet(self, tag='real', valset='s911'): '\n \n ' start_time = time() with torch.no_grad(): self.model_traj.load_state_dict(self.model_traj_train.state_dict()) self.model_traj.eval() epoch_p1_3d_valid = 0 N_valid = 0 self.summary.test_iter_...
def evaluate_trajnet(self, tag='real', valset='s911'): '\n \n ' start_time = time() with torch.no_grad(): self.model_traj.load_state_dict(self.model_traj_train.state_dict()) self.model_traj.eval() epoch_p1_3d_valid = 0 N_valid = 0 self.summary.test_iter_...
c94327ed9bae080c7eba93f883983da6b6cf9d436459826ea854469499272647
def vis_result(self, tag='real', valset='s911'): '\n evaluate the performance of posenet on 3 kinds of dataset\n check every clip performance.\n ' start_time = time() with torch.no_grad(): self.model_pos.load_state_dict(self.model_pos_train.state_dict()) self.model_pos.e...
evaluate the performance of posenet on 3 kinds of dataset check every clip performance.
estimator/posegan_evaluate.py
vis_result
Garfield-kh/PoseTriplet
9
python
def vis_result(self, tag='real', valset='s911'): '\n evaluate the performance of posenet on 3 kinds of dataset\n check every clip performance.\n ' start_time = time() with torch.no_grad(): self.model_pos.load_state_dict(self.model_pos_train.state_dict()) self.model_pos.e...
def vis_result(self, tag='real', valset='s911'): '\n evaluate the performance of posenet on 3 kinds of dataset\n check every clip performance.\n ' start_time = time() with torch.no_grad(): self.model_pos.load_state_dict(self.model_pos_train.state_dict()) self.model_pos.e...
bd57d777a9e0c97ae87f3177f049a3a5b4eb6a72bd9ad3b8cc4926ec7df2adc1
def save_result(self, valset): '\n evaluate and save the s15678 / s15678_flip\n ' start_time = time() result_all_lst = [] with torch.no_grad(): self.model_pos.load_state_dict(self.model_pos_train.state_dict()) self.model_pos.eval() self.model_traj.load_state_dict(se...
evaluate and save the s15678 / s15678_flip
estimator/posegan_evaluate.py
save_result
Garfield-kh/PoseTriplet
9
python
def save_result(self, valset): '\n \n ' start_time = time() result_all_lst = [] with torch.no_grad(): self.model_pos.load_state_dict(self.model_pos_train.state_dict()) self.model_pos.eval() self.model_traj.load_state_dict(self.model_traj_train.state_dict()) ...
def save_result(self, valset): '\n \n ' start_time = time() result_all_lst = [] with torch.no_grad(): self.model_pos.load_state_dict(self.model_pos_train.state_dict()) self.model_pos.eval() self.model_traj.load_state_dict(self.model_traj_train.state_dict()) ...
0bc4dc91b4f7737e74962c97f00d33221052e6ed72b527cd8ce8545a7b3ec586
def write_standard_bvh(self, bvhfileName, prediction3dpoint): '\n :param outbvhfilepath:\n :param prediction3dpoint:\n :return:\n ' for frame in prediction3dpoint: for point3d in frame: point3d[0] *= 100 point3d[1] *= 100 point3d[2] *= 100 ...
:param outbvhfilepath: :param prediction3dpoint: :return:
estimator/posegan_evaluate.py
write_standard_bvh
Garfield-kh/PoseTriplet
9
python
def write_standard_bvh(self, bvhfileName, prediction3dpoint): '\n :param outbvhfilepath:\n :param prediction3dpoint:\n :return:\n ' for frame in prediction3dpoint: for point3d in frame: point3d[0] *= 100 point3d[1] *= 100 point3d[2] *= 100 ...
def write_standard_bvh(self, bvhfileName, prediction3dpoint): '\n :param outbvhfilepath:\n :param prediction3dpoint:\n :return:\n ' for frame in prediction3dpoint: for point3d in frame: point3d[0] *= 100 point3d[1] *= 100 point3d[2] *= 100 ...
06800d6c2745e2835bb3d1562b2076b3e6aadd4d994960f469e14fe622529205
def smooth_l1_loss(y_true: Tensor, y_pred: Tensor, beta: float=1.0) -> Tensor: "Calculate Smooth L1 Loss between two tensors.\n\n This method can be used with TensorFlow tensors:\n ```python\n\n true = tf.constant([[0,1,0,0], [0,0,0,1], [0,0,1,0], [1,0,0,0]])\n pred = tf.constant([[0.1,0.9,0.05,0.05], [...
Calculate Smooth L1 Loss between two tensors. This method can be used with TensorFlow tensors: ```python true = tf.constant([[0,1,0,0], [0,0,0,1], [0,0,1,0], [1,0,0,0]]) pred = tf.constant([[0.1,0.9,0.05,0.05], [0.1,0.2,0.0,0.7], [0.0,0.15,0.8,0.05], [1.0,0.0,0.0,0.0]]) Smooth_L1 = fe.backend.smooth_l1_loss(y_pred=pr...
fastestimator/backend/_smooth_l1_loss.py
smooth_l1_loss
aashokvardhan/fastestimator
0
python
def smooth_l1_loss(y_true: Tensor, y_pred: Tensor, beta: float=1.0) -> Tensor: "Calculate Smooth L1 Loss between two tensors.\n\n This method can be used with TensorFlow tensors:\n ```python\n\n true = tf.constant([[0,1,0,0], [0,0,0,1], [0,0,1,0], [1,0,0,0]])\n pred = tf.constant([[0.1,0.9,0.05,0.05], [...
def smooth_l1_loss(y_true: Tensor, y_pred: Tensor, beta: float=1.0) -> Tensor: "Calculate Smooth L1 Loss between two tensors.\n\n This method can be used with TensorFlow tensors:\n ```python\n\n true = tf.constant([[0,1,0,0], [0,0,0,1], [0,0,1,0], [1,0,0,0]])\n pred = tf.constant([[0.1,0.9,0.05,0.05], [...
0c13d721a9a70dfdd995e4a2239a0e39237d161e85131db28f747a4e58544306
def __init__(self, action_space_dim=3, hidden_dim=256) -> None: 'Initialization of the DQN\n\n Args:\n action_space_dim (int, optional): dimension of the action space. Defaults to 3.\n hidden_dim (int, optional): dimension of the embedding space of the input image. Defaults to 256.\n ...
Initialization of the DQN Args: action_space_dim (int, optional): dimension of the action space. Defaults to 3. hidden_dim (int, optional): dimension of the embedding space of the input image. Defaults to 256.
agent.py
__init__
MattiaMolon/Atari-Pong-RL
2
python
def __init__(self, action_space_dim=3, hidden_dim=256) -> None: 'Initialization of the DQN\n\n Args:\n action_space_dim (int, optional): dimension of the action space. Defaults to 3.\n hidden_dim (int, optional): dimension of the embedding space of the input image. Defaults to 256.\n ...
def __init__(self, action_space_dim=3, hidden_dim=256) -> None: 'Initialization of the DQN\n\n Args:\n action_space_dim (int, optional): dimension of the action space. Defaults to 3.\n hidden_dim (int, optional): dimension of the embedding space of the input image. Defaults to 256.\n ...
6885449d06ae864f3268f3910deb295ebcf10a25e5a6fcc267ebf6f598facd83
def forward(self, x: Tensor) -> Tensor: 'Forward an image throught the network\n\n Args:\n x (Tensor): input image to feed forward into the network\n\n Returns:\n Tensor: The action predicted\n ' x = F.relu(self.cnv1(x)) x = F.relu(self.cnv2(x)) x = self.flat1(...
Forward an image throught the network Args: x (Tensor): input image to feed forward into the network Returns: Tensor: The action predicted
agent.py
forward
MattiaMolon/Atari-Pong-RL
2
python
def forward(self, x: Tensor) -> Tensor: 'Forward an image throught the network\n\n Args:\n x (Tensor): input image to feed forward into the network\n\n Returns:\n Tensor: The action predicted\n ' x = F.relu(self.cnv1(x)) x = F.relu(self.cnv2(x)) x = self.flat1(...
def forward(self, x: Tensor) -> Tensor: 'Forward an image throught the network\n\n Args:\n x (Tensor): input image to feed forward into the network\n\n Returns:\n Tensor: The action predicted\n ' x = F.relu(self.cnv1(x)) x = F.relu(self.cnv2(x)) x = self.flat1(...
87e35f1e661d44d73298e12b62025fcad691b52b171f6eb817ab3bbbea5679f4
def __init__(self, player_id: int=1, name: str='Ugo', batch_size: int=128, gamma: float=0.98, memory_size: int=40000) -> None: 'Initialization for the DQN agent\n\n Args:\n player_id (int, optional): Side of the board on which to play. Defaults to 1.\n name (str, optional): Name of the ...
Initialization for the DQN agent Args: player_id (int, optional): Side of the board on which to play. Defaults to 1. name (str, optional): Name of the player. Defaults to "Ugo". batch_size (int, optional): Batch size of the update. Defaults to 128. gamma (float, optional): Gamme value for update decay....
agent.py
__init__
MattiaMolon/Atari-Pong-RL
2
python
def __init__(self, player_id: int=1, name: str='Ugo', batch_size: int=128, gamma: float=0.98, memory_size: int=40000) -> None: 'Initialization for the DQN agent\n\n Args:\n player_id (int, optional): Side of the board on which to play. Defaults to 1.\n name (str, optional): Name of the ...
def __init__(self, player_id: int=1, name: str='Ugo', batch_size: int=128, gamma: float=0.98, memory_size: int=40000) -> None: 'Initialization for the DQN agent\n\n Args:\n player_id (int, optional): Side of the board on which to play. Defaults to 1.\n name (str, optional): Name of the ...
e853ca31bfea271f51bef6bd17a241c6ea597f1fe257722c8fed01c7530e6079
def update_policy_net(self) -> None: 'Update policy_net via Q-learning approximation' if (len(self.memory) < self.batch_size): return transitions = self.memory.sample(self.batch_size) batch = Transition(*zip(*transitions)) non_final_mask = (1 - torch.tensor(batch.done, dtype=torch.uint8).to(...
Update policy_net via Q-learning approximation
agent.py
update_policy_net
MattiaMolon/Atari-Pong-RL
2
python
def update_policy_net(self) -> None: if (len(self.memory) < self.batch_size): return transitions = self.memory.sample(self.batch_size) batch = Transition(*zip(*transitions)) non_final_mask = (1 - torch.tensor(batch.done, dtype=torch.uint8).to(torch.device(device))) non_final_mask = non_...
def update_policy_net(self) -> None: if (len(self.memory) < self.batch_size): return transitions = self.memory.sample(self.batch_size) batch = Transition(*zip(*transitions)) non_final_mask = (1 - torch.tensor(batch.done, dtype=torch.uint8).to(torch.device(device))) non_final_mask = non_...
fa66e11847a523c9d594f5fe3fa532c321ef6a83132d9a96da29e83b41e9bc27
def update_target_net(self) -> None: 'Update target net' self.target_net.load_state_dict(self.policy_net.state_dict())
Update target net
agent.py
update_target_net
MattiaMolon/Atari-Pong-RL
2
python
def update_target_net(self) -> None: self.target_net.load_state_dict(self.policy_net.state_dict())
def update_target_net(self) -> None: self.target_net.load_state_dict(self.policy_net.state_dict())<|docstring|>Update target net<|endoftext|>
fb95a5f05a40ccbbca56274816cb47e58ba4a3aabc4e329916f0557a8a172619
def get_action(self, ob: np.ndarray, epsilon: float=0.1, train: bool=False) -> int: 'Interface function that returns the action that the agent took based\n on the observation ob\n\n Args:\n ob (np.ndarray, optional): Current observation from the game.\n epsilon (float, optional):...
Interface function that returns the action that the agent took based on the observation ob Args: ob (np.ndarray, optional): Current observation from the game. epsilon (float, optional): Epsilon for epsilon greedy. Defaults to 0.1. train (bool, optional): Identifies if the agent is in testing or training ph...
agent.py
get_action
MattiaMolon/Atari-Pong-RL
2
python
def get_action(self, ob: np.ndarray, epsilon: float=0.1, train: bool=False) -> int: 'Interface function that returns the action that the agent took based\n on the observation ob\n\n Args:\n ob (np.ndarray, optional): Current observation from the game.\n epsilon (float, optional):...
def get_action(self, ob: np.ndarray, epsilon: float=0.1, train: bool=False) -> int: 'Interface function that returns the action that the agent took based\n on the observation ob\n\n Args:\n ob (np.ndarray, optional): Current observation from the game.\n epsilon (float, optional):...
d0948b42468a60a9ab3b48b51e6f7a093102a371ef4afb59a51015bd6353252a
def get_name(self) -> str: 'Return name of the agent\n\n Returns:\n str: name of the agent\n ' return self.name
Return name of the agent Returns: str: name of the agent
agent.py
get_name
MattiaMolon/Atari-Pong-RL
2
python
def get_name(self) -> str: 'Return name of the agent\n\n Returns:\n str: name of the agent\n ' return self.name
def get_name(self) -> str: 'Return name of the agent\n\n Returns:\n str: name of the agent\n ' return self.name<|docstring|>Return name of the agent Returns: str: name of the agent<|endoftext|>
617158c8883ac70100d224ce04c8350090793d62cb980832f7dd3a3eed98d3d6
def reset(self) -> None: 'Clean the buffers of the memory' self.memory.test_buffer = [] self.memory.train_buffer = []
Clean the buffers of the memory
agent.py
reset
MattiaMolon/Atari-Pong-RL
2
python
def reset(self) -> None: self.memory.test_buffer = [] self.memory.train_buffer = []
def reset(self) -> None: self.memory.test_buffer = [] self.memory.train_buffer = []<|docstring|>Clean the buffers of the memory<|endoftext|>
3f944d6f8f015ccb4ae80b9dd747d432f59ee7ae76df1922a0f7a899b07c5368
def load_model(self, path_ai: str='weights/hibrid_tuned_best.ai', path_optm: str=None) -> None: 'Load model weights and optimizer from a certain path\n\n Args:\n path_ai (str, optional): Path to model weights. Defaults to "weights/hibrid_tuned_best.ai".\n path_optm (str, optional): Path...
Load model weights and optimizer from a certain path Args: path_ai (str, optional): Path to model weights. Defaults to "weights/hibrid_tuned_best.ai". path_optm (str, optional): Path to optimizer weights. Defaults to None.
agent.py
load_model
MattiaMolon/Atari-Pong-RL
2
python
def load_model(self, path_ai: str='weights/hibrid_tuned_best.ai', path_optm: str=None) -> None: 'Load model weights and optimizer from a certain path\n\n Args:\n path_ai (str, optional): Path to model weights. Defaults to "weights/hibrid_tuned_best.ai".\n path_optm (str, optional): Path...
def load_model(self, path_ai: str='weights/hibrid_tuned_best.ai', path_optm: str=None) -> None: 'Load model weights and optimizer from a certain path\n\n Args:\n path_ai (str, optional): Path to model weights. Defaults to "weights/hibrid_tuned_best.ai".\n path_optm (str, optional): Path...
34566ecedca4ad1eae5e0653376f2d858c97551d6afad90fb00ecec24e4a3fc1
def save_model(self, dir: str, ep: int) -> None: 'Save model to file\n\n Args:\n dir (str): Directory to where save the model\n ep (int): episode number\n ' torch.save(self.policy_net.state_dict(), (dir + f'/DQN_{(ep + 1)}.ai')) torch.save(self.optimizer.state_dict(), (di...
Save model to file Args: dir (str): Directory to where save the model ep (int): episode number
agent.py
save_model
MattiaMolon/Atari-Pong-RL
2
python
def save_model(self, dir: str, ep: int) -> None: 'Save model to file\n\n Args:\n dir (str): Directory to where save the model\n ep (int): episode number\n ' torch.save(self.policy_net.state_dict(), (dir + f'/DQN_{(ep + 1)}.ai')) torch.save(self.optimizer.state_dict(), (di...
def save_model(self, dir: str, ep: int) -> None: 'Save model to file\n\n Args:\n dir (str): Directory to where save the model\n ep (int): episode number\n ' torch.save(self.policy_net.state_dict(), (dir + f'/DQN_{(ep + 1)}.ai')) torch.save(self.optimizer.state_dict(), (di...
ac76be0b2834601361aa1594fbadf360514ac9cfc178316dfad7d3ccce82f182
def push_to_train_buffer(self, ob: np.ndarray, action: int, reward: int, next_ob: np.ndarray, done: bool) -> None: 'Push a transition to the memory train buffer\n\n Args:\n ob (np.ndarray): Obsertation/state at time t\n action (int): Action at time t\n reward (int): Reward fo...
Push a transition to the memory train buffer Args: ob (np.ndarray): Obsertation/state at time t action (int): Action at time t reward (int): Reward for taking action a in state s at time t next_ob (np.ndarray): Observation/state at time t+1 done (bool): Defines if the game is finished or not
agent.py
push_to_train_buffer
MattiaMolon/Atari-Pong-RL
2
python
def push_to_train_buffer(self, ob: np.ndarray, action: int, reward: int, next_ob: np.ndarray, done: bool) -> None: 'Push a transition to the memory train buffer\n\n Args:\n ob (np.ndarray): Obsertation/state at time t\n action (int): Action at time t\n reward (int): Reward fo...
def push_to_train_buffer(self, ob: np.ndarray, action: int, reward: int, next_ob: np.ndarray, done: bool) -> None: 'Push a transition to the memory train buffer\n\n Args:\n ob (np.ndarray): Obsertation/state at time t\n action (int): Action at time t\n reward (int): Reward fo...
cffc3e7346086c67be913b5decd8b5e49f8d6b77a7619bd429982e6657c31570
def push_to_test_buffer(self, ob: np.ndarray) -> None: 'Push a transition to the train buffer\n\n Args:\n ob (np.ndarray): Observation to push to the buffer\n ' ob = self.preprocess_ob(ob) self.memory.push_to_test_buffer(ob) if (len(self.memory.test_buffer) == self.memory.test_b...
Push a transition to the train buffer Args: ob (np.ndarray): Observation to push to the buffer
agent.py
push_to_test_buffer
MattiaMolon/Atari-Pong-RL
2
python
def push_to_test_buffer(self, ob: np.ndarray) -> None: 'Push a transition to the train buffer\n\n Args:\n ob (np.ndarray): Observation to push to the buffer\n ' ob = self.preprocess_ob(ob) self.memory.push_to_test_buffer(ob) if (len(self.memory.test_buffer) == self.memory.test_b...
def push_to_test_buffer(self, ob: np.ndarray) -> None: 'Push a transition to the train buffer\n\n Args:\n ob (np.ndarray): Observation to push to the buffer\n ' ob = self.preprocess_ob(ob) self.memory.push_to_test_buffer(ob) if (len(self.memory.test_buffer) == self.memory.test_b...
078be610bca7de2543a8baeac970e44cfd6215c557603219b1b8841fd66b03e1
def get_stack_from_train_buffer(self, ob: np.ndarray) -> Tensor: 'Get stack of preprocessed observations/states from train buffer\n\n Args:\n ob (np.ndarray): Current observation/state\n\n Returns:\n Tensor: Stack of preprocessed observations/states\n ' ob = self.prepr...
Get stack of preprocessed observations/states from train buffer Args: ob (np.ndarray): Current observation/state Returns: Tensor: Stack of preprocessed observations/states
agent.py
get_stack_from_train_buffer
MattiaMolon/Atari-Pong-RL
2
python
def get_stack_from_train_buffer(self, ob: np.ndarray) -> Tensor: 'Get stack of preprocessed observations/states from train buffer\n\n Args:\n ob (np.ndarray): Current observation/state\n\n Returns:\n Tensor: Stack of preprocessed observations/states\n ' ob = self.prepr...
def get_stack_from_train_buffer(self, ob: np.ndarray) -> Tensor: 'Get stack of preprocessed observations/states from train buffer\n\n Args:\n ob (np.ndarray): Current observation/state\n\n Returns:\n Tensor: Stack of preprocessed observations/states\n ' ob = self.prepr...
927bb8b33fbfd6655ac26bc6bab2a7badbad2f2d68c1aba69c7086180b31d581
def get_stack_from_test_buffer(self, ob: np.ndarray) -> Tensor: 'Get stack of preprocessed observations/states from test buffer\n\n Args:\n ob (np.ndarray): Current observation/state\n\n Returns:\n Tensor: Stack of preprocessed observations/states\n ' ob = self.preproc...
Get stack of preprocessed observations/states from test buffer Args: ob (np.ndarray): Current observation/state Returns: Tensor: Stack of preprocessed observations/states
agent.py
get_stack_from_test_buffer
MattiaMolon/Atari-Pong-RL
2
python
def get_stack_from_test_buffer(self, ob: np.ndarray) -> Tensor: 'Get stack of preprocessed observations/states from test buffer\n\n Args:\n ob (np.ndarray): Current observation/state\n\n Returns:\n Tensor: Stack of preprocessed observations/states\n ' ob = self.preproc...
def get_stack_from_test_buffer(self, ob: np.ndarray) -> Tensor: 'Get stack of preprocessed observations/states from test buffer\n\n Args:\n ob (np.ndarray): Current observation/state\n\n Returns:\n Tensor: Stack of preprocessed observations/states\n ' ob = self.preproc...
d4718b5952099c832ea3e1bd4446cd0b53211d9e6b8b14167ea45f85b524f878
def preprocess_ob(self, ob: np.ndarray) -> Tensor: 'Preprocess observation:\n\n - shrink the image to 100x100\n\n - transform it to black and white\n\n - transform it into a Tensor\n\n\n Args:\n ob (np.ndarray): Observation to preprocess\n\n Returns:\n Tensor...
Preprocess observation: - shrink the image to 100x100 - transform it to black and white - transform it into a Tensor Args: ob (np.ndarray): Observation to preprocess Returns: Tensor: Preprocessed observation
agent.py
preprocess_ob
MattiaMolon/Atari-Pong-RL
2
python
def preprocess_ob(self, ob: np.ndarray) -> Tensor: 'Preprocess observation:\n\n - shrink the image to 100x100\n\n - transform it to black and white\n\n - transform it into a Tensor\n\n\n Args:\n ob (np.ndarray): Observation to preprocess\n\n Returns:\n Tensor...
def preprocess_ob(self, ob: np.ndarray) -> Tensor: 'Preprocess observation:\n\n - shrink the image to 100x100\n\n - transform it to black and white\n\n - transform it into a Tensor\n\n\n Args:\n ob (np.ndarray): Observation to preprocess\n\n Returns:\n Tensor...
f99b7309450c749c3ef5cfbfb691e7f3e12941c146e4509d7883541a4bbc1b50
def main(): "\n Initiates the Brand Sample which makes multiple requests against\n the Business Communications API. The requests this sample\n makes are:\n - Create a brand\n - Gets the brand details\n - Updates the created brand's display name\n - Lists all brands available\n ...
Initiates the Brand Sample which makes multiple requests against the Business Communications API. The requests this sample makes are: - Create a brand - Gets the brand details - Updates the created brand's display name - Lists all brands available - Delete the created brand
brand_sample.py
main
google-business-communications/bc-bm-python-command-line-examples
1
python
def main(): "\n Initiates the Brand Sample which makes multiple requests against\n the Business Communications API. The requests this sample\n makes are:\n - Create a brand\n - Gets the brand details\n - Updates the created brand's display name\n - Lists all brands available\n ...
def main(): "\n Initiates the Brand Sample which makes multiple requests against\n the Business Communications API. The requests this sample\n makes are:\n - Create a brand\n - Gets the brand details\n - Updates the created brand's display name\n - Lists all brands available\n ...
d6758f0378768fb8efca92b79518d368aabf77d570f73edea246f6d4254b89a5
def create_brand(): "\n Creates a brand with the name 'Test Brand'.\n\n Returns:\n brand (Brand): The brand object that was created.\n " brand = brands_service.Create(Brand(displayName='Test Brand')) print(brand) return brand
Creates a brand with the name 'Test Brand'. Returns: brand (Brand): The brand object that was created.
brand_sample.py
create_brand
google-business-communications/bc-bm-python-command-line-examples
1
python
def create_brand(): "\n Creates a brand with the name 'Test Brand'.\n\n Returns:\n brand (Brand): The brand object that was created.\n " brand = brands_service.Create(Brand(displayName='Test Brand')) print(brand) return brand
def create_brand(): "\n Creates a brand with the name 'Test Brand'.\n\n Returns:\n brand (Brand): The brand object that was created.\n " brand = brands_service.Create(Brand(displayName='Test Brand')) print(brand) return brand<|docstring|>Creates a brand with the name 'Test Brand'. Retur...
c231363f70ffdcdbb7b56fad8c8bd8698747018e4e1e966d283d1de3a9d79511
def update_brand(brand, display_name): '\n Updates the passed in brand object with a new display name.\n\n Args:\n brand (Brand): The brand to be updated.\n display_name (str): The new display name.\n\n Returns:\n updated_brand (Brand): The updated brand object.\n ' brand.displa...
Updates the passed in brand object with a new display name. Args: brand (Brand): The brand to be updated. display_name (str): The new display name. Returns: updated_brand (Brand): The updated brand object.
brand_sample.py
update_brand
google-business-communications/bc-bm-python-command-line-examples
1
python
def update_brand(brand, display_name): '\n Updates the passed in brand object with a new display name.\n\n Args:\n brand (Brand): The brand to be updated.\n display_name (str): The new display name.\n\n Returns:\n updated_brand (Brand): The updated brand object.\n ' brand.displa...
def update_brand(brand, display_name): '\n Updates the passed in brand object with a new display name.\n\n Args:\n brand (Brand): The brand to be updated.\n display_name (str): The new display name.\n\n Returns:\n updated_brand (Brand): The updated brand object.\n ' brand.displa...
3f1afef010398bde7cfde06ef7a9e4c9fa8a8730c816e30cd8f876f396f5d8ab
def get_brand(brand_name): "\n Based on the brand name, looks up the brand details.\n\n Args:\n brand_name (str): The unique identifier for the brand in\n 'brands/BRAND_ID' format.\n\n Returns:\n brand (Brand): The matching brand object.\n " brand = brands_service.Get(Businessco...
Based on the brand name, looks up the brand details. Args: brand_name (str): The unique identifier for the brand in 'brands/BRAND_ID' format. Returns: brand (Brand): The matching brand object.
brand_sample.py
get_brand
google-business-communications/bc-bm-python-command-line-examples
1
python
def get_brand(brand_name): "\n Based on the brand name, looks up the brand details.\n\n Args:\n brand_name (str): The unique identifier for the brand in\n 'brands/BRAND_ID' format.\n\n Returns:\n brand (Brand): The matching brand object.\n " brand = brands_service.Get(Businessco...
def get_brand(brand_name): "\n Based on the brand name, looks up the brand details.\n\n Args:\n brand_name (str): The unique identifier for the brand in\n 'brands/BRAND_ID' format.\n\n Returns:\n brand (Brand): The matching brand object.\n " brand = brands_service.Get(Businessco...
de7e7d53c8d479a2be4fb022861f6914ea6f0d3766db8518856276e40911e5ad
def list_brands(): '\n Lists all brands for the configured Cloud project.\n\n Returns:\n brands (Brand[]): The list of brands for the configured Cloud project.\n ' brands = brands_service.List(BusinesscommunicationsBrandsListRequest()) print(brands) return brands
Lists all brands for the configured Cloud project. Returns: brands (Brand[]): The list of brands for the configured Cloud project.
brand_sample.py
list_brands
google-business-communications/bc-bm-python-command-line-examples
1
python
def list_brands(): '\n Lists all brands for the configured Cloud project.\n\n Returns:\n brands (Brand[]): The list of brands for the configured Cloud project.\n ' brands = brands_service.List(BusinesscommunicationsBrandsListRequest()) print(brands) return brands
def list_brands(): '\n Lists all brands for the configured Cloud project.\n\n Returns:\n brands (Brand[]): The list of brands for the configured Cloud project.\n ' brands = brands_service.List(BusinesscommunicationsBrandsListRequest()) print(brands) return brands<|docstring|>Lists all br...
1eb9566aa9ccfd77cb32367d4266d50a2b35a56fec56d5126e66b1c4b63fd32d
def delete_brand(brand_name): "\n Based on the brand name, deletes the brand. Deleting a brand with\n associated agents will also result in the agents also being deleted.\n Only brands without verified agents can be deleted.\n\n Args:\n brand_name (str): The unique identifier for the brand in\n ...
Based on the brand name, deletes the brand. Deleting a brand with associated agents will also result in the agents also being deleted. Only brands without verified agents can be deleted. Args: brand_name (str): The unique identifier for the brand in 'brands/BRAND_ID' format.
brand_sample.py
delete_brand
google-business-communications/bc-bm-python-command-line-examples
1
python
def delete_brand(brand_name): "\n Based on the brand name, deletes the brand. Deleting a brand with\n associated agents will also result in the agents also being deleted.\n Only brands without verified agents can be deleted.\n\n Args:\n brand_name (str): The unique identifier for the brand in\n ...
def delete_brand(brand_name): "\n Based on the brand name, deletes the brand. Deleting a brand with\n associated agents will also result in the agents also being deleted.\n Only brands without verified agents can be deleted.\n\n Args:\n brand_name (str): The unique identifier for the brand in\n ...
a3b44f298b5f887b00d81478871730a608aaaf3a106755ed24659501b3fea6ff
@njit(nogil=True, parallel=True, cache=__cache) def fixity2d_to_dofs1d(fixity2d: np.ndarray, inds: np.ndarray=None): "\n Returns the indices of the degrees of freedoms\n being supressed. \n\n Optionally, global indices of the rows in 'fixity2d' \n array can be provided by the optional argument 'inds'.\n...
Returns the indices of the degrees of freedoms being supressed. Optionally, global indices of the rows in 'fixity2d' array can be provided by the optional argument 'inds'. Parameters ---------- fixity2d : np.ndarray(bool)[:, :] 2d numpy array of booleans. It has as many rows as nodes, and as many columns a...
src/dewloosh/solid/fem/utils.py
fixity2d_to_dofs1d
dewloosh/dewloosh-solid
0
python
@njit(nogil=True, parallel=True, cache=__cache) def fixity2d_to_dofs1d(fixity2d: np.ndarray, inds: np.ndarray=None): "\n Returns the indices of the degrees of freedoms\n being supressed. \n\n Optionally, global indices of the rows in 'fixity2d' \n array can be provided by the optional argument 'inds'.\n...
@njit(nogil=True, parallel=True, cache=__cache) def fixity2d_to_dofs1d(fixity2d: np.ndarray, inds: np.ndarray=None): "\n Returns the indices of the degrees of freedoms\n being supressed. \n\n Optionally, global indices of the rows in 'fixity2d' \n array can be provided by the optional argument 'inds'.\n...
4af9cf8ca6ee601c2198679c0a37d418bc1f740d45015dd258c7d65ab339c322
@njit(nogil=True, parallel=True, cache=__cache) def nodes2d_to_dofs1d(inds: np.ndarray, values: np.ndarray): "\n Returns a tuple of degree of freedom indices and data, \n based on a nodal definition.\n\n Parameters\n ----------\n inds : np.ndarray\n 1d numpy array of integers, listing global n...
Returns a tuple of degree of freedom indices and data, based on a nodal definition. Parameters ---------- inds : np.ndarray 1d numpy array of integers, listing global node indices. values : int of shape (nN, nDOF, nRHS) 3d numpy array of floats, listing values for each node in 'inds'. Returns ------- do...
src/dewloosh/solid/fem/utils.py
nodes2d_to_dofs1d
dewloosh/dewloosh-solid
0
python
@njit(nogil=True, parallel=True, cache=__cache) def nodes2d_to_dofs1d(inds: np.ndarray, values: np.ndarray): "\n Returns a tuple of degree of freedom indices and data, \n based on a nodal definition.\n\n Parameters\n ----------\n inds : np.ndarray\n 1d numpy array of integers, listing global n...
@njit(nogil=True, parallel=True, cache=__cache) def nodes2d_to_dofs1d(inds: np.ndarray, values: np.ndarray): "\n Returns a tuple of degree of freedom indices and data, \n based on a nodal definition.\n\n Parameters\n ----------\n inds : np.ndarray\n 1d numpy array of integers, listing global n...
0e5d0d42c1d26bdc0d24b53c61053825302779061153e6f088be81112f3c4ee2
@njit(nogil=True, cache=__cache, parallel=True) def weighted_stiffness_bulk(K: np.ndarray, weights: np.ndarray): '\n Returns a weighted stiffness matrix.\n\n Parameters\n ----------\n K : np.ndarray\n 2d numpy array of floats\n\n weights : np.ndarray\n 1d numpy array of floats\n\n Re...
Returns a weighted stiffness matrix. Parameters ---------- K : np.ndarray 2d numpy array of floats weights : np.ndarray 1d numpy array of floats Returns ------- Kw : np.ndarray 2d numpy array of floats Notes ----- (1) It is assumed that the first axis of K runs along the elements.
src/dewloosh/solid/fem/utils.py
weighted_stiffness_bulk
dewloosh/dewloosh-solid
0
python
@njit(nogil=True, cache=__cache, parallel=True) def weighted_stiffness_bulk(K: np.ndarray, weights: np.ndarray): '\n Returns a weighted stiffness matrix.\n\n Parameters\n ----------\n K : np.ndarray\n 2d numpy array of floats\n\n weights : np.ndarray\n 1d numpy array of floats\n\n Re...
@njit(nogil=True, cache=__cache, parallel=True) def weighted_stiffness_bulk(K: np.ndarray, weights: np.ndarray): '\n Returns a weighted stiffness matrix.\n\n Parameters\n ----------\n K : np.ndarray\n 2d numpy array of floats\n\n weights : np.ndarray\n 1d numpy array of floats\n\n Re...
7024ed9761c0e40a0c78172196cc4c575500e08c3cbcfcb6bfa1fe2d969295b4
@njit(nogil=True, parallel=True, cache=__cache) def irows_icols_bulk(edofs: np.ndarray): '\n Returns row and column index data for several finite elements.\n\n Parameters\n ----------\n edofs : np.ndarray\n 2d numpy array. Each row has the meaning of global degree of \n freedom numbering f...
Returns row and column index data for several finite elements. Parameters ---------- edofs : np.ndarray 2d numpy array. Each row has the meaning of global degree of freedom numbering for a given finite element. Returns ------- irows, icols : np.ndarray, np.ndarray Global indices of the rows and columns o...
src/dewloosh/solid/fem/utils.py
irows_icols_bulk
dewloosh/dewloosh-solid
0
python
@njit(nogil=True, parallel=True, cache=__cache) def irows_icols_bulk(edofs: np.ndarray): '\n Returns row and column index data for several finite elements.\n\n Parameters\n ----------\n edofs : np.ndarray\n 2d numpy array. Each row has the meaning of global degree of \n freedom numbering f...
@njit(nogil=True, parallel=True, cache=__cache) def irows_icols_bulk(edofs: np.ndarray): '\n Returns row and column index data for several finite elements.\n\n Parameters\n ----------\n edofs : np.ndarray\n 2d numpy array. Each row has the meaning of global degree of \n freedom numbering f...
2ac0a68316a0c116a0de45f26e23d6bb43f803b24486dcb6944fadb1b635f764
@njit(nogil=True, cache=__cache, parallel=True) def irows_icols_bulk_filtered(edofs: np.ndarray, inds: np.ndarray): '\n Returns row and column index data for finite elements specified\n by the index array `inds`.\n\n Parameters\n ----------\n edofs : np.ndarray\n 2d numpy array. Each row has t...
Returns row and column index data for finite elements specified by the index array `inds`. Parameters ---------- edofs : np.ndarray 2d numpy array. Each row has the meaning of global degree of freedom numbering for a given finite element. inds: np.ndarray 1d numpy array of integers specifying active elem...
src/dewloosh/solid/fem/utils.py
irows_icols_bulk_filtered
dewloosh/dewloosh-solid
0
python
@njit(nogil=True, cache=__cache, parallel=True) def irows_icols_bulk_filtered(edofs: np.ndarray, inds: np.ndarray): '\n Returns row and column index data for finite elements specified\n by the index array `inds`.\n\n Parameters\n ----------\n edofs : np.ndarray\n 2d numpy array. Each row has t...
@njit(nogil=True, cache=__cache, parallel=True) def irows_icols_bulk_filtered(edofs: np.ndarray, inds: np.ndarray): '\n Returns row and column index data for finite elements specified\n by the index array `inds`.\n\n Parameters\n ----------\n edofs : np.ndarray\n 2d numpy array. Each row has t...
a73ef4a72fe620bb8db786b8f9212a409c50033457612ea81a1a9b76df953723
@njit(nogil=True, cache=__cache, parallel=True) def topo_to_gnum(topo: np.ndarray, ndofn: int): '\n Returns global dof numbering based on element \n topology data.\n\n Parameters\n ----------\n topo : np.ndarray\n 2d numpy array of integers. Topology array listing global\n node numbers ...
Returns global dof numbering based on element topology data. Parameters ---------- topo : np.ndarray 2d numpy array of integers. Topology array listing global node numbers for several elements. ndofn : int Number of degrees of freedoms per node. Returns ------- gnum : np.ndarray 2d numpy array of in...
src/dewloosh/solid/fem/utils.py
topo_to_gnum
dewloosh/dewloosh-solid
0
python
@njit(nogil=True, cache=__cache, parallel=True) def topo_to_gnum(topo: np.ndarray, ndofn: int): '\n Returns global dof numbering based on element \n topology data.\n\n Parameters\n ----------\n topo : np.ndarray\n 2d numpy array of integers. Topology array listing global\n node numbers ...
@njit(nogil=True, cache=__cache, parallel=True) def topo_to_gnum(topo: np.ndarray, ndofn: int): '\n Returns global dof numbering based on element \n topology data.\n\n Parameters\n ----------\n topo : np.ndarray\n 2d numpy array of integers. Topology array listing global\n node numbers ...
e1dba835e64e1e581a477c5bdb5fb8ead2a5f32b825fedbf30c2049846e75028
@njit(nogil=True, parallel=True, fastmath=True, cache=__cache) def assemble_load_vector(values: ndarray, gnum: ndarray, N: int=(- 1)): "\n Returns global dof numbering based on element \n topology data.\n\n Parameters\n ----------\n values : np.ndarray of shape (nE, nEVAB, nRHS)\n 3d numpy arr...
Returns global dof numbering based on element topology data. Parameters ---------- values : np.ndarray of shape (nE, nEVAB, nRHS) 3d numpy array of floats, representing element data. The length of the second axis matches the the number of degrees of freedom per cell. gnum : int Global indices of loca...
src/dewloosh/solid/fem/utils.py
assemble_load_vector
dewloosh/dewloosh-solid
0
python
@njit(nogil=True, parallel=True, fastmath=True, cache=__cache) def assemble_load_vector(values: ndarray, gnum: ndarray, N: int=(- 1)): "\n Returns global dof numbering based on element \n topology data.\n\n Parameters\n ----------\n values : np.ndarray of shape (nE, nEVAB, nRHS)\n 3d numpy arr...
@njit(nogil=True, parallel=True, fastmath=True, cache=__cache) def assemble_load_vector(values: ndarray, gnum: ndarray, N: int=(- 1)): "\n Returns global dof numbering based on element \n topology data.\n\n Parameters\n ----------\n values : np.ndarray of shape (nE, nEVAB, nRHS)\n 3d numpy arr...
bb5fb8e547bdfb0ca18dea5cda2cc68d56f59a3b8eb845531a5a88c83671b05a
@njit(nogil=True, parallel=True, cache=__cache) def approximation_matrix(ndf: ndarray, NDOFN: int): 'Returns a matrix of approximation coefficients \n for all elements.' (nE, nNE) = ndf.shape[:2] N = (nNE * NDOFN) nappr = np.eye(N, dtype=ndf.dtype) res = np.zeros((nE, N, N), dtype=ndf.dtype) ...
Returns a matrix of approximation coefficients for all elements.
src/dewloosh/solid/fem/utils.py
approximation_matrix
dewloosh/dewloosh-solid
0
python
@njit(nogil=True, parallel=True, cache=__cache) def approximation_matrix(ndf: ndarray, NDOFN: int): 'Returns a matrix of approximation coefficients \n for all elements.' (nE, nNE) = ndf.shape[:2] N = (nNE * NDOFN) nappr = np.eye(N, dtype=ndf.dtype) res = np.zeros((nE, N, N), dtype=ndf.dtype) ...
@njit(nogil=True, parallel=True, cache=__cache) def approximation_matrix(ndf: ndarray, NDOFN: int): 'Returns a matrix of approximation coefficients \n for all elements.' (nE, nNE) = ndf.shape[:2] N = (nNE * NDOFN) nappr = np.eye(N, dtype=ndf.dtype) res = np.zeros((nE, N, N), dtype=ndf.dtype) ...
bb1162376e4f7e0f3d90fe0a9ffc025e72c4cc3c8e3063523a8e8de90c573780
@njit(nogil=True, parallel=True, cache=__cache) def nodal_approximation_matrix(ndf: ndarray): 'Returns a matrix of nodal approximation coefficients \n for all elements.' (nE, nNE) = ndf.shape[:2] nappr = np.eye(nNE, dtype=ndf.dtype) res = np.zeros((nE, nNE, nNE), dtype=ndf.dtype) for iE in prange...
Returns a matrix of nodal approximation coefficients for all elements.
src/dewloosh/solid/fem/utils.py
nodal_approximation_matrix
dewloosh/dewloosh-solid
0
python
@njit(nogil=True, parallel=True, cache=__cache) def nodal_approximation_matrix(ndf: ndarray): 'Returns a matrix of nodal approximation coefficients \n for all elements.' (nE, nNE) = ndf.shape[:2] nappr = np.eye(nNE, dtype=ndf.dtype) res = np.zeros((nE, nNE, nNE), dtype=ndf.dtype) for iE in prange...
@njit(nogil=True, parallel=True, cache=__cache) def nodal_approximation_matrix(ndf: ndarray): 'Returns a matrix of nodal approximation coefficients \n for all elements.' (nE, nNE) = ndf.shape[:2] nappr = np.eye(nNE, dtype=ndf.dtype) res = np.zeros((nE, nNE, nNE), dtype=ndf.dtype) for iE in prange...
50bba6f3ce2e670abd4d6d06e117075ac97ab0f92b6898a4dbbb5f28638e3cb0
@njit(nogil=True, parallel=True, cache=__cache) def compatibility_factors_to_coo(ncf: dict, nreg: dict): '\n ncf : nodal_compatibility_factors\n ' nN = len(ncf) widths = np.zeros(nN, dtype=np.int32) for iN in prange(nN): widths[iN] = len(nreg[iN]) shapes = (widths ** 2).astype(np.int64...
ncf : nodal_compatibility_factors
src/dewloosh/solid/fem/utils.py
compatibility_factors_to_coo
dewloosh/dewloosh-solid
0
python
@njit(nogil=True, parallel=True, cache=__cache) def compatibility_factors_to_coo(ncf: dict, nreg: dict): '\n \n ' nN = len(ncf) widths = np.zeros(nN, dtype=np.int32) for iN in prange(nN): widths[iN] = len(nreg[iN]) shapes = (widths ** 2).astype(np.int64) N = np.sum(shapes) data...
@njit(nogil=True, parallel=True, cache=__cache) def compatibility_factors_to_coo(ncf: dict, nreg: dict): '\n \n ' nN = len(ncf) widths = np.zeros(nN, dtype=np.int32) for iN in prange(nN): widths[iN] = len(nreg[iN]) shapes = (widths ** 2).astype(np.int64) N = np.sum(shapes) data...
0c61a6c053f3a63737233d8617a4148f4284f97f295b7c2b5fbd93ff2c1c4729
@njit(nogil=True, cache=__cache) def compatibility_factors(ncf: dict, nreg: dict, NDOFN: int): 'ncf : nodal_compatibility_factors' nN = len(ncf) widths = np.zeros(nN, dtype=np.int32) for iN in prange(nN): widths[iN] = len(nreg[iN]) cf = dict() reg = dict() for iN in range(nN): ...
ncf : nodal_compatibility_factors
src/dewloosh/solid/fem/utils.py
compatibility_factors
dewloosh/dewloosh-solid
0
python
@njit(nogil=True, cache=__cache) def compatibility_factors(ncf: dict, nreg: dict, NDOFN: int): nN = len(ncf) widths = np.zeros(nN, dtype=np.int32) for iN in prange(nN): widths[iN] = len(nreg[iN]) cf = dict() reg = dict() for iN in range(nN): cf[iN] = ncf_to_cf(ncf[iN], NDOFN...
@njit(nogil=True, cache=__cache) def compatibility_factors(ncf: dict, nreg: dict, NDOFN: int): nN = len(ncf) widths = np.zeros(nN, dtype=np.int32) for iN in prange(nN): widths[iN] = len(nreg[iN]) cf = dict() reg = dict() for iN in range(nN): cf[iN] = ncf_to_cf(ncf[iN], NDOFN...
706aa2b6ffb94bd653c911ed39855ed46ac16eaf17924b812a118270a88a20b2
@njit(nogil=True, parallel=True, cache=__cache) def tr_cells_1d_in(A: ndarray, Q: ndarray): "\n Transforms element vectors (like the load vector) from global to local.\n \n Parameters\n ----------\n A : 3d NumPy float array of shape (nE, nEVAB)\n Array of coefficients to transform.\n \n...
Transforms element vectors (like the load vector) from global to local. Parameters ---------- A : 3d NumPy float array of shape (nE, nEVAB) Array of coefficients to transform. Q : 3d NumPy float array of shape (nE, nEVAB, nEVAB) Transformation matrices. Returns ------- numpy array NumPy array wit...
src/dewloosh/solid/fem/utils.py
tr_cells_1d_in
dewloosh/dewloosh-solid
0
python
@njit(nogil=True, parallel=True, cache=__cache) def tr_cells_1d_in(A: ndarray, Q: ndarray): "\n Transforms element vectors (like the load vector) from global to local.\n \n Parameters\n ----------\n A : 3d NumPy float array of shape (nE, nEVAB)\n Array of coefficients to transform.\n \n...
@njit(nogil=True, parallel=True, cache=__cache) def tr_cells_1d_in(A: ndarray, Q: ndarray): "\n Transforms element vectors (like the load vector) from global to local.\n \n Parameters\n ----------\n A : 3d NumPy float array of shape (nE, nEVAB)\n Array of coefficients to transform.\n \n...
bce8c807b472bea6a1b0d87b03a53f26887ca90397bcac4891f2db9a591ffef6
@njit(nogil=True, parallel=True, cache=__cache) def tr_cells_1d_out(A: ndarray, Q: ndarray): '\n Transforms element vectors (like the load vector) from local to global.\n (nE, nNE * nDOF)\n ' res = np.zeros_like(A) for iE in prange(res.shape[0]): res[iE] = (Q[iE].T @ A[iE]) return res
Transforms element vectors (like the load vector) from local to global. (nE, nNE * nDOF)
src/dewloosh/solid/fem/utils.py
tr_cells_1d_out
dewloosh/dewloosh-solid
0
python
@njit(nogil=True, parallel=True, cache=__cache) def tr_cells_1d_out(A: ndarray, Q: ndarray): '\n Transforms element vectors (like the load vector) from local to global.\n (nE, nNE * nDOF)\n ' res = np.zeros_like(A) for iE in prange(res.shape[0]): res[iE] = (Q[iE].T @ A[iE]) return res
@njit(nogil=True, parallel=True, cache=__cache) def tr_cells_1d_out(A: ndarray, Q: ndarray): '\n Transforms element vectors (like the load vector) from local to global.\n (nE, nNE * nDOF)\n ' res = np.zeros_like(A) for iE in prange(res.shape[0]): res[iE] = (Q[iE].T @ A[iE]) return res<|...
460b282299374f7cc353a2e9f88b218b4cd891e8d568192afa140274d47d28f8
@njit(nogil=True, parallel=True, cache=__cache) def tr_cells_1d_in_multi(A: ndarray, Q: ndarray): '\n Transforms element vectors (like the load vector) from local to global\n for multiple cases.\n (nE, nRHS, nNE * nDOF)\n ' res = np.zeros_like(A) for iE in prange(res.shape[0]): for jRHS ...
Transforms element vectors (like the load vector) from local to global for multiple cases. (nE, nRHS, nNE * nDOF)
src/dewloosh/solid/fem/utils.py
tr_cells_1d_in_multi
dewloosh/dewloosh-solid
0
python
@njit(nogil=True, parallel=True, cache=__cache) def tr_cells_1d_in_multi(A: ndarray, Q: ndarray): '\n Transforms element vectors (like the load vector) from local to global\n for multiple cases.\n (nE, nRHS, nNE * nDOF)\n ' res = np.zeros_like(A) for iE in prange(res.shape[0]): for jRHS ...
@njit(nogil=True, parallel=True, cache=__cache) def tr_cells_1d_in_multi(A: ndarray, Q: ndarray): '\n Transforms element vectors (like the load vector) from local to global\n for multiple cases.\n (nE, nRHS, nNE * nDOF)\n ' res = np.zeros_like(A) for iE in prange(res.shape[0]): for jRHS ...
570c402766b5f549f62664a6ebaa6511b6fd8505b7c4a3ad7f4732f4fa7b53ac
@njit(nogil=True, parallel=True, cache=__cache) def tr_cells_1d_out_multi(A: ndarray, Q: ndarray): '\n Transforms element vectors (like the load vector) from local to global\n for multiple cases.\n A (nE, nRHS, nP * nDOF)\n Q (nE, nP * nDOF)\n ' res = np.zeros_like(A) for iE in prange(res.sha...
Transforms element vectors (like the load vector) from local to global for multiple cases. A (nE, nRHS, nP * nDOF) Q (nE, nP * nDOF)
src/dewloosh/solid/fem/utils.py
tr_cells_1d_out_multi
dewloosh/dewloosh-solid
0
python
@njit(nogil=True, parallel=True, cache=__cache) def tr_cells_1d_out_multi(A: ndarray, Q: ndarray): '\n Transforms element vectors (like the load vector) from local to global\n for multiple cases.\n A (nE, nRHS, nP * nDOF)\n Q (nE, nP * nDOF)\n ' res = np.zeros_like(A) for iE in prange(res.sha...
@njit(nogil=True, parallel=True, cache=__cache) def tr_cells_1d_out_multi(A: ndarray, Q: ndarray): '\n Transforms element vectors (like the load vector) from local to global\n for multiple cases.\n A (nE, nRHS, nP * nDOF)\n Q (nE, nP * nDOF)\n ' res = np.zeros_like(A) for iE in prange(res.sha...
48c14f1749031d546f59d593c260eb427c944c049976aa4f83dbb004d69b3537
@njit(nogil=True, parallel=True, cache=__cache) def element_dof_solution_bulk(dofsol1d: ndarray, gnum: ndarray): '\n dofsol (nN * nDOF, nRHS)\n gnum (nE, nEVAB)\n ---\n (nE, nEVAB, nRHS)\n ' nRHS = dofsol1d.shape[1] (nE, nEVAB) = gnum.shape res = np.zeros((nE, nEVAB, nRHS), dtype=dofsol1d...
dofsol (nN * nDOF, nRHS) gnum (nE, nEVAB) --- (nE, nEVAB, nRHS)
src/dewloosh/solid/fem/utils.py
element_dof_solution_bulk
dewloosh/dewloosh-solid
0
python
@njit(nogil=True, parallel=True, cache=__cache) def element_dof_solution_bulk(dofsol1d: ndarray, gnum: ndarray): '\n dofsol (nN * nDOF, nRHS)\n gnum (nE, nEVAB)\n ---\n (nE, nEVAB, nRHS)\n ' nRHS = dofsol1d.shape[1] (nE, nEVAB) = gnum.shape res = np.zeros((nE, nEVAB, nRHS), dtype=dofsol1d...
@njit(nogil=True, parallel=True, cache=__cache) def element_dof_solution_bulk(dofsol1d: ndarray, gnum: ndarray): '\n dofsol (nN * nDOF, nRHS)\n gnum (nE, nEVAB)\n ---\n (nE, nEVAB, nRHS)\n ' nRHS = dofsol1d.shape[1] (nE, nEVAB) = gnum.shape res = np.zeros((nE, nEVAB, nRHS), dtype=dofsol1d...
34020de7c55f02c72a2af25cb36b24d5f702e5b8ade1ddcc44cdc48d8dcae816
@njit(nogil=True, parallel=True, cache=__cache) def transform_stiffness(K: ndarray, dcm: ndarray): '\n Transforms element stiffness matrices from local to global.\n ' res = np.zeros_like(K) for iE in prange(res.shape[0]): res[iE] = ((dcm[iE].T @ K[iE]) @ dcm[iE]) return res
Transforms element stiffness matrices from local to global.
src/dewloosh/solid/fem/utils.py
transform_stiffness
dewloosh/dewloosh-solid
0
python
@njit(nogil=True, parallel=True, cache=__cache) def transform_stiffness(K: ndarray, dcm: ndarray): '\n \n ' res = np.zeros_like(K) for iE in prange(res.shape[0]): res[iE] = ((dcm[iE].T @ K[iE]) @ dcm[iE]) return res
@njit(nogil=True, parallel=True, cache=__cache) def transform_stiffness(K: ndarray, dcm: ndarray): '\n \n ' res = np.zeros_like(K) for iE in prange(res.shape[0]): res[iE] = ((dcm[iE].T @ K[iE]) @ dcm[iE]) return res<|docstring|>Transforms element stiffness matrices from local to global.<|e...
08b76a74bd634fcf902a5eba3a3d0b38e82d08cb87b5b5d7f497ca65bc86ef8d
@njit(nogil=True, parallel=True, cache=__cache) def constrain_local_stiffness_bulk(K: ndarray, factors: ndarray): '\n Returns the condensed stiffness matrices representing constraints\n on the internal forces of the elements (eg. hinges).\n \n Currently this solution is only able to handle two states, b...
Returns the condensed stiffness matrices representing constraints on the internal forces of the elements (eg. hinges). Currently this solution is only able to handle two states, being total free and being fully constrained. The factors are expected to be numbers between 0 and 1, where dofs with a factor > 0.5 are ass...
src/dewloosh/solid/fem/utils.py
constrain_local_stiffness_bulk
dewloosh/dewloosh-solid
0
python
@njit(nogil=True, parallel=True, cache=__cache) def constrain_local_stiffness_bulk(K: ndarray, factors: ndarray): '\n Returns the condensed stiffness matrices representing constraints\n on the internal forces of the elements (eg. hinges).\n \n Currently this solution is only able to handle two states, b...
@njit(nogil=True, parallel=True, cache=__cache) def constrain_local_stiffness_bulk(K: ndarray, factors: ndarray): '\n Returns the condensed stiffness matrices representing constraints\n on the internal forces of the elements (eg. hinges).\n \n Currently this solution is only able to handle two states, b...
9e3a13004692eb0edc689cfebea072f3f3a592d46020c193d501d5c627cf3367
@njit(nogil=True, parallel=True, cache=__cache) def internal_forces(K: ndarray, dofsol: ndarray): '\n Transforms element stiffness matrices from local to global.\n ---\n (nE, nRHS, nEVAB)\n ' (nE, nRHS, nEVAB) = dofsol.shape res = np.zeros_like(dofsol) for i in prange(nE): for j in p...
Transforms element stiffness matrices from local to global. --- (nE, nRHS, nEVAB)
src/dewloosh/solid/fem/utils.py
internal_forces
dewloosh/dewloosh-solid
0
python
@njit(nogil=True, parallel=True, cache=__cache) def internal_forces(K: ndarray, dofsol: ndarray): '\n Transforms element stiffness matrices from local to global.\n ---\n (nE, nRHS, nEVAB)\n ' (nE, nRHS, nEVAB) = dofsol.shape res = np.zeros_like(dofsol) for i in prange(nE): for j in p...
@njit(nogil=True, parallel=True, cache=__cache) def internal_forces(K: ndarray, dofsol: ndarray): '\n Transforms element stiffness matrices from local to global.\n ---\n (nE, nRHS, nEVAB)\n ' (nE, nRHS, nEVAB) = dofsol.shape res = np.zeros_like(dofsol) for i in prange(nE): for j in p...
ab4e1f45d511e525a33cf769de7fec4032425e4fd97b5eca45ba6ca0ef5a8301
def test_get_word_score(): '\n Author: Karl Lundvall\n Date: 2017-11-13\n Purpose: Assert that it is possible to retrieve a score\n from the dictionary and that the score is an integer.\n ' twitter_api = TwitterAPI() dictionary = {'Batman': 0} word = 'Batman' expected1 = 0 expecte...
Author: Karl Lundvall Date: 2017-11-13 Purpose: Assert that it is possible to retrieve a score from the dictionary and that the score is an integer.
Product/TrendManager/UnitTests/test_TwitterAPI.py
test_get_word_score
VincentDehaye/recommender-system-liu
0
python
def test_get_word_score(): '\n Author: Karl Lundvall\n Date: 2017-11-13\n Purpose: Assert that it is possible to retrieve a score\n from the dictionary and that the score is an integer.\n ' twitter_api = TwitterAPI() dictionary = {'Batman': 0} word = 'Batman' expected1 = 0 expecte...
def test_get_word_score(): '\n Author: Karl Lundvall\n Date: 2017-11-13\n Purpose: Assert that it is possible to retrieve a score\n from the dictionary and that the score is an integer.\n ' twitter_api = TwitterAPI() dictionary = {'Batman': 0} word = 'Batman' expected1 = 0 expecte...
73783c718407e6c3c5f53cfad0d2c8ad94addf3ab1f66926bda6e7c0d1ed6d04
def test_format_word(): '\n Author: Karl Lundvall\n Date: 2017-11-13\n Purpose: Assert that words are in lowercase and that\n all non alphabetic or numeric characters gets removed.\n ' twitter_api = TwitterAPI() expected = 'hej' observed = twitter_api.format_word("H*E'?J") assert (obs...
Author: Karl Lundvall Date: 2017-11-13 Purpose: Assert that words are in lowercase and that all non alphabetic or numeric characters gets removed.
Product/TrendManager/UnitTests/test_TwitterAPI.py
test_format_word
VincentDehaye/recommender-system-liu
0
python
def test_format_word(): '\n Author: Karl Lundvall\n Date: 2017-11-13\n Purpose: Assert that words are in lowercase and that\n all non alphabetic or numeric characters gets removed.\n ' twitter_api = TwitterAPI() expected = 'hej' observed = twitter_api.format_word("H*E'?J") assert (obs...
def test_format_word(): '\n Author: Karl Lundvall\n Date: 2017-11-13\n Purpose: Assert that words are in lowercase and that\n all non alphabetic or numeric characters gets removed.\n ' twitter_api = TwitterAPI() expected = 'hej' observed = twitter_api.format_word("H*E'?J") assert (obs...
858c1b80a57de8a0b402b767708ef60e5fc15cc53f654ee0387648255bfc3ca1
def test_load_dict(): '\n Author: Karl Lundvall\n Date: 2017-11-13\n Purpose: Assert that print_dict retrieves a dictionary from the twitter_dataYYYYMMDD.bin.\n ' twitterapi = TwitterAPI() twitterapi.load_new_dict() assert (twitterapi.all_words_new is not None)
Author: Karl Lundvall Date: 2017-11-13 Purpose: Assert that print_dict retrieves a dictionary from the twitter_dataYYYYMMDD.bin.
Product/TrendManager/UnitTests/test_TwitterAPI.py
test_load_dict
VincentDehaye/recommender-system-liu
0
python
def test_load_dict(): '\n Author: Karl Lundvall\n Date: 2017-11-13\n Purpose: Assert that print_dict retrieves a dictionary from the twitter_dataYYYYMMDD.bin.\n ' twitterapi = TwitterAPI() twitterapi.load_new_dict() assert (twitterapi.all_words_new is not None)
def test_load_dict(): '\n Author: Karl Lundvall\n Date: 2017-11-13\n Purpose: Assert that print_dict retrieves a dictionary from the twitter_dataYYYYMMDD.bin.\n ' twitterapi = TwitterAPI() twitterapi.load_new_dict() assert (twitterapi.all_words_new is not None)<|docstring|>Author: Karl Lundv...
3fc1c2569754eb653e0dc7a55411b65e503172f47c5f881aa78ffb34299feb6f
def test_get_twitter_score(): '\n Author: Karl Lundvall\n Date: 2017-11-13\n Purpose: Assert that get_twitter_score retrieves a score.\n ' twitter_api = TwitterAPI() observed = twitter_api.get_twitter_score('rt') assert (observed > 0)
Author: Karl Lundvall Date: 2017-11-13 Purpose: Assert that get_twitter_score retrieves a score.
Product/TrendManager/UnitTests/test_TwitterAPI.py
test_get_twitter_score
VincentDehaye/recommender-system-liu
0
python
def test_get_twitter_score(): '\n Author: Karl Lundvall\n Date: 2017-11-13\n Purpose: Assert that get_twitter_score retrieves a score.\n ' twitter_api = TwitterAPI() observed = twitter_api.get_twitter_score('rt') assert (observed > 0)
def test_get_twitter_score(): '\n Author: Karl Lundvall\n Date: 2017-11-13\n Purpose: Assert that get_twitter_score retrieves a score.\n ' twitter_api = TwitterAPI() observed = twitter_api.get_twitter_score('rt') assert (observed > 0)<|docstring|>Author: Karl Lundvall Date: 2017-11-13 Purpos...
427cd5754ad8eafd50de6c5cf9e60bb69e46549e44987f4d49b56962aee4f1a5
def test_get_newest_file(): '\n Author: Albin Bergvall\n Date: 2017-11-20\n Purpose: Assert that get_newest_file returns a file\n from the twitterdata directory, if the file exists\n ' twitter_api = TwitterAPI() observed = twitter_api.get_newest_file() assert (observed is not None)
Author: Albin Bergvall Date: 2017-11-20 Purpose: Assert that get_newest_file returns a file from the twitterdata directory, if the file exists
Product/TrendManager/UnitTests/test_TwitterAPI.py
test_get_newest_file
VincentDehaye/recommender-system-liu
0
python
def test_get_newest_file(): '\n Author: Albin Bergvall\n Date: 2017-11-20\n Purpose: Assert that get_newest_file returns a file\n from the twitterdata directory, if the file exists\n ' twitter_api = TwitterAPI() observed = twitter_api.get_newest_file() assert (observed is not None)
def test_get_newest_file(): '\n Author: Albin Bergvall\n Date: 2017-11-20\n Purpose: Assert that get_newest_file returns a file\n from the twitterdata directory, if the file exists\n ' twitter_api = TwitterAPI() observed = twitter_api.get_newest_file() assert (observed is not None)<|docst...
8da3c21e201f483b83b14fc6a6d7fedf8d7ac1eb4bdc8a86c3f5d504886e511b
def setup(self, bottom, top): 'Setup the RoIDataLayer.' layer_params = yaml.load(self.param_str) self._num_regions = cfg.TRAIN.num_regions self._num_regions_one_side = int(np.sqrt(self._num_regions)) self._num_classes = (layer_params['num_classes'] - 1) self._agnostic_box = layer_params['agnosti...
Setup the RoIDataLayer.
lib/roi_data_layer/rfcn_anno_layer_new.py
setup
jialinwu17/box_cls_reg
0
python
def setup(self, bottom, top): layer_params = yaml.load(self.param_str) self._num_regions = cfg.TRAIN.num_regions self._num_regions_one_side = int(np.sqrt(self._num_regions)) self._num_classes = (layer_params['num_classes'] - 1) self._agnostic_box = layer_params['agnostic_box'] if self._agno...
def setup(self, bottom, top): layer_params = yaml.load(self.param_str) self._num_regions = cfg.TRAIN.num_regions self._num_regions_one_side = int(np.sqrt(self._num_regions)) self._num_classes = (layer_params['num_classes'] - 1) self._agnostic_box = layer_params['agnostic_box'] if self._agno...
82e3a4184e557ca5b5abf495b2c3c9d65f3531837d53247231e304d742bd0df3
def forward(self, bottom, top): "Get blobs and copy them into this layer's top blob vector." rois = bottom[1].data rfcn_feat = bottom[2].data self._num_rois = bottom[1].data.shape[0] rfcn_conf = bottom[0].data seed_points = np.zeros(((self._num_rois * cfg.TRAIN.M), 2)) seed_points_feat = np....
Get blobs and copy them into this layer's top blob vector.
lib/roi_data_layer/rfcn_anno_layer_new.py
forward
jialinwu17/box_cls_reg
0
python
def forward(self, bottom, top): rois = bottom[1].data rfcn_feat = bottom[2].data self._num_rois = bottom[1].data.shape[0] rfcn_conf = bottom[0].data seed_points = np.zeros(((self._num_rois * cfg.TRAIN.M), 2)) seed_points_feat = np.zeros(((self._num_rois * cfg.TRAIN.M), cfg.TRAIN.num_feature...
def forward(self, bottom, top): rois = bottom[1].data rfcn_feat = bottom[2].data self._num_rois = bottom[1].data.shape[0] rfcn_conf = bottom[0].data seed_points = np.zeros(((self._num_rois * cfg.TRAIN.M), 2)) seed_points_feat = np.zeros(((self._num_rois * cfg.TRAIN.M), cfg.TRAIN.num_feature...
f0bb8e4bfeb0cac29fcadb7c5fdaed5b3d19ffc491ba6bda79983501befd2aa2
def backward(self, top, propagate_down, bottom): 'This layer does not propagate gradients.' pass
This layer does not propagate gradients.
lib/roi_data_layer/rfcn_anno_layer_new.py
backward
jialinwu17/box_cls_reg
0
python
def backward(self, top, propagate_down, bottom): pass
def backward(self, top, propagate_down, bottom): pass<|docstring|>This layer does not propagate gradients.<|endoftext|>
a5f59d623aef4dd060181c592741c81f45856de3d73c8d9185955a625623bec1
def reshape(self, bottom, top): 'Reshaping happens during the call to forward.' pass
Reshaping happens during the call to forward.
lib/roi_data_layer/rfcn_anno_layer_new.py
reshape
jialinwu17/box_cls_reg
0
python
def reshape(self, bottom, top): pass
def reshape(self, bottom, top): pass<|docstring|>Reshaping happens during the call to forward.<|endoftext|>
e86d921c5c24c604eb8a798966d18d4dbdf60285fe5143da1afecfd60d8c801e
def l2_optimality_error(self, params, *args, **kwargs): 'Computes the L2 optimality error.' optimality = self.optimality_fun(params, *args, **kwargs) return tree_util.tree_l2_norm(optimality)
Computes the L2 optimality error.
jaxopt/_src/base.py
l2_optimality_error
gowerrobert/jaxopt
0
python
def l2_optimality_error(self, params, *args, **kwargs): optimality = self.optimality_fun(params, *args, **kwargs) return tree_util.tree_l2_norm(optimality)
def l2_optimality_error(self, params, *args, **kwargs): optimality = self.optimality_fun(params, *args, **kwargs) return tree_util.tree_l2_norm(optimality)<|docstring|>Computes the L2 optimality error.<|endoftext|>
ebc91526557c021da284e940f56c49a63cb6f9f753f214085674522dd0a7482d
def run(self, init_params: Any, *args, **kwargs) -> OptStep: 'Runs the solver until convergence or `maxiter` is reached.\n\n Args:\n init_params: pytree containing the initial parameters.\n *args: additional positional arguments to be passed to the update method.\n **kwargs: additional keyword arg...
Runs the solver until convergence or `maxiter` is reached. Args: init_params: pytree containing the initial parameters. *args: additional positional arguments to be passed to the update method. **kwargs: additional keyword arguments to be passed to the update method. Return type: OptStep Returns: (params, st...
jaxopt/_src/base.py
run
gowerrobert/jaxopt
0
python
def run(self, init_params: Any, *args, **kwargs) -> OptStep: 'Runs the solver until convergence or `maxiter` is reached.\n\n Args:\n init_params: pytree containing the initial parameters.\n *args: additional positional arguments to be passed to the update method.\n **kwargs: additional keyword arg...
def run(self, init_params: Any, *args, **kwargs) -> OptStep: 'Runs the solver until convergence or `maxiter` is reached.\n\n Args:\n init_params: pytree containing the initial parameters.\n *args: additional positional arguments to be passed to the update method.\n **kwargs: additional keyword arg...
f4dbc16fb424b7e71e3d8e98ad0fe60d6abc64bc79fd64ede1842ca99da30e4a
def run_iterator(self, init_params: Any, iterator, *args, **kwargs) -> OptStep: 'Runs the solver on a dataset iterator until `maxiter` is reached.\n\n Args:\n init_params: pytree containing the initial parameters.\n iterator: iterator generating data batches.\n *args: additional positional argumen...
Runs the solver on a dataset iterator until `maxiter` is reached. Args: init_params: pytree containing the initial parameters. iterator: iterator generating data batches. *args: additional positional arguments to be passed to ``fun``. **kwargs: additional keyword arguments to be passed to ``fun``. Return type:...
jaxopt/_src/base.py
run_iterator
gowerrobert/jaxopt
0
python
def run_iterator(self, init_params: Any, iterator, *args, **kwargs) -> OptStep: 'Runs the solver on a dataset iterator until `maxiter` is reached.\n\n Args:\n init_params: pytree containing the initial parameters.\n iterator: iterator generating data batches.\n *args: additional positional argumen...
def run_iterator(self, init_params: Any, iterator, *args, **kwargs) -> OptStep: 'Runs the solver on a dataset iterator until `maxiter` is reached.\n\n Args:\n init_params: pytree containing the initial parameters.\n iterator: iterator generating data batches.\n *args: additional positional argumen...
5a7e3b12370608e1bfc6da3ab161084b41f88d27ccab1b4c80899ff89104aa00
def matvec(self, x): 'Computes dot(A, x).' return jnp.dot(self.A, x)
Computes dot(A, x).
jaxopt/_src/base.py
matvec
gowerrobert/jaxopt
0
python
def matvec(self, x): return jnp.dot(self.A, x)
def matvec(self, x): return jnp.dot(self.A, x)<|docstring|>Computes dot(A, x).<|endoftext|>
073ce50e032a89cf76cf1b672583bf624b7215f954ba5bf51eb8ba9813ade9ab
def matvec_element(self, x, idx): 'Computes dot(A, x)[idx].' return jnp.dot(self.A[idx], x)
Computes dot(A, x)[idx].
jaxopt/_src/base.py
matvec_element
gowerrobert/jaxopt
0
python
def matvec_element(self, x, idx): return jnp.dot(self.A[idx], x)
def matvec_element(self, x, idx): return jnp.dot(self.A[idx], x)<|docstring|>Computes dot(A, x)[idx].<|endoftext|>
264c906dc4c71cee9e5b340469295189c8056f575dfb487ddad526de1f5599eb
def rmatvec(self, x): 'Computes dot(A.T, x).' return jnp.dot(self.A.T, x)
Computes dot(A.T, x).
jaxopt/_src/base.py
rmatvec
gowerrobert/jaxopt
0
python
def rmatvec(self, x): return jnp.dot(self.A.T, x)
def rmatvec(self, x): return jnp.dot(self.A.T, x)<|docstring|>Computes dot(A.T, x).<|endoftext|>
97d58cc7a69f3809428de5547b8299dd3ce6910b1b464565680a479b094d4393
def rmatvec_element(self, x, idx): 'Computes dot(A.T, x)[idx].' return jnp.dot(self.A[(:, idx)], x)
Computes dot(A.T, x)[idx].
jaxopt/_src/base.py
rmatvec_element
gowerrobert/jaxopt
0
python
def rmatvec_element(self, x, idx): return jnp.dot(self.A[(:, idx)], x)
def rmatvec_element(self, x, idx): return jnp.dot(self.A[(:, idx)], x)<|docstring|>Computes dot(A.T, x)[idx].<|endoftext|>
961fd69285e0f6de8272c2f8b82fbda50b8f280a3755080e08753b8673f17b3d
def update_matvec(self, Ax, delta, idx): 'Updates dot(A, x) when x[idx] += delta.' if (len(Ax.shape) == 1): return (Ax + (delta * self.A[(:, idx)])) elif (len(Ax.shape) == 2): return (Ax + jnp.outer(self.A[(:, idx)], delta)) else: raise ValueError('Ax should be a vector or a matr...
Updates dot(A, x) when x[idx] += delta.
jaxopt/_src/base.py
update_matvec
gowerrobert/jaxopt
0
python
def update_matvec(self, Ax, delta, idx): if (len(Ax.shape) == 1): return (Ax + (delta * self.A[(:, idx)])) elif (len(Ax.shape) == 2): return (Ax + jnp.outer(self.A[(:, idx)], delta)) else: raise ValueError('Ax should be a vector or a matrix.')
def update_matvec(self, Ax, delta, idx): if (len(Ax.shape) == 1): return (Ax + (delta * self.A[(:, idx)])) elif (len(Ax.shape) == 2): return (Ax + jnp.outer(self.A[(:, idx)], delta)) else: raise ValueError('Ax should be a vector or a matrix.')<|docstring|>Updates dot(A, x) when ...
f8eb385eeeeb04837c30f37dc717cf604cb7bbd8dc7a953f2560b857b141b63a
def update_rmatvec(self, ATx, delta, idx): 'Updates dot(A.T, x) when x[idx] += delta.' if (len(ATx.shape) == 1): return (ATx + (delta * self.A[idx])) elif (len(ATx.shape) == 2): raise NotImplementedError else: raise ValueError('Ax should be a vector or a matrix.')
Updates dot(A.T, x) when x[idx] += delta.
jaxopt/_src/base.py
update_rmatvec
gowerrobert/jaxopt
0
python
def update_rmatvec(self, ATx, delta, idx): if (len(ATx.shape) == 1): return (ATx + (delta * self.A[idx])) elif (len(ATx.shape) == 2): raise NotImplementedError else: raise ValueError('Ax should be a vector or a matrix.')
def update_rmatvec(self, ATx, delta, idx): if (len(ATx.shape) == 1): return (ATx + (delta * self.A[idx])) elif (len(ATx.shape) == 2): raise NotImplementedError else: raise ValueError('Ax should be a vector or a matrix.')<|docstring|>Updates dot(A.T, x) when x[idx] += delta.<|end...
0a45d67eea0323f499ef8884af15dbc0d730f942a7c6fa5dd8f01efe2164e880
def create_user(self, email, password=None, **kwargs): 'Create and return a `User` with an email and password.' if (email is None): raise TypeError('Users must have an email address.') normalized_email = self.normalize_email(email) username = normalized_email.split('@')[0] kwargs['username']...
Create and return a `User` with an email and password.
authentication/models.py
create_user
RetroFlow/retro-flow
0
python
def create_user(self, email, password=None, **kwargs): if (email is None): raise TypeError('Users must have an email address.') normalized_email = self.normalize_email(email) username = normalized_email.split('@')[0] kwargs['username'] = (kwargs.get('username') or username) user = self....
def create_user(self, email, password=None, **kwargs): if (email is None): raise TypeError('Users must have an email address.') normalized_email = self.normalize_email(email) username = normalized_email.split('@')[0] kwargs['username'] = (kwargs.get('username') or username) user = self....
bbae092fd7eba3103bb5e5457194994ade7d57e75a02c1dd885da477f5ff3a20
def create_superuser(self, email, password, **kwargs): '\n Create and return a `User` with superuser (admin) permissions.\n ' if (password is None): raise TypeError('Superusers must have a password.') user = self.create_user(email, password, **kwargs) user.is_superuser = True u...
Create and return a `User` with superuser (admin) permissions.
authentication/models.py
create_superuser
RetroFlow/retro-flow
0
python
def create_superuser(self, email, password, **kwargs): '\n \n ' if (password is None): raise TypeError('Superusers must have a password.') user = self.create_user(email, password, **kwargs) user.is_superuser = True user.is_staff = True user.save() return user
def create_superuser(self, email, password, **kwargs): '\n \n ' if (password is None): raise TypeError('Superusers must have a password.') user = self.create_user(email, password, **kwargs) user.is_superuser = True user.is_staff = True user.save() return user<|docstring...
ce52496434047a2506e1537ba004076ee35cc4678912654b1b93a5c1338706c0
def __str__(self): '\n Returns a string representation of this `User`.\n\n This string is used when a `User` is printed in the console.\n ' return self.email
Returns a string representation of this `User`. This string is used when a `User` is printed in the console.
authentication/models.py
__str__
RetroFlow/retro-flow
0
python
def __str__(self): '\n Returns a string representation of this `User`.\n\n This string is used when a `User` is printed in the console.\n ' return self.email
def __str__(self): '\n Returns a string representation of this `User`.\n\n This string is used when a `User` is printed in the console.\n ' return self.email<|docstring|>Returns a string representation of this `User`. This string is used when a `User` is printed in the console.<|endoftext|...
9f840d32a404226e21f6172a633a7a881bddf1ce5744c1f2f30b930e489d7e42
@property def token(self): '\n Allows us to get a user\'s token by calling `user.token` instead of\n `user.generate_jwt_token().\n\n The `@property` decorator above makes this possible. `token` is called\n a "dynamic property".\n ' return self._generate_jwt_token()
Allows us to get a user's token by calling `user.token` instead of `user.generate_jwt_token(). The `@property` decorator above makes this possible. `token` is called a "dynamic property".
authentication/models.py
token
RetroFlow/retro-flow
0
python
@property def token(self): '\n Allows us to get a user\'s token by calling `user.token` instead of\n `user.generate_jwt_token().\n\n The `@property` decorator above makes this possible. `token` is called\n a "dynamic property".\n ' return self._generate_jwt_token()
@property def token(self): '\n Allows us to get a user\'s token by calling `user.token` instead of\n `user.generate_jwt_token().\n\n The `@property` decorator above makes this possible. `token` is called\n a "dynamic property".\n ' return self._generate_jwt_token()<|docstring|...
47c2fc5c2e880b63a42b60c398cb6ea9c1c3b659194c6974861d33f082ba21a2
def get_full_name(self): "\n This method is required by Django for things like handling emails.\n Typically this would be the user's first and last name.\n " return self.username
This method is required by Django for things like handling emails. Typically this would be the user's first and last name.
authentication/models.py
get_full_name
RetroFlow/retro-flow
0
python
def get_full_name(self): "\n This method is required by Django for things like handling emails.\n Typically this would be the user's first and last name.\n " return self.username
def get_full_name(self): "\n This method is required by Django for things like handling emails.\n Typically this would be the user's first and last name.\n " return self.username<|docstring|>This method is required by Django for things like handling emails. Typically this would be the user'...
111d26353f75acbc68a5edddce397bb0f1cec0cfb26546c5e25ebacd6f703913
def get_short_name(self): "\n This method is required by Django for things like handling emails.\n Typically, this would be the user's first name. Since we do not store\n the user's real name, we return their username instead.\n " return self.username
This method is required by Django for things like handling emails. Typically, this would be the user's first name. Since we do not store the user's real name, we return their username instead.
authentication/models.py
get_short_name
RetroFlow/retro-flow
0
python
def get_short_name(self): "\n This method is required by Django for things like handling emails.\n Typically, this would be the user's first name. Since we do not store\n the user's real name, we return their username instead.\n " return self.username
def get_short_name(self): "\n This method is required by Django for things like handling emails.\n Typically, this would be the user's first name. Since we do not store\n the user's real name, we return their username instead.\n " return self.username<|docstring|>This method is requi...