Search is not available for this dataset
identifier stringlengths 1 155 | parameters stringlengths 2 6.09k | docstring stringlengths 11 63.4k | docstring_summary stringlengths 0 63.4k | function stringlengths 29 99.8k | function_tokens list | start_point list | end_point list | language stringclasses 1
value | docstring_language stringlengths 2 7 | docstring_language_predictions stringlengths 18 23 | is_langid_reliable stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
test_state_decorator_exiting_only | (tmpdir) | Tests that state is not changed inside a run function and set to `exiting` after. | Tests that state is not changed inside a run function and set to `exiting` after. | def test_state_decorator_exiting_only(tmpdir):
""" Tests that state is not changed inside a run function and set to `exiting` after. """
@trainer_state(exiting=TrainerState.FINISHED)
def test_method(self):
return self.state
trainer = Trainer(default_root_dir=tmpdir)
snapshot_state = test_... | [
"def",
"test_state_decorator_exiting_only",
"(",
"tmpdir",
")",
":",
"@",
"trainer_state",
"(",
"exiting",
"=",
"TrainerState",
".",
"FINISHED",
")",
"def",
"test_method",
"(",
"self",
")",
":",
"return",
"self",
".",
"state",
"trainer",
"=",
"Trainer",
"(",
... | [
68,
0
] | [
80,
49
] | python | en | ['en', 'en', 'en'] | True |
test_state_decorator_entering_and_exiting | (tmpdir) | Tests that state is set to `entering` inside a run function and set ot `exiting` after. | Tests that state is set to `entering` inside a run function and set ot `exiting` after. | def test_state_decorator_entering_and_exiting(tmpdir):
""" Tests that state is set to `entering` inside a run function and set ot `exiting` after. """
@trainer_state(entering=TrainerState.RUNNING, exiting=TrainerState.FINISHED)
def test_method(self):
return self.state
trainer = Trainer(default... | [
"def",
"test_state_decorator_entering_and_exiting",
"(",
"tmpdir",
")",
":",
"@",
"trainer_state",
"(",
"entering",
"=",
"TrainerState",
".",
"RUNNING",
",",
"exiting",
"=",
"TrainerState",
".",
"FINISHED",
")",
"def",
"test_method",
"(",
"self",
")",
":",
"retu... | [
83,
0
] | [
95,
49
] | python | en | ['en', 'en', 'en'] | True |
test_state_decorator_interrupt | (tmpdir) | Tests that state remains `INTERRUPTED` is its set in run function. | Tests that state remains `INTERRUPTED` is its set in run function. | def test_state_decorator_interrupt(tmpdir):
""" Tests that state remains `INTERRUPTED` is its set in run function. """
@trainer_state(exiting=TrainerState.FINISHED)
def test_method(self):
self._state = TrainerState.INTERRUPTED
trainer = Trainer(default_root_dir=tmpdir)
test_method(trainer... | [
"def",
"test_state_decorator_interrupt",
"(",
"tmpdir",
")",
":",
"@",
"trainer_state",
"(",
"exiting",
"=",
"TrainerState",
".",
"FINISHED",
")",
"def",
"test_method",
"(",
"self",
")",
":",
"self",
".",
"_state",
"=",
"TrainerState",
".",
"INTERRUPTED",
"tra... | [
98,
0
] | [
108,
52
] | python | en | ['en', 'en', 'en'] | True |
test_initialize_state | (tmpdir) | Tests that state is INITIALIZE after Trainer creation | Tests that state is INITIALIZE after Trainer creation | def test_initialize_state(tmpdir):
""" Tests that state is INITIALIZE after Trainer creation """
trainer = Trainer(default_root_dir=tmpdir)
assert trainer.state == TrainerState.INITIALIZING | [
"def",
"test_initialize_state",
"(",
"tmpdir",
")",
":",
"trainer",
"=",
"Trainer",
"(",
"default_root_dir",
"=",
"tmpdir",
")",
"assert",
"trainer",
".",
"state",
"==",
"TrainerState",
".",
"INITIALIZING"
] | [
111,
0
] | [
114,
53
] | python | en | ['en', 'en', 'en'] | True |
test_running_state_during_fit | (tmpdir, extra_params) | Tests that state is set to RUNNING during fit | Tests that state is set to RUNNING during fit | def test_running_state_during_fit(tmpdir, extra_params):
""" Tests that state is set to RUNNING during fit """
hparams = EvalModelTemplate.get_default_hparams()
model = EvalModelTemplate(**hparams)
snapshot_callback = StateSnapshotCallback(snapshot_method='on_batch_start')
trainer = Trainer(callb... | [
"def",
"test_running_state_during_fit",
"(",
"tmpdir",
",",
"extra_params",
")",
":",
"hparams",
"=",
"EvalModelTemplate",
".",
"get_default_hparams",
"(",
")",
"model",
"=",
"EvalModelTemplate",
"(",
"*",
"*",
"hparams",
")",
"snapshot_callback",
"=",
"StateSnapsho... | [
123,
0
] | [
135,
66
] | python | en | ['en', 'en', 'en'] | True |
test_finished_state_after_fit | (tmpdir, extra_params) | Tests that state is FINISHED after fit | Tests that state is FINISHED after fit | def test_finished_state_after_fit(tmpdir, extra_params):
""" Tests that state is FINISHED after fit """
hparams = EvalModelTemplate.get_default_hparams()
model = EvalModelTemplate(**hparams)
trainer = Trainer(default_root_dir=tmpdir, **extra_params)
trainer.fit(model)
assert trainer.state == ... | [
"def",
"test_finished_state_after_fit",
"(",
"tmpdir",
",",
"extra_params",
")",
":",
"hparams",
"=",
"EvalModelTemplate",
".",
"get_default_hparams",
"(",
")",
"model",
"=",
"EvalModelTemplate",
"(",
"*",
"*",
"hparams",
")",
"trainer",
"=",
"Trainer",
"(",
"de... | [
144,
0
] | [
153,
90
] | python | en | ['en', 'en', 'en'] | True |
test_running_state_during_test | (tmpdir) | Tests that state is set to RUNNING during test | Tests that state is set to RUNNING during test | def test_running_state_during_test(tmpdir):
""" Tests that state is set to RUNNING during test """
hparams = EvalModelTemplate.get_default_hparams()
model = EvalModelTemplate(**hparams)
snapshot_callback = StateSnapshotCallback(snapshot_method='on_test_batch_start')
trainer = Trainer(
cal... | [
"def",
"test_running_state_during_test",
"(",
"tmpdir",
")",
":",
"hparams",
"=",
"EvalModelTemplate",
".",
"get_default_hparams",
"(",
")",
"model",
"=",
"EvalModelTemplate",
"(",
"*",
"*",
"hparams",
")",
"snapshot_callback",
"=",
"StateSnapshotCallback",
"(",
"sn... | [
156,
0
] | [
172,
66
] | python | en | ['en', 'en', 'en'] | True |
test_finished_state_after_test | (tmpdir) | Tests that state is FINISHED after fit | Tests that state is FINISHED after fit | def test_finished_state_after_test(tmpdir):
""" Tests that state is FINISHED after fit """
hparams = EvalModelTemplate.get_default_hparams()
model = EvalModelTemplate(**hparams)
trainer = Trainer(
default_root_dir=tmpdir,
fast_dev_run=True,
)
trainer.test(model)
assert tra... | [
"def",
"test_finished_state_after_test",
"(",
"tmpdir",
")",
":",
"hparams",
"=",
"EvalModelTemplate",
".",
"get_default_hparams",
"(",
")",
"model",
"=",
"EvalModelTemplate",
"(",
"*",
"*",
"hparams",
")",
"trainer",
"=",
"Trainer",
"(",
"default_root_dir",
"=",
... | [
175,
0
] | [
187,
90
] | python | en | ['en', 'en', 'en'] | True |
test_interrupt_state_on_keyboard_interrupt | (tmpdir, extra_params) | Tests that state is set to INTERRUPTED on KeyboardInterrupt | Tests that state is set to INTERRUPTED on KeyboardInterrupt | def test_interrupt_state_on_keyboard_interrupt(tmpdir, extra_params):
""" Tests that state is set to INTERRUPTED on KeyboardInterrupt """
hparams = EvalModelTemplate.get_default_hparams()
model = EvalModelTemplate(**hparams)
class InterruptCallback(Callback):
def __init__(self):
su... | [
"def",
"test_interrupt_state_on_keyboard_interrupt",
"(",
"tmpdir",
",",
"extra_params",
")",
":",
"hparams",
"=",
"EvalModelTemplate",
".",
"get_default_hparams",
"(",
")",
"model",
"=",
"EvalModelTemplate",
"(",
"*",
"*",
"hparams",
")",
"class",
"InterruptCallback"... | [
196,
0
] | [
213,
52
] | python | en | ['en', 'en', 'en'] | True |
four_digit_combinations | () | print out all 4-digit numbers in old way | print out all 4-digit numbers in old way | def four_digit_combinations():
""" print out all 4-digit numbers in old way"""
numbers = []
for code in range(10000):
code = str(code).zfill(4)
print(code)
numbers.append(code) | [
"def",
"four_digit_combinations",
"(",
")",
":",
"numbers",
"=",
"[",
"]",
"for",
"code",
"in",
"range",
"(",
"10000",
")",
":",
"code",
"=",
"str",
"(",
"code",
")",
".",
"zfill",
"(",
"4",
")",
"print",
"(",
"code",
")",
"numbers",
".",
"append",... | [
4,
0
] | [
10,
28
] | python | en | ['en', 'en', 'en'] | True |
one_line_combinations | () | print out all 4-digit numbers | print out all 4-digit numbers | def one_line_combinations():
""" print out all 4-digit numbers """
numbers = [str(i).zfill(4) for i in range(10000)]
print(numbers) | [
"def",
"one_line_combinations",
"(",
")",
":",
"numbers",
"=",
"[",
"str",
"(",
"i",
")",
".",
"zfill",
"(",
"4",
")",
"for",
"i",
"in",
"range",
"(",
"10000",
")",
"]",
"print",
"(",
"numbers",
")"
] | [
14,
0
] | [
17,
18
] | python | en | ['en', 'en', 'en'] | True |
test_kwargs | (mode) | Test behavior of pad's kwargs for the given mode. | Test behavior of pad's kwargs for the given mode. | def test_kwargs(mode):
"""Test behavior of pad's kwargs for the given mode."""
allowed = _all_modes[mode]
not_allowed = {}
for kwargs in _all_modes.values():
if kwargs != allowed:
not_allowed.update(kwargs)
# Test if allowed keyword arguments pass
np.pad([1, 2, 3], 1, mode, *... | [
"def",
"test_kwargs",
"(",
"mode",
")",
":",
"allowed",
"=",
"_all_modes",
"[",
"mode",
"]",
"not_allowed",
"=",
"{",
"}",
"for",
"kwargs",
"in",
"_all_modes",
".",
"values",
"(",
")",
":",
"if",
"kwargs",
"!=",
"allowed",
":",
"not_allowed",
".",
"upd... | [
1287,
0
] | [
1300,
54
] | python | en | ['en', 'en', 'en'] | True |
test_memory_layout_persistence | (mode) | Test if C and F order is preserved for all pad modes. | Test if C and F order is preserved for all pad modes. | def test_memory_layout_persistence(mode):
"""Test if C and F order is preserved for all pad modes."""
x = np.ones((5, 10), order='C')
assert np.pad(x, 5, mode).flags["C_CONTIGUOUS"]
x = np.ones((5, 10), order='F')
assert np.pad(x, 5, mode).flags["F_CONTIGUOUS"] | [
"def",
"test_memory_layout_persistence",
"(",
"mode",
")",
":",
"x",
"=",
"np",
".",
"ones",
"(",
"(",
"5",
",",
"10",
")",
",",
"order",
"=",
"'C'",
")",
"assert",
"np",
".",
"pad",
"(",
"x",
",",
"5",
",",
"mode",
")",
".",
"flags",
"[",
"\"C... | [
1324,
0
] | [
1329,
51
] | python | en | ['en', 'en', 'en'] | True |
TestAsPairs.test_single_value | (self) | Test casting for a single value. | Test casting for a single value. | def test_single_value(self):
"""Test casting for a single value."""
expected = np.array([[3, 3]] * 10)
for x in (3, [3], [[3]]):
result = _as_pairs(x, 10)
assert_equal(result, expected)
# Test with dtype=object
obj = object()
assert_equal(
... | [
"def",
"test_single_value",
"(",
"self",
")",
":",
"expected",
"=",
"np",
".",
"array",
"(",
"[",
"[",
"3",
",",
"3",
"]",
"]",
"*",
"10",
")",
"for",
"x",
"in",
"(",
"3",
",",
"[",
"3",
"]",
",",
"[",
"[",
"3",
"]",
"]",
")",
":",
"resul... | [
34,
4
] | [
45,
9
] | python | en | ['en', 'en', 'en'] | True |
TestAsPairs.test_two_values | (self) | Test proper casting for two different values. | Test proper casting for two different values. | def test_two_values(self):
"""Test proper casting for two different values."""
# Broadcasting in the first dimension with numbers
expected = np.array([[3, 4]] * 10)
for x in ([3, 4], [[3, 4]]):
result = _as_pairs(x, 10)
assert_equal(result, expected)
# and... | [
"def",
"test_two_values",
"(",
"self",
")",
":",
"# Broadcasting in the first dimension with numbers",
"expected",
"=",
"np",
".",
"array",
"(",
"[",
"[",
"3",
",",
"4",
"]",
"]",
"*",
"10",
")",
"for",
"x",
"in",
"(",
"[",
"3",
",",
"4",
"]",
",",
"... | [
47,
4
] | [
70,
9
] | python | en | ['en', 'en', 'en'] | True |
TestAsPairs.test_pass_through | (self) | Test if `x` already matching desired output are passed through. | Test if `x` already matching desired output are passed through. | def test_pass_through(self):
"""Test if `x` already matching desired output are passed through."""
expected = np.arange(12).reshape((6, 2))
assert_equal(
_as_pairs(expected, 6),
expected
) | [
"def",
"test_pass_through",
"(",
"self",
")",
":",
"expected",
"=",
"np",
".",
"arange",
"(",
"12",
")",
".",
"reshape",
"(",
"(",
"6",
",",
"2",
")",
")",
"assert_equal",
"(",
"_as_pairs",
"(",
"expected",
",",
"6",
")",
",",
"expected",
")"
] | [
83,
4
] | [
89,
9
] | python | en | ['en', 'en', 'en'] | True |
TestAsPairs.test_as_index | (self) | Test results if `as_index=True`. | Test results if `as_index=True`. | def test_as_index(self):
"""Test results if `as_index=True`."""
assert_equal(
_as_pairs([2.6, 3.3], 10, as_index=True),
np.array([[3, 3]] * 10, dtype=np.intp)
)
assert_equal(
_as_pairs([2.6, 4.49], 10, as_index=True),
np.array([[3, 4]] * 10... | [
"def",
"test_as_index",
"(",
"self",
")",
":",
"assert_equal",
"(",
"_as_pairs",
"(",
"[",
"2.6",
",",
"3.3",
"]",
",",
"10",
",",
"as_index",
"=",
"True",
")",
",",
"np",
".",
"array",
"(",
"[",
"[",
"3",
",",
"3",
"]",
"]",
"*",
"10",
",",
... | [
91,
4
] | [
104,
47
] | python | en | ['en', 'en', 'en'] | True |
TestAsPairs.test_exceptions | (self) | Ensure faulty usage is discovered. | Ensure faulty usage is discovered. | def test_exceptions(self):
"""Ensure faulty usage is discovered."""
with pytest.raises(ValueError, match="more dimensions than allowed"):
_as_pairs([[[3]]], 10)
with pytest.raises(ValueError, match="could not be broadcast"):
_as_pairs([[1, 2], [3, 4]], 3)
with pyt... | [
"def",
"test_exceptions",
"(",
"self",
")",
":",
"with",
"pytest",
".",
"raises",
"(",
"ValueError",
",",
"match",
"=",
"\"more dimensions than allowed\"",
")",
":",
"_as_pairs",
"(",
"[",
"[",
"[",
"3",
"]",
"]",
"]",
",",
"10",
")",
"with",
"pytest",
... | [
106,
4
] | [
113,
41
] | python | en | ['en', 'en', 'en'] | True |
TestStatistic.test_same_prepend_append | (self, mode) | Test that appended and prepended values are equal | Test that appended and prepended values are equal | def test_same_prepend_append(self, mode):
""" Test that appended and prepended values are equal """
# This test is constructed to trigger floating point rounding errors in
# a way that caused gh-11216 for mode=='mean'
a = np.array([-1, 2, -1]) + np.array([0, 1e-12, 0], dtype=np.float64)
... | [
"def",
"test_same_prepend_append",
"(",
"self",
",",
"mode",
")",
":",
"# This test is constructed to trigger floating point rounding errors in",
"# a way that caused gh-11216 for mode=='mean'",
"a",
"=",
"np",
".",
"array",
"(",
"[",
"-",
"1",
",",
"2",
",",
"-",
"1",
... | [
437,
4
] | [
443,
33
] | python | en | ['en', 'en', 'en'] | True |
TestLinearRamp.test_end_values | (self) | Ensure that end values are exact. | Ensure that end values are exact. | def test_end_values(self):
"""Ensure that end values are exact."""
a = np.pad(np.ones(10).reshape(2, 5), (223, 123), mode="linear_ramp")
assert_equal(a[:, 0], 0.)
assert_equal(a[:, -1], 0.)
assert_equal(a[0, :], 0.)
assert_equal(a[-1, :], 0.) | [
"def",
"test_end_values",
"(",
"self",
")",
":",
"a",
"=",
"np",
".",
"pad",
"(",
"np",
".",
"ones",
"(",
"10",
")",
".",
"reshape",
"(",
"2",
",",
"5",
")",
",",
"(",
"223",
",",
"123",
")",
",",
"mode",
"=",
"\"linear_ramp\"",
")",
"assert_eq... | [
714,
4
] | [
720,
34
] | python | en | ['en', 'en', 'en'] | True |
TestLinearRamp.test_negative_difference | (self, dtype) |
Check correct behavior of unsigned dtypes if there is a negative
difference between the edge to pad and `end_values`. Check both cases
to be independent of implementation. Test behavior for all other dtypes
in case dtype casting interferes with complex dtypes. See gh-14191.
|
Check correct behavior of unsigned dtypes if there is a negative
difference between the edge to pad and `end_values`. Check both cases
to be independent of implementation. Test behavior for all other dtypes
in case dtype casting interferes with complex dtypes. See gh-14191.
| def test_negative_difference(self, dtype):
"""
Check correct behavior of unsigned dtypes if there is a negative
difference between the edge to pad and `end_values`. Check both cases
to be independent of implementation. Test behavior for all other dtypes
in case dtype casting inte... | [
"def",
"test_negative_difference",
"(",
"self",
",",
"dtype",
")",
":",
"x",
"=",
"np",
".",
"array",
"(",
"[",
"3",
"]",
",",
"dtype",
"=",
"dtype",
")",
"result",
"=",
"np",
".",
"pad",
"(",
"x",
",",
"3",
",",
"mode",
"=",
"\"linear_ramp\"",
"... | [
723,
4
] | [
738,
38
] | python | en | ['en', 'error', 'th'] | False |
TestWrap.test_repeated_wrapping | (self) |
Check wrapping on each side individually if the wrapped area is longer
than the original array.
|
Check wrapping on each side individually if the wrapped area is longer
than the original array.
| def test_repeated_wrapping(self):
"""
Check wrapping on each side individually if the wrapped area is longer
than the original array.
"""
a = np.arange(5)
b = np.pad(a, (12, 0), mode="wrap")
assert_array_equal(np.r_[a, a, a, a][3:], b)
a = np.arange(5)
... | [
"def",
"test_repeated_wrapping",
"(",
"self",
")",
":",
"a",
"=",
"np",
".",
"arange",
"(",
"5",
")",
"b",
"=",
"np",
".",
"pad",
"(",
"a",
",",
"(",
"12",
",",
"0",
")",
",",
"mode",
"=",
"\"wrap\"",
")",
"assert_array_equal",
"(",
"np",
".",
... | [
1109,
4
] | [
1120,
53
] | python | en | ['en', 'error', 'th'] | False |
rank_zero_experiment | (fn: Callable) | Returns the real experiment on rank 0 and otherwise the DummyExperiment. | Returns the real experiment on rank 0 and otherwise the DummyExperiment. | def rank_zero_experiment(fn: Callable) -> Callable:
""" Returns the real experiment on rank 0 and otherwise the DummyExperiment. """
@wraps(fn)
def experiment(self):
@rank_zero_only
def get_experiment():
return fn(self)
return get_experiment() or DummyExperiment()
... | [
"def",
"rank_zero_experiment",
"(",
"fn",
":",
"Callable",
")",
"->",
"Callable",
":",
"@",
"wraps",
"(",
"fn",
")",
"def",
"experiment",
"(",
"self",
")",
":",
"@",
"rank_zero_only",
"def",
"get_experiment",
"(",
")",
":",
"return",
"fn",
"(",
"self",
... | [
30,
0
] | [
42,
21
] | python | en | ['en', 'en', 'en'] | True |
merge_dicts | (
dicts: Sequence[Mapping],
agg_key_funcs: Optional[Mapping[str, Callable[[Sequence[float]], float]]] = None,
default_func: Callable[[Sequence[float]], float] = np.mean
) |
Merge a sequence with dictionaries into one dictionary by aggregating the
same keys with some given function.
Args:
dicts:
Sequence of dictionaries to be merged.
agg_key_funcs:
Mapping from key name to function. This function will aggregate a
list of val... |
Merge a sequence with dictionaries into one dictionary by aggregating the
same keys with some given function. | def merge_dicts(
dicts: Sequence[Mapping],
agg_key_funcs: Optional[Mapping[str, Callable[[Sequence[float]], float]]] = None,
default_func: Callable[[Sequence[float]], float] = np.mean
) -> Dict:
"""
Merge a sequence with dictionaries into one dictionary by aggregating the
same keys with some giv... | [
"def",
"merge_dicts",
"(",
"dicts",
":",
"Sequence",
"[",
"Mapping",
"]",
",",
"agg_key_funcs",
":",
"Optional",
"[",
"Mapping",
"[",
"str",
",",
"Callable",
"[",
"[",
"Sequence",
"[",
"float",
"]",
"]",
",",
"float",
"]",
"]",
"]",
"=",
"None",
",",... | [
458,
0
] | [
509,
16
] | python | en | ['en', 'error', 'th'] | False |
LightningLoggerBase.update_agg_funcs | (
self,
agg_key_funcs: Optional[Mapping[str, Callable[[Sequence[float]], float]]] = None,
agg_default_func: Callable[[Sequence[float]], float] = np.mean
) |
Update aggregation methods.
Args:
agg_key_funcs:
Dictionary which maps a metric name to a function, which will
aggregate the metric values for the same steps.
agg_default_func:
Default function to aggregate metric values. If some ... |
Update aggregation methods. | def update_agg_funcs(
self,
agg_key_funcs: Optional[Mapping[str, Callable[[Sequence[float]], float]]] = None,
agg_default_func: Callable[[Sequence[float]], float] = np.mean
):
"""
Update aggregation methods.
Args:
agg_key_funcs:
Dictionary... | [
"def",
"update_agg_funcs",
"(",
"self",
",",
"agg_key_funcs",
":",
"Optional",
"[",
"Mapping",
"[",
"str",
",",
"Callable",
"[",
"[",
"Sequence",
"[",
"float",
"]",
"]",
",",
"float",
"]",
"]",
"]",
"=",
"None",
",",
"agg_default_func",
":",
"Callable",
... | [
73,
4
] | [
93,
53
] | python | en | ['en', 'error', 'th'] | False |
LightningLoggerBase.experiment | (self) | Return the experiment object associated with this logger. | Return the experiment object associated with this logger. | def experiment(self) -> Any:
"""Return the experiment object associated with this logger.""" | [
"def",
"experiment",
"(",
"self",
")",
"->",
"Any",
":"
] | [
97,
4
] | [
98,
71
] | python | en | ['en', 'en', 'en'] | True |
LightningLoggerBase._aggregate_metrics | (self,
metrics: Dict[str, float],
step: Optional[int] = None) |
Aggregates metrics.
Args:
metrics: Dictionary with metric names as keys and measured quantities as values
step: Step number at which the metrics should be recorded
Returns:
Step and aggregated metrics. The return value could be ``None``. In such case, metri... |
Aggregates metrics. | def _aggregate_metrics(self,
metrics: Dict[str, float],
step: Optional[int] = None) -> Tuple[int, Optional[Dict[str, float]]]:
"""
Aggregates metrics.
Args:
metrics: Dictionary with metric names as keys and measured quantities as... | [
"def",
"_aggregate_metrics",
"(",
"self",
",",
"metrics",
":",
"Dict",
"[",
"str",
",",
"float",
"]",
",",
"step",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
")",
"->",
"Tuple",
"[",
"int",
",",
"Optional",
"[",
"Dict",
"[",
"str",
",",
"float"... | [
100,
4
] | [
125,
33
] | python | en | ['en', 'error', 'th'] | False |
LightningLoggerBase._reduce_agg_metrics | (self) | Aggregate accumulated metrics. | Aggregate accumulated metrics. | def _reduce_agg_metrics(self):
"""Aggregate accumulated metrics."""
# compute the metrics
if not self._metrics_to_agg:
agg_mets = None
elif len(self._metrics_to_agg) == 1:
agg_mets = self._metrics_to_agg[0]
else:
agg_mets = merge_dicts(self._me... | [
"def",
"_reduce_agg_metrics",
"(",
"self",
")",
":",
"# compute the metrics",
"if",
"not",
"self",
".",
"_metrics_to_agg",
":",
"agg_mets",
"=",
"None",
"elif",
"len",
"(",
"self",
".",
"_metrics_to_agg",
")",
"==",
"1",
":",
"agg_mets",
"=",
"self",
".",
... | [
127,
4
] | [
136,
40
] | python | co | ['en', 'co', 'it'] | False |
LightningLoggerBase._finalize_agg_metrics | (self) | This shall be called before save/close. | This shall be called before save/close. | def _finalize_agg_metrics(self):
"""This shall be called before save/close."""
agg_step, metrics_to_log = self._reduce_agg_metrics()
self._metrics_to_agg = []
if metrics_to_log is not None:
self.log_metrics(metrics=metrics_to_log, step=agg_step) | [
"def",
"_finalize_agg_metrics",
"(",
"self",
")",
":",
"agg_step",
",",
"metrics_to_log",
"=",
"self",
".",
"_reduce_agg_metrics",
"(",
")",
"self",
".",
"_metrics_to_agg",
"=",
"[",
"]",
"if",
"metrics_to_log",
"is",
"not",
"None",
":",
"self",
".",
"log_me... | [
138,
4
] | [
144,
67
] | python | en | ['en', 'en', 'en'] | True |
LightningLoggerBase.agg_and_log_metrics | (self, metrics: Dict[str, float], step: Optional[int] = None) |
Aggregates and records metrics.
This method doesn't log the passed metrics instantaneously, but instead
it aggregates them and logs only if metrics are ready to be logged.
Args:
metrics: Dictionary with metric names as keys and measured quantities as values
step... |
Aggregates and records metrics.
This method doesn't log the passed metrics instantaneously, but instead
it aggregates them and logs only if metrics are ready to be logged. | def agg_and_log_metrics(self, metrics: Dict[str, float], step: Optional[int] = None):
"""
Aggregates and records metrics.
This method doesn't log the passed metrics instantaneously, but instead
it aggregates them and logs only if metrics are ready to be logged.
Args:
... | [
"def",
"agg_and_log_metrics",
"(",
"self",
",",
"metrics",
":",
"Dict",
"[",
"str",
",",
"float",
"]",
",",
"step",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
")",
":",
"agg_step",
",",
"metrics_to_log",
"=",
"self",
".",
"_aggregate_metrics",
"(",
... | [
146,
4
] | [
159,
67
] | python | en | ['en', 'error', 'th'] | False |
LightningLoggerBase.log_metrics | (self, metrics: Dict[str, float], step: Optional[int] = None) |
Records metrics.
This method logs metrics as as soon as it received them. If you want to aggregate
metrics for one specific `step`, use the
:meth:`~pytorch_lightning.loggers.base.LightningLoggerBase.agg_and_log_metrics` method.
Args:
metrics: Dictionary with metric ... |
Records metrics.
This method logs metrics as as soon as it received them. If you want to aggregate
metrics for one specific `step`, use the
:meth:`~pytorch_lightning.loggers.base.LightningLoggerBase.agg_and_log_metrics` method. | def log_metrics(self, metrics: Dict[str, float], step: Optional[int] = None):
"""
Records metrics.
This method logs metrics as as soon as it received them. If you want to aggregate
metrics for one specific `step`, use the
:meth:`~pytorch_lightning.loggers.base.LightningLoggerBase... | [
"def",
"log_metrics",
"(",
"self",
",",
"metrics",
":",
"Dict",
"[",
"str",
",",
"float",
"]",
",",
"step",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
")",
":",
"pass"
] | [
162,
4
] | [
173,
12
] | python | en | ['en', 'error', 'th'] | False |
LightningLoggerBase._sanitize_callable_params | (params: Dict[str, Any]) |
Sanitize callable params dict, e.g. ``{'a': <function_**** at 0x****>} -> {'a': 'function_****'}``.
Args:
params: Dictionary containing the hyperparameters
Returns:
dictionary with all callables sanitized
|
Sanitize callable params dict, e.g. ``{'a': <function_**** at 0x****>} -> {'a': 'function_****'}``. | def _sanitize_callable_params(params: Dict[str, Any]) -> Dict[str, Any]:
"""
Sanitize callable params dict, e.g. ``{'a': <function_**** at 0x****>} -> {'a': 'function_****'}``.
Args:
params: Dictionary containing the hyperparameters
Returns:
dictionary with all ... | [
"def",
"_sanitize_callable_params",
"(",
"params",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"def",
"_sanitize_callable",
"(",
"val",
")",
":",
"# Give them one chance to return a value. Don't go rabbit hole of ... | [
187,
4
] | [
211,
76
] | python | en | ['en', 'error', 'th'] | False |
LightningLoggerBase._flatten_dict | (params: Dict[Any, Any], delimiter: str = '/') |
Flatten hierarchical dict, e.g. ``{'a': {'b': 'c'}} -> {'a/b': 'c'}``.
Args:
params: Dictionary containing the hyperparameters
delimiter: Delimiter to express the hierarchy. Defaults to ``'/'``.
Returns:
Flattened dict.
Examples:
>>> Li... |
Flatten hierarchical dict, e.g. ``{'a': {'b': 'c'}} -> {'a/b': 'c'}``. | def _flatten_dict(params: Dict[Any, Any], delimiter: str = '/') -> Dict[str, Any]:
"""
Flatten hierarchical dict, e.g. ``{'a': {'b': 'c'}} -> {'a/b': 'c'}``.
Args:
params: Dictionary containing the hyperparameters
delimiter: Delimiter to express the hierarchy. Defaults t... | [
"def",
"_flatten_dict",
"(",
"params",
":",
"Dict",
"[",
"Any",
",",
"Any",
"]",
",",
"delimiter",
":",
"str",
"=",
"'/'",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"def",
"_dict_generator",
"(",
"input_dict",
",",
"prefixes",
"=",
"None",... | [
214,
4
] | [
248,
84
] | python | en | ['en', 'error', 'th'] | False |
LightningLoggerBase._sanitize_params | (params: Dict[str, Any]) |
Returns params with non-primitvies converted to strings for logging.
>>> params = {"float": 0.3,
... "int": 1,
... "string": "abc",
... "bool": True,
... "list": [1, 2, 3],
... "namespace": Namespace(foo=3),
... |
Returns params with non-primitvies converted to strings for logging. | def _sanitize_params(params: Dict[str, Any]) -> Dict[str, Any]:
"""
Returns params with non-primitvies converted to strings for logging.
>>> params = {"float": 0.3,
... "int": 1,
... "string": "abc",
... "bool": True,
... "... | [
"def",
"_sanitize_params",
"(",
"params",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"for",
"k",
"in",
"params",
".",
"keys",
"(",
")",
":",
"# convert relevant np scalars to python types first (instead of ... | [
251,
4
] | [
278,
21
] | python | en | ['en', 'error', 'th'] | False |
LightningLoggerBase.log_hyperparams | (self, params: argparse.Namespace) |
Record hyperparameters.
Args:
params: :class:`~argparse.Namespace` containing the hyperparameters
|
Record hyperparameters. | def log_hyperparams(self, params: argparse.Namespace):
"""
Record hyperparameters.
Args:
params: :class:`~argparse.Namespace` containing the hyperparameters
""" | [
"def",
"log_hyperparams",
"(",
"self",
",",
"params",
":",
"argparse",
".",
"Namespace",
")",
":"
] | [
281,
4
] | [
287,
11
] | python | en | ['en', 'error', 'th'] | False |
LightningLoggerBase.log_graph | (self, model: LightningModule, input_array=None) |
Record model graph
Args:
model: lightning model
input_array: input passes to `model.forward`
|
Record model graph | def log_graph(self, model: LightningModule, input_array=None) -> None:
"""
Record model graph
Args:
model: lightning model
input_array: input passes to `model.forward`
"""
pass | [
"def",
"log_graph",
"(",
"self",
",",
"model",
":",
"LightningModule",
",",
"input_array",
"=",
"None",
")",
"->",
"None",
":",
"pass"
] | [
289,
4
] | [
297,
12
] | python | en | ['en', 'error', 'th'] | False |
LightningLoggerBase.save | (self) | Save log data. | Save log data. | def save(self) -> None:
"""Save log data."""
self._finalize_agg_metrics() | [
"def",
"save",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"_finalize_agg_metrics",
"(",
")"
] | [
299,
4
] | [
301,
36
] | python | en | ['en', 'hi-Latn', 'en'] | True |
LightningLoggerBase.finalize | (self, status: str) |
Do any processing that is necessary to finalize an experiment.
Args:
status: Status that the experiment finished with (e.g. success, failed, aborted)
|
Do any processing that is necessary to finalize an experiment. | def finalize(self, status: str) -> None:
"""
Do any processing that is necessary to finalize an experiment.
Args:
status: Status that the experiment finished with (e.g. success, failed, aborted)
"""
self.save() | [
"def",
"finalize",
"(",
"self",
",",
"status",
":",
"str",
")",
"->",
"None",
":",
"self",
".",
"save",
"(",
")"
] | [
303,
4
] | [
310,
19
] | python | en | ['en', 'error', 'th'] | False |
LightningLoggerBase.close | (self) | Do any cleanup that is necessary to close an experiment. | Do any cleanup that is necessary to close an experiment. | def close(self) -> None:
"""Do any cleanup that is necessary to close an experiment."""
self.save() | [
"def",
"close",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"save",
"(",
")"
] | [
312,
4
] | [
314,
19
] | python | en | ['en', 'en', 'en'] | True |
LightningLoggerBase.save_dir | (self) |
Return the root directory where experiment logs get saved, or `None` if the logger does not
save data locally.
|
Return the root directory where experiment logs get saved, or `None` if the logger does not
save data locally.
| def save_dir(self) -> Optional[str]:
"""
Return the root directory where experiment logs get saved, or `None` if the logger does not
save data locally.
"""
return None | [
"def",
"save_dir",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"return",
"None"
] | [
317,
4
] | [
322,
19
] | python | en | ['en', 'error', 'th'] | False |
LightningLoggerBase.name | (self) | Return the experiment name. | Return the experiment name. | def name(self) -> str:
"""Return the experiment name.""" | [
"def",
"name",
"(",
"self",
")",
"->",
"str",
":"
] | [
326,
4
] | [
327,
41
] | python | en | ['en', 'mi', 'en'] | True |
LightningLoggerBase.version | (self) | Return the experiment version. | Return the experiment version. | def version(self) -> Union[int, str]:
"""Return the experiment version.""" | [
"def",
"version",
"(",
"self",
")",
"->",
"Union",
"[",
"int",
",",
"str",
"]",
":"
] | [
331,
4
] | [
332,
44
] | python | en | ['en', 'en', 'en'] | True |
to_list | (x, default=None) | Coerce to a list. | Coerce to a list. | def to_list(x, default=None):
"""Coerce to a list."""
if x is None:
return default
if not isinstance(x, (list, tuple)):
return [x]
else:
return x | [
"def",
"to_list",
"(",
"x",
",",
"default",
"=",
"None",
")",
":",
"if",
"x",
"is",
"None",
":",
"return",
"default",
"if",
"not",
"isinstance",
"(",
"x",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"return",
"[",
"x",
"]",
"else",
":",
"ret... | [
69,
0
] | [
76,
16
] | python | en | ['en', 'ig', 'en'] | True |
test_dm_reload_dataloaders_every_epoch | (tmpdir) | Test datamodule, where trainer argument
reload_dataloaders_every_epoch is set to True/False | Test datamodule, where trainer argument
reload_dataloaders_every_epoch is set to True/False | def test_dm_reload_dataloaders_every_epoch(tmpdir):
"""Test datamodule, where trainer argument
reload_dataloaders_every_epoch is set to True/False"""
class CustomBoringDataModule(BoringDataModule):
def __init__(self):
super().__init__()
self._epochs_called_for = []
... | [
"def",
"test_dm_reload_dataloaders_every_epoch",
"(",
"tmpdir",
")",
":",
"class",
"CustomBoringDataModule",
"(",
"BoringDataModule",
")",
":",
"def",
"__init__",
"(",
"self",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"self",
".",
"_epochs_called_f... | [
484,
0
] | [
515,
26
] | python | en | ['en', 'en', 'en'] | True |
fft | (a, n=None, axis=-1, norm=None) |
Compute the one-dimensional discrete Fourier Transform.
This function computes the one-dimensional *n*-point discrete Fourier
Transform (DFT) with the efficient Fast Fourier Transform (FFT)
algorithm [CT].
Parameters
----------
a : array_like
Input array, can be complex.
n : i... |
Compute the one-dimensional discrete Fourier Transform. | def fft(a, n=None, axis=-1, norm=None):
"""
Compute the one-dimensional discrete Fourier Transform.
This function computes the one-dimensional *n*-point discrete Fourier
Transform (DFT) with the efficient Fast Fourier Transform (FFT)
algorithm [CT].
Parameters
----------
a : array_like... | [
"def",
"fft",
"(",
"a",
",",
"n",
"=",
"None",
",",
"axis",
"=",
"-",
"1",
",",
"norm",
"=",
"None",
")",
":",
"a",
"=",
"asarray",
"(",
"a",
")",
"if",
"n",
"is",
"None",
":",
"n",
"=",
"a",
".",
"shape",
"[",
"axis",
"]",
"inv_norm",
"=... | [
98,
0
] | [
188,
17
] | python | en | ['en', 'error', 'th'] | False |
ifft | (a, n=None, axis=-1, norm=None) |
Compute the one-dimensional inverse discrete Fourier Transform.
This function computes the inverse of the one-dimensional *n*-point
discrete Fourier transform computed by `fft`. In other words,
``ifft(fft(a)) == a`` to within numerical accuracy.
For a general description of the algorithm and defi... |
Compute the one-dimensional inverse discrete Fourier Transform. | def ifft(a, n=None, axis=-1, norm=None):
"""
Compute the one-dimensional inverse discrete Fourier Transform.
This function computes the inverse of the one-dimensional *n*-point
discrete Fourier transform computed by `fft`. In other words,
``ifft(fft(a)) == a`` to within numerical accuracy.
For... | [
"def",
"ifft",
"(",
"a",
",",
"n",
"=",
"None",
",",
"axis",
"=",
"-",
"1",
",",
"norm",
"=",
"None",
")",
":",
"a",
"=",
"asarray",
"(",
"a",
")",
"if",
"n",
"is",
"None",
":",
"n",
"=",
"a",
".",
"shape",
"[",
"axis",
"]",
"if",
"norm",... | [
192,
0
] | [
284,
17
] | python | en | ['en', 'error', 'th'] | False |
rfft | (a, n=None, axis=-1, norm=None) |
Compute the one-dimensional discrete Fourier Transform for real input.
This function computes the one-dimensional *n*-point discrete Fourier
Transform (DFT) of a real-valued array by means of an efficient algorithm
called the Fast Fourier Transform (FFT).
Parameters
----------
a : array_l... |
Compute the one-dimensional discrete Fourier Transform for real input. | def rfft(a, n=None, axis=-1, norm=None):
"""
Compute the one-dimensional discrete Fourier Transform for real input.
This function computes the one-dimensional *n*-point discrete Fourier
Transform (DFT) of a real-valued array by means of an efficient algorithm
called the Fast Fourier Transform (FFT)... | [
"def",
"rfft",
"(",
"a",
",",
"n",
"=",
"None",
",",
"axis",
"=",
"-",
"1",
",",
"norm",
"=",
"None",
")",
":",
"a",
"=",
"asarray",
"(",
"a",
")",
"inv_norm",
"=",
"1",
"if",
"norm",
"is",
"not",
"None",
"and",
"_unitary",
"(",
"norm",
")",
... | [
289,
0
] | [
374,
17
] | python | en | ['en', 'error', 'th'] | False |
irfft | (a, n=None, axis=-1, norm=None) |
Compute the inverse of the n-point DFT for real input.
This function computes the inverse of the one-dimensional *n*-point
discrete Fourier Transform of real input computed by `rfft`.
In other words, ``irfft(rfft(a), len(a)) == a`` to within numerical
accuracy. (See Notes below for why ``len(a)`` ... |
Compute the inverse of the n-point DFT for real input. | def irfft(a, n=None, axis=-1, norm=None):
"""
Compute the inverse of the n-point DFT for real input.
This function computes the inverse of the one-dimensional *n*-point
discrete Fourier Transform of real input computed by `rfft`.
In other words, ``irfft(rfft(a), len(a)) == a`` to within numerical
... | [
"def",
"irfft",
"(",
"a",
",",
"n",
"=",
"None",
",",
"axis",
"=",
"-",
"1",
",",
"norm",
"=",
"None",
")",
":",
"a",
"=",
"asarray",
"(",
"a",
")",
"if",
"n",
"is",
"None",
":",
"n",
"=",
"(",
"a",
".",
"shape",
"[",
"axis",
"]",
"-",
... | [
378,
0
] | [
474,
17
] | python | en | ['en', 'error', 'th'] | False |
hfft | (a, n=None, axis=-1, norm=None) |
Compute the FFT of a signal that has Hermitian symmetry, i.e., a real
spectrum.
Parameters
----------
a : array_like
The input array.
n : int, optional
Length of the transformed axis of the output. For `n` output
points, ``n//2 + 1`` input points are necessary. If the ... |
Compute the FFT of a signal that has Hermitian symmetry, i.e., a real
spectrum. | def hfft(a, n=None, axis=-1, norm=None):
"""
Compute the FFT of a signal that has Hermitian symmetry, i.e., a real
spectrum.
Parameters
----------
a : array_like
The input array.
n : int, optional
Length of the transformed axis of the output. For `n` output
points, `... | [
"def",
"hfft",
"(",
"a",
",",
"n",
"=",
"None",
",",
"axis",
"=",
"-",
"1",
",",
"norm",
"=",
"None",
")",
":",
"a",
"=",
"asarray",
"(",
"a",
")",
"if",
"n",
"is",
"None",
":",
"n",
"=",
"(",
"a",
".",
"shape",
"[",
"axis",
"]",
"-",
"... | [
478,
0
] | [
565,
69
] | python | en | ['en', 'error', 'th'] | False |
ihfft | (a, n=None, axis=-1, norm=None) |
Compute the inverse FFT of a signal that has Hermitian symmetry.
Parameters
----------
a : array_like
Input array.
n : int, optional
Length of the inverse FFT, the number of points along
transformation axis in the input to use. If `n` is smaller than
the length of ... |
Compute the inverse FFT of a signal that has Hermitian symmetry. | def ihfft(a, n=None, axis=-1, norm=None):
"""
Compute the inverse FFT of a signal that has Hermitian symmetry.
Parameters
----------
a : array_like
Input array.
n : int, optional
Length of the inverse FFT, the number of points along
transformation axis in the input to us... | [
"def",
"ihfft",
"(",
"a",
",",
"n",
"=",
"None",
",",
"axis",
"=",
"-",
"1",
",",
"norm",
"=",
"None",
")",
":",
"a",
"=",
"asarray",
"(",
"a",
")",
"if",
"n",
"is",
"None",
":",
"n",
"=",
"a",
".",
"shape",
"[",
"axis",
"]",
"unitary",
"... | [
569,
0
] | [
626,
53
] | python | en | ['en', 'error', 'th'] | False |
fftn | (a, s=None, axes=None, norm=None) |
Compute the N-dimensional discrete Fourier Transform.
This function computes the *N*-dimensional discrete Fourier Transform over
any number of axes in an *M*-dimensional array by means of the Fast Fourier
Transform (FFT).
Parameters
----------
a : array_like
Input array, can be co... |
Compute the N-dimensional discrete Fourier Transform. | def fftn(a, s=None, axes=None, norm=None):
"""
Compute the N-dimensional discrete Fourier Transform.
This function computes the *N*-dimensional discrete Fourier Transform over
any number of axes in an *M*-dimensional array by means of the Fast Fourier
Transform (FFT).
Parameters
----------... | [
"def",
"fftn",
"(",
"a",
",",
"s",
"=",
"None",
",",
"axes",
"=",
"None",
",",
"norm",
"=",
"None",
")",
":",
"return",
"_raw_fftnd",
"(",
"a",
",",
"s",
",",
"axes",
",",
"fft",
",",
"norm",
")"
] | [
663,
0
] | [
757,
44
] | python | en | ['en', 'error', 'th'] | False |
ifftn | (a, s=None, axes=None, norm=None) |
Compute the N-dimensional inverse discrete Fourier Transform.
This function computes the inverse of the N-dimensional discrete
Fourier Transform over any number of axes in an M-dimensional array by
means of the Fast Fourier Transform (FFT). In other words,
``ifftn(fftn(a)) == a`` to within numeri... |
Compute the N-dimensional inverse discrete Fourier Transform. | def ifftn(a, s=None, axes=None, norm=None):
"""
Compute the N-dimensional inverse discrete Fourier Transform.
This function computes the inverse of the N-dimensional discrete
Fourier Transform over any number of axes in an M-dimensional array by
means of the Fast Fourier Transform (FFT). In other ... | [
"def",
"ifftn",
"(",
"a",
",",
"s",
"=",
"None",
",",
"axes",
"=",
"None",
",",
"norm",
"=",
"None",
")",
":",
"return",
"_raw_fftnd",
"(",
"a",
",",
"s",
",",
"axes",
",",
"ifft",
",",
"norm",
")"
] | [
761,
0
] | [
855,
45
] | python | en | ['en', 'error', 'th'] | False |
fft2 | (a, s=None, axes=(-2, -1), norm=None) |
Compute the 2-dimensional discrete Fourier Transform
This function computes the *n*-dimensional discrete Fourier Transform
over any axes in an *M*-dimensional array by means of the
Fast Fourier Transform (FFT). By default, the transform is computed over
the last two axes of the input array, i.e.,... |
Compute the 2-dimensional discrete Fourier Transform | def fft2(a, s=None, axes=(-2, -1), norm=None):
"""
Compute the 2-dimensional discrete Fourier Transform
This function computes the *n*-dimensional discrete Fourier Transform
over any axes in an *M*-dimensional array by means of the
Fast Fourier Transform (FFT). By default, the transform is compute... | [
"def",
"fft2",
"(",
"a",
",",
"s",
"=",
"None",
",",
"axes",
"=",
"(",
"-",
"2",
",",
"-",
"1",
")",
",",
"norm",
"=",
"None",
")",
":",
"return",
"_raw_fftnd",
"(",
"a",
",",
"s",
",",
"axes",
",",
"fft",
",",
"norm",
")"
] | [
859,
0
] | [
946,
44
] | python | en | ['en', 'error', 'th'] | False |
ifft2 | (a, s=None, axes=(-2, -1), norm=None) |
Compute the 2-dimensional inverse discrete Fourier Transform.
This function computes the inverse of the 2-dimensional discrete Fourier
Transform over any number of axes in an M-dimensional array by means of
the Fast Fourier Transform (FFT). In other words, ``ifft2(fft2(a)) == a``
to within numeri... |
Compute the 2-dimensional inverse discrete Fourier Transform. | def ifft2(a, s=None, axes=(-2, -1), norm=None):
"""
Compute the 2-dimensional inverse discrete Fourier Transform.
This function computes the inverse of the 2-dimensional discrete Fourier
Transform over any number of axes in an M-dimensional array by means of
the Fast Fourier Transform (FFT). In ot... | [
"def",
"ifft2",
"(",
"a",
",",
"s",
"=",
"None",
",",
"axes",
"=",
"(",
"-",
"2",
",",
"-",
"1",
")",
",",
"norm",
"=",
"None",
")",
":",
"return",
"_raw_fftnd",
"(",
"a",
",",
"s",
",",
"axes",
",",
"ifft",
",",
"norm",
")"
] | [
950,
0
] | [
1034,
45
] | python | en | ['en', 'error', 'th'] | False |
rfftn | (a, s=None, axes=None, norm=None) |
Compute the N-dimensional discrete Fourier Transform for real input.
This function computes the N-dimensional discrete Fourier Transform over
any number of axes in an M-dimensional real array by means of the Fast
Fourier Transform (FFT). By default, all axes are transformed, with the
real transfo... |
Compute the N-dimensional discrete Fourier Transform for real input. | def rfftn(a, s=None, axes=None, norm=None):
"""
Compute the N-dimensional discrete Fourier Transform for real input.
This function computes the N-dimensional discrete Fourier Transform over
any number of axes in an M-dimensional real array by means of the Fast
Fourier Transform (FFT). By default, ... | [
"def",
"rfftn",
"(",
"a",
",",
"s",
"=",
"None",
",",
"axes",
"=",
"None",
",",
"norm",
"=",
"None",
")",
":",
"a",
"=",
"asarray",
"(",
"a",
")",
"s",
",",
"axes",
"=",
"_cook_nd_args",
"(",
"a",
",",
"s",
",",
"axes",
")",
"a",
"=",
"rfft... | [
1038,
0
] | [
1126,
12
] | python | en | ['en', 'error', 'th'] | False |
rfft2 | (a, s=None, axes=(-2, -1), norm=None) |
Compute the 2-dimensional FFT of a real array.
Parameters
----------
a : array
Input array, taken to be real.
s : sequence of ints, optional
Shape of the FFT.
axes : sequence of ints, optional
Axes over which to compute the FFT.
norm : {None, "ortho"}, optional
... |
Compute the 2-dimensional FFT of a real array. | def rfft2(a, s=None, axes=(-2, -1), norm=None):
"""
Compute the 2-dimensional FFT of a real array.
Parameters
----------
a : array
Input array, taken to be real.
s : sequence of ints, optional
Shape of the FFT.
axes : sequence of ints, optional
Axes over which to com... | [
"def",
"rfft2",
"(",
"a",
",",
"s",
"=",
"None",
",",
"axes",
"=",
"(",
"-",
"2",
",",
"-",
"1",
")",
",",
"norm",
"=",
"None",
")",
":",
"return",
"rfftn",
"(",
"a",
",",
"s",
",",
"axes",
",",
"norm",
")"
] | [
1130,
0
] | [
1164,
34
] | python | en | ['en', 'error', 'th'] | False |
irfftn | (a, s=None, axes=None, norm=None) |
Compute the inverse of the N-dimensional FFT of real input.
This function computes the inverse of the N-dimensional discrete
Fourier Transform for real input over any number of axes in an
M-dimensional array by means of the Fast Fourier Transform (FFT). In
other words, ``irfftn(rfftn(a), a.shape)... |
Compute the inverse of the N-dimensional FFT of real input. | def irfftn(a, s=None, axes=None, norm=None):
"""
Compute the inverse of the N-dimensional FFT of real input.
This function computes the inverse of the N-dimensional discrete
Fourier Transform for real input over any number of axes in an
M-dimensional array by means of the Fast Fourier Transform (FF... | [
"def",
"irfftn",
"(",
"a",
",",
"s",
"=",
"None",
",",
"axes",
"=",
"None",
",",
"norm",
"=",
"None",
")",
":",
"a",
"=",
"asarray",
"(",
"a",
")",
"s",
",",
"axes",
"=",
"_cook_nd_args",
"(",
"a",
",",
"s",
",",
"axes",
",",
"invreal",
"=",
... | [
1168,
0
] | [
1268,
12
] | python | en | ['en', 'error', 'th'] | False |
irfft2 | (a, s=None, axes=(-2, -1), norm=None) |
Compute the 2-dimensional inverse FFT of a real array.
Parameters
----------
a : array_like
The input array
s : sequence of ints, optional
Shape of the real output to the inverse FFT.
axes : sequence of ints, optional
The axes over which to compute the inverse fft.
... |
Compute the 2-dimensional inverse FFT of a real array. | def irfft2(a, s=None, axes=(-2, -1), norm=None):
"""
Compute the 2-dimensional inverse FFT of a real array.
Parameters
----------
a : array_like
The input array
s : sequence of ints, optional
Shape of the real output to the inverse FFT.
axes : sequence of ints, optional
... | [
"def",
"irfft2",
"(",
"a",
",",
"s",
"=",
"None",
",",
"axes",
"=",
"(",
"-",
"2",
",",
"-",
"1",
")",
",",
"norm",
"=",
"None",
")",
":",
"return",
"irfftn",
"(",
"a",
",",
"s",
",",
"axes",
",",
"norm",
")"
] | [
1272,
0
] | [
1306,
35
] | python | en | ['en', 'error', 'th'] | False |
_flip_smpl_pose | (pose) | Flip SMPL pose parameters horizontally.
Args:
pose (np.ndarray([72])): SMPL pose parameters
Returns:
pose_flipped
| Flip SMPL pose parameters horizontally. | def _flip_smpl_pose(pose):
"""Flip SMPL pose parameters horizontally.
Args:
pose (np.ndarray([72])): SMPL pose parameters
Returns:
pose_flipped
"""
flippedParts = [
0, 1, 2, 6, 7, 8, 3, 4, 5, 9, 10, 11, 15, 16, 17, 12, 13, 14, 18, 19,
20, 24, 25, 26, 21, 22, 23, 27... | [
"def",
"_flip_smpl_pose",
"(",
"pose",
")",
":",
"flippedParts",
"=",
"[",
"0",
",",
"1",
",",
"2",
",",
"6",
",",
"7",
",",
"8",
",",
"3",
",",
"4",
",",
"5",
",",
"9",
",",
"10",
",",
"11",
",",
"15",
",",
"16",
",",
"17",
",",
"12",
... | [
10,
0
] | [
30,
23
] | python | en | ['en', 'lt', 'en'] | True |
_flip_iuv | (iuv, uv_type='BF') | Flip IUV image horizontally.
Notes:
IUV image height: H
IUV image width: W
Args:
iuv np.ndarray([H, W, 3]): IUV image
uv_type (str): The type of the UV map.
Candidate values:
'DP': The UV map used in DensePose project.
'SMPL': The def... | Flip IUV image horizontally. | def _flip_iuv(iuv, uv_type='BF'):
"""Flip IUV image horizontally.
Notes:
IUV image height: H
IUV image width: W
Args:
iuv np.ndarray([H, W, 3]): IUV image
uv_type (str): The type of the UV map.
Candidate values:
'DP': The UV map used in DensePose... | [
"def",
"_flip_iuv",
"(",
"iuv",
",",
"uv_type",
"=",
"'BF'",
")",
":",
"assert",
"uv_type",
"in",
"[",
"'DP'",
",",
"'SMPL'",
",",
"'BF'",
"]",
"if",
"uv_type",
"==",
"'BF'",
":",
"iuv_flipped",
"=",
"iuv",
"[",
":",
",",
":",
":",
"-",
"1",
",",... | [
33,
0
] | [
61,
22
] | python | en | ['en', 'sn', 'en'] | True |
_construct_rotation_matrix | (rot, size=3) | Construct the in-plane rotation matrix.
Args:
rot (float): Rotation angle (degree).
size (int): The size of the rotation matrix.
Candidate Values: 2, 3. Defaults to 3.
Returns:
rot_mat (np.ndarray([size, size]): Rotation matrix.
| Construct the in-plane rotation matrix. | def _construct_rotation_matrix(rot, size=3):
"""Construct the in-plane rotation matrix.
Args:
rot (float): Rotation angle (degree).
size (int): The size of the rotation matrix.
Candidate Values: 2, 3. Defaults to 3.
Returns:
rot_mat (np.ndarray([size, size]): Rotation m... | [
"def",
"_construct_rotation_matrix",
"(",
"rot",
",",
"size",
"=",
"3",
")",
":",
"rot_mat",
"=",
"np",
".",
"eye",
"(",
"size",
",",
"dtype",
"=",
"np",
".",
"float32",
")",
"if",
"rot",
"!=",
"0",
":",
"rot_rad",
"=",
"np",
".",
"deg2rad",
"(",
... | [
64,
0
] | [
82,
18
] | python | en | ['en', 'en', 'en'] | True |
_rotate_joints_3d | (joints_3d, rot) | Rotate the 3D joints in the local coordinates.
Notes:
Joints number: K
Args:
joints_3d (np.ndarray([K, 3])): Coordinates of keypoints.
rot (float): Rotation angle (degree).
Returns:
joints_3d_rotated
| Rotate the 3D joints in the local coordinates. | def _rotate_joints_3d(joints_3d, rot):
"""Rotate the 3D joints in the local coordinates.
Notes:
Joints number: K
Args:
joints_3d (np.ndarray([K, 3])): Coordinates of keypoints.
rot (float): Rotation angle (degree).
Returns:
joints_3d_rotated
"""
# in-plane rota... | [
"def",
"_rotate_joints_3d",
"(",
"joints_3d",
",",
"rot",
")",
":",
"# in-plane rotation",
"# 3D joints are rotated counterclockwise,",
"# so the rot angle is inversed.",
"rot_mat",
"=",
"_construct_rotation_matrix",
"(",
"-",
"rot",
",",
"3",
")",
"joints_3d_rotated",
"=",... | [
85,
0
] | [
105,
28
] | python | en | ['en', 'en', 'en'] | True |
_rotate_smpl_pose | (pose, rot) | Rotate SMPL pose parameters. SMPL (https://smpl.is.tue.mpg.de/) is a 3D
human model.
Args:
pose (np.ndarray([72])): SMPL pose parameters
rot (float): Rotation angle (degree).
Returns:
pose_rotated
| Rotate SMPL pose parameters. SMPL (https://smpl.is.tue.mpg.de/) is a 3D
human model. | def _rotate_smpl_pose(pose, rot):
"""Rotate SMPL pose parameters. SMPL (https://smpl.is.tue.mpg.de/) is a 3D
human model.
Args:
pose (np.ndarray([72])): SMPL pose parameters
rot (float): Rotation angle (degree).
Returns:
pose_rotated
"""
pose_rotated = pose.copy()
i... | [
"def",
"_rotate_smpl_pose",
"(",
"pose",
",",
"rot",
")",
":",
"pose_rotated",
"=",
"pose",
".",
"copy",
"(",
")",
"if",
"rot",
"!=",
"0",
":",
"rot_mat",
"=",
"_construct_rotation_matrix",
"(",
"-",
"rot",
")",
"orient",
"=",
"pose",
"[",
":",
"3",
... | [
108,
0
] | [
129,
23
] | python | en | ['en', 'fr', 'en'] | True |
_flip_joints_3d | (joints_3d, joints_3d_visible, flip_pairs) | Flip human joints in 3D space horizontally.
Note:
num_keypoints: K
Args:
joints_3d (np.ndarray([K, 3])): Coordinates of keypoints.
joints_3d_visible (np.ndarray([K, 1])): Visibility of keypoints.
flip_pairs (list[tuple()]): Pairs of keypoints which are mirrored
(for... | Flip human joints in 3D space horizontally. | def _flip_joints_3d(joints_3d, joints_3d_visible, flip_pairs):
"""Flip human joints in 3D space horizontally.
Note:
num_keypoints: K
Args:
joints_3d (np.ndarray([K, 3])): Coordinates of keypoints.
joints_3d_visible (np.ndarray([K, 1])): Visibility of keypoints.
flip_pairs (... | [
"def",
"_flip_joints_3d",
"(",
"joints_3d",
",",
"joints_3d_visible",
",",
"flip_pairs",
")",
":",
"assert",
"len",
"(",
"joints_3d",
")",
"==",
"len",
"(",
"joints_3d_visible",
")",
"joints_3d_flipped",
"=",
"joints_3d",
".",
"copy",
"(",
")",
"joints_3d_visibl... | [
132,
0
] | [
165,
55
] | python | en | ['en', 'en', 'en'] | True |
TrainDataloaderVariations.dataloader | (self, train: bool, *args, **kwargs) | placeholder | placeholder | def dataloader(self, train: bool, *args, **kwargs):
"""placeholder""" | [
"def",
"dataloader",
"(",
"self",
",",
"train",
":",
"bool",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":"
] | [
21,
4
] | [
22,
25
] | python | en | ['en', 'da', 'en'] | False |
TrainDataloaderVariations.train_dataloader__multiple_mapping | (self) | Return a mapping loaders with different lengths | Return a mapping loaders with different lengths | def train_dataloader__multiple_mapping(self):
"""Return a mapping loaders with different lengths"""
return {
'a': self.dataloader(train=True, num_samples=100),
'b': self.dataloader(train=True, num_samples=50),
} | [
"def",
"train_dataloader__multiple_mapping",
"(",
"self",
")",
":",
"return",
"{",
"'a'",
":",
"self",
".",
"dataloader",
"(",
"train",
"=",
"True",
",",
"num_samples",
"=",
"100",
")",
",",
"'b'",
":",
"self",
".",
"dataloader",
"(",
"train",
"=",
"True... | [
39,
4
] | [
44,
9
] | python | en | ['en', 'en', 'en'] | True |
_get_config_directory | () | Find the predefined detector config directory. | Find the predefined detector config directory. | def _get_config_directory():
"""Find the predefined detector config directory."""
try:
# Assume we are running in the source mmdetection repo
repo_dpath = dirname(dirname(__file__))
except NameError:
# For IPython development when this __file__ is not defined
import mmpose
... | [
"def",
"_get_config_directory",
"(",
")",
":",
"try",
":",
"# Assume we are running in the source mmdetection repo",
"repo_dpath",
"=",
"dirname",
"(",
"dirname",
"(",
"__file__",
")",
")",
"except",
"NameError",
":",
"# For IPython development when this __file__ is not defin... | [
6,
0
] | [
18,
23
] | python | en | ['en', 'en', 'en'] | True |
test_config_build_detector | () | Test that all detection models defined in the configs can be
initialized. | Test that all detection models defined in the configs can be
initialized. | def test_config_build_detector():
"""Test that all detection models defined in the configs can be
initialized."""
from mmcv import Config
from mmpose.models import build_posenet
config_dpath = _get_config_directory()
print(f'Found config_dpath = {config_dpath}')
import glob
config_fpat... | [
"def",
"test_config_build_detector",
"(",
")",
":",
"from",
"mmcv",
"import",
"Config",
"from",
"mmpose",
".",
"models",
"import",
"build_posenet",
"config_dpath",
"=",
"_get_config_directory",
"(",
")",
"print",
"(",
"f'Found config_dpath = {config_dpath}'",
")",
"im... | [
21,
0
] | [
51,
59
] | python | en | ['en', 'en', 'en'] | True |
check_condition | (condition, defined_variables) | Checks a single rule condition - the condition will be made up of
variables, values, and the comparison operator. The defined_variables
object must have a variable defined for any variables in this condition.
| Checks a single rule condition - the condition will be made up of
variables, values, and the comparison operator. The defined_variables
object must have a variable defined for any variables in this condition.
| def check_condition(condition, defined_variables):
"""Checks a single rule condition - the condition will be made up of
variables, values, and the comparison operator. The defined_variables
object must have a variable defined for any variables in this condition.
"""
name, op, value = condition['name... | [
"def",
"check_condition",
"(",
"condition",
",",
"defined_variables",
")",
":",
"name",
",",
"op",
",",
"value",
"=",
"condition",
"[",
"'name'",
"]",
",",
"condition",
"[",
"'operator'",
"]",
",",
"condition",
"[",
"'value'",
"]",
"operator_type",
"=",
"_... | [
73,
0
] | [
80,
60
] | python | en | ['en', 'en', 'en'] | True |
_get_variable_value | (defined_variables, name) | Call the function provided on the defined_variables object with the
given name (raise exception if that doesn't exist) and casts it to the
specified type.
Returns an instance of operators.BaseType
| Call the function provided on the defined_variables object with the
given name (raise exception if that doesn't exist) and casts it to the
specified type. | def _get_variable_value(defined_variables, name):
"""Call the function provided on the defined_variables object with the
given name (raise exception if that doesn't exist) and casts it to the
specified type.
Returns an instance of operators.BaseType
"""
def fallback(*args, **kwargs):
r... | [
"def",
"_get_variable_value",
"(",
"defined_variables",
",",
"name",
")",
":",
"def",
"fallback",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"raise",
"AssertionError",
"(",
"\"Variable {0} is not defined in class {1}\"",
".",
"format",
"(",
"name",
","... | [
83,
0
] | [
98,
33
] | python | en | ['en', 'en', 'en'] | True |
_do_operator_comparison | (operator_type, operator_name, comparison_value) | Finds the method on the given operator_type and compares it to the
given comparison_value.
operator_type should be an instance of operators.BaseType
comparison_value is whatever python type to compare to
returns a bool
| Finds the method on the given operator_type and compares it to the
given comparison_value. | def _do_operator_comparison(operator_type, operator_name, comparison_value):
"""Finds the method on the given operator_type and compares it to the
given comparison_value.
operator_type should be an instance of operators.BaseType
comparison_value is whatever python type to compare to
returns a bool
... | [
"def",
"_do_operator_comparison",
"(",
"operator_type",
",",
"operator_name",
",",
"comparison_value",
")",
":",
"def",
"fallback",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"raise",
"AssertionError",
"(",
"\"Operator {0} does not exist for type {1}\"",
"... | [
101,
0
] | [
118,
35
] | python | en | ['en', 'en', 'en'] | True |
channel_shuffle | (x, groups) | Channel Shuffle operation.
This function enables cross-group information flow for multiple groups
convolution layers.
Args:
x (Tensor): The input tensor.
groups (int): The number of groups to divide the input tensor
in the channel dimension.
Returns:
Tensor: The ou... | Channel Shuffle operation. | def channel_shuffle(x, groups):
"""Channel Shuffle operation.
This function enables cross-group information flow for multiple groups
convolution layers.
Args:
x (Tensor): The input tensor.
groups (int): The number of groups to divide the input tensor
in the channel dimensio... | [
"def",
"channel_shuffle",
"(",
"x",
",",
"groups",
")",
":",
"batch_size",
",",
"num_channels",
",",
"height",
",",
"width",
"=",
"x",
".",
"size",
"(",
")",
"assert",
"(",
"num_channels",
"%",
"groups",
"==",
"0",
")",
",",
"(",
"'num_channels should be... | [
3,
0
] | [
27,
12
] | python | en | ['it', 'en', 'en'] | True |
TestFinancial.test_decimal_with_when | (self) | Test that decimals are still supported if the when argument is passed | Test that decimals are still supported if the when argument is passed | def test_decimal_with_when(self):
"""Test that decimals are still supported if the when argument is passed"""
# begin
assert_equal(np.rate(Decimal('10'), Decimal('20'), Decimal('-3500'), Decimal('10000'), Decimal('1')),
np.rate(Decimal('10'), Decimal('20'), Decimal('-3500'),... | [
"def",
"test_decimal_with_when",
"(",
"self",
")",
":",
"# begin",
"assert_equal",
"(",
"np",
".",
"rate",
"(",
"Decimal",
"(",
"'10'",
")",
",",
"Decimal",
"(",
"'20'",
")",
",",
"Decimal",
"(",
"'-3500'",
")",
",",
"Decimal",
"(",
"'10000'",
")",
","... | [
234,
4
] | [
306,
58
] | python | en | ['en', 'en', 'en'] | True |
_disables_array_ufunc | (obj) | True when __array_ufunc__ is set to None. | True when __array_ufunc__ is set to None. | def _disables_array_ufunc(obj):
"""True when __array_ufunc__ is set to None."""
try:
return obj.__array_ufunc__ is None
except AttributeError:
return False | [
"def",
"_disables_array_ufunc",
"(",
"obj",
")",
":",
"try",
":",
"return",
"obj",
".",
"__array_ufunc__",
"is",
"None",
"except",
"AttributeError",
":",
"return",
"False"
] | [
11,
0
] | [
16,
20
] | python | en | ['en', 'en', 'en'] | True |
_binary_method | (ufunc, name) | Implement a forward binary method with a ufunc, e.g., __add__. | Implement a forward binary method with a ufunc, e.g., __add__. | def _binary_method(ufunc, name):
"""Implement a forward binary method with a ufunc, e.g., __add__."""
def func(self, other):
if _disables_array_ufunc(other):
return NotImplemented
return ufunc(self, other)
func.__name__ = '__{}__'.format(name)
return func | [
"def",
"_binary_method",
"(",
"ufunc",
",",
"name",
")",
":",
"def",
"func",
"(",
"self",
",",
"other",
")",
":",
"if",
"_disables_array_ufunc",
"(",
"other",
")",
":",
"return",
"NotImplemented",
"return",
"ufunc",
"(",
"self",
",",
"other",
")",
"func"... | [
19,
0
] | [
26,
15
] | python | en | ['en', 'en', 'en'] | True |
_reflected_binary_method | (ufunc, name) | Implement a reflected binary method with a ufunc, e.g., __radd__. | Implement a reflected binary method with a ufunc, e.g., __radd__. | def _reflected_binary_method(ufunc, name):
"""Implement a reflected binary method with a ufunc, e.g., __radd__."""
def func(self, other):
if _disables_array_ufunc(other):
return NotImplemented
return ufunc(other, self)
func.__name__ = '__r{}__'.format(name)
return func | [
"def",
"_reflected_binary_method",
"(",
"ufunc",
",",
"name",
")",
":",
"def",
"func",
"(",
"self",
",",
"other",
")",
":",
"if",
"_disables_array_ufunc",
"(",
"other",
")",
":",
"return",
"NotImplemented",
"return",
"ufunc",
"(",
"other",
",",
"self",
")"... | [
29,
0
] | [
36,
15
] | python | en | ['en', 'en', 'en'] | True |
_inplace_binary_method | (ufunc, name) | Implement an in-place binary method with a ufunc, e.g., __iadd__. | Implement an in-place binary method with a ufunc, e.g., __iadd__. | def _inplace_binary_method(ufunc, name):
"""Implement an in-place binary method with a ufunc, e.g., __iadd__."""
def func(self, other):
return ufunc(self, other, out=(self,))
func.__name__ = '__i{}__'.format(name)
return func | [
"def",
"_inplace_binary_method",
"(",
"ufunc",
",",
"name",
")",
":",
"def",
"func",
"(",
"self",
",",
"other",
")",
":",
"return",
"ufunc",
"(",
"self",
",",
"other",
",",
"out",
"=",
"(",
"self",
",",
")",
")",
"func",
".",
"__name__",
"=",
"'__i... | [
39,
0
] | [
44,
15
] | python | en | ['en', 'en', 'en'] | True |
_numeric_methods | (ufunc, name) | Implement forward, reflected and inplace binary methods with a ufunc. | Implement forward, reflected and inplace binary methods with a ufunc. | def _numeric_methods(ufunc, name):
"""Implement forward, reflected and inplace binary methods with a ufunc."""
return (_binary_method(ufunc, name),
_reflected_binary_method(ufunc, name),
_inplace_binary_method(ufunc, name)) | [
"def",
"_numeric_methods",
"(",
"ufunc",
",",
"name",
")",
":",
"return",
"(",
"_binary_method",
"(",
"ufunc",
",",
"name",
")",
",",
"_reflected_binary_method",
"(",
"ufunc",
",",
"name",
")",
",",
"_inplace_binary_method",
"(",
"ufunc",
",",
"name",
")",
... | [
47,
0
] | [
51,
48
] | python | en | ['en', 'en', 'en'] | True |
_unary_method | (ufunc, name) | Implement a unary special method with a ufunc. | Implement a unary special method with a ufunc. | def _unary_method(ufunc, name):
"""Implement a unary special method with a ufunc."""
def func(self):
return ufunc(self)
func.__name__ = '__{}__'.format(name)
return func | [
"def",
"_unary_method",
"(",
"ufunc",
",",
"name",
")",
":",
"def",
"func",
"(",
"self",
")",
":",
"return",
"ufunc",
"(",
"self",
")",
"func",
".",
"__name__",
"=",
"'__{}__'",
".",
"format",
"(",
"name",
")",
"return",
"func"
] | [
54,
0
] | [
59,
15
] | python | en | ['en', 'en', 'en'] | True |
find_comma_decimal_point_locale | () | See if platform has a decimal point as comma locale.
Find a locale that uses a comma instead of a period as the
decimal point.
Returns
-------
old_locale: str
Locale when the function was called.
new_locale: {str, None)
First French locale found, None if none found.
| See if platform has a decimal point as comma locale. | def find_comma_decimal_point_locale():
"""See if platform has a decimal point as comma locale.
Find a locale that uses a comma instead of a period as the
decimal point.
Returns
-------
old_locale: str
Locale when the function was called.
new_locale: {str, None)
First French... | [
"def",
"find_comma_decimal_point_locale",
"(",
")",
":",
"if",
"sys",
".",
"platform",
"==",
"'win32'",
":",
"locales",
"=",
"[",
"'FRENCH'",
"]",
"else",
":",
"locales",
"=",
"[",
"'fr_FR'",
",",
"'fr_FR.UTF-8'",
",",
"'fi_FI'",
",",
"'fi_FI.UTF-8'",
"]",
... | [
13,
0
] | [
44,
33
] | python | en | ['en', 'en', 'en'] | True |
CallbackHookNameValidator._on_before_accelerator_backend_setup_log | () | Called before accelerator is being setup | Called before accelerator is being setup | def _on_before_accelerator_backend_setup_log():
"""Called before accelerator is being setup"""
return None | [
"def",
"_on_before_accelerator_backend_setup_log",
"(",
")",
":",
"return",
"None"
] | [
48,
4
] | [
50,
19
] | python | en | ['en', 'en', 'en'] | True |
CallbackHookNameValidator._setup_log | () | Called when fit or test begins | Called when fit or test begins | def _setup_log():
"""Called when fit or test begins"""
return None | [
"def",
"_setup_log",
"(",
")",
":",
"return",
"None"
] | [
53,
4
] | [
55,
19
] | python | en | ['en', 'en', 'en'] | True |
CallbackHookNameValidator._teardown_log | () | Called at the end of fit and test | Called at the end of fit and test | def _teardown_log():
"""Called at the end of fit and test"""
return None | [
"def",
"_teardown_log",
"(",
")",
":",
"return",
"None"
] | [
58,
4
] | [
60,
19
] | python | en | ['en', 'en', 'en'] | True |
CallbackHookNameValidator._on_init_start_log | () | Called when the trainer initialization begins, model has not yet been set. | Called when the trainer initialization begins, model has not yet been set. | def _on_init_start_log():
"""Called when the trainer initialization begins, model has not yet been set."""
return None | [
"def",
"_on_init_start_log",
"(",
")",
":",
"return",
"None"
] | [
63,
4
] | [
65,
19
] | python | en | ['en', 'en', 'en'] | True |
CallbackHookNameValidator._on_init_end_log | () | Called when the trainer initialization ends, model has not yet been set. | Called when the trainer initialization ends, model has not yet been set. | def _on_init_end_log():
"""Called when the trainer initialization ends, model has not yet been set."""
return None | [
"def",
"_on_init_end_log",
"(",
")",
":",
"return",
"None"
] | [
68,
4
] | [
70,
19
] | python | en | ['en', 'en', 'en'] | True |
CallbackHookNameValidator._on_fit_start_log | () | Called when the trainer initialization begins, model has not yet been set. | Called when the trainer initialization begins, model has not yet been set. | def _on_fit_start_log():
"""Called when the trainer initialization begins, model has not yet been set."""
return None | [
"def",
"_on_fit_start_log",
"(",
")",
":",
"return",
"None"
] | [
73,
4
] | [
75,
19
] | python | en | ['en', 'en', 'en'] | True |
CallbackHookNameValidator._on_fit_end_log | () | Called when the trainer initialization begins, model has not yet been set. | Called when the trainer initialization begins, model has not yet been set. | def _on_fit_end_log():
"""Called when the trainer initialization begins, model has not yet been set."""
return None | [
"def",
"_on_fit_end_log",
"(",
")",
":",
"return",
"None"
] | [
78,
4
] | [
80,
19
] | python | en | ['en', 'en', 'en'] | True |
CallbackHookNameValidator._on_sanity_check_start_log | () | Called when the validation sanity check starts. | Called when the validation sanity check starts. | def _on_sanity_check_start_log():
"""Called when the validation sanity check starts."""
return None | [
"def",
"_on_sanity_check_start_log",
"(",
")",
":",
"return",
"None"
] | [
83,
4
] | [
85,
19
] | python | en | ['en', 'en', 'en'] | True |
CallbackHookNameValidator._on_sanity_check_end_log | () | Called when the validation sanity check ends. | Called when the validation sanity check ends. | def _on_sanity_check_end_log():
"""Called when the validation sanity check ends."""
return None | [
"def",
"_on_sanity_check_end_log",
"(",
")",
":",
"return",
"None"
] | [
88,
4
] | [
90,
19
] | python | en | ['en', 'en', 'en'] | True |
CallbackHookNameValidator._on_train_epoch_start_log | () | Called when the epoch begins. | Called when the epoch begins. | def _on_train_epoch_start_log():
"""Called when the epoch begins."""
return {"on_step": [False, True], "on_epoch": [False, True]} | [
"def",
"_on_train_epoch_start_log",
"(",
")",
":",
"return",
"{",
"\"on_step\"",
":",
"[",
"False",
",",
"True",
"]",
",",
"\"on_epoch\"",
":",
"[",
"False",
",",
"True",
"]",
"}"
] | [
93,
4
] | [
95,
68
] | python | en | ['en', 'de', 'en'] | True |
CallbackHookNameValidator._on_train_epoch_end_log | () | Called when the epoch ends. | Called when the epoch ends. | def _on_train_epoch_end_log():
"""Called when the epoch ends."""
return {"on_step": [False], "on_epoch": [False, True]} | [
"def",
"_on_train_epoch_end_log",
"(",
")",
":",
"return",
"{",
"\"on_step\"",
":",
"[",
"False",
"]",
",",
"\"on_epoch\"",
":",
"[",
"False",
",",
"True",
"]",
"}"
] | [
98,
4
] | [
100,
62
] | python | en | ['en', 'en', 'en'] | True |
CallbackHookNameValidator._on_validation_epoch_start_log | () | Called when the epoch begins. | Called when the epoch begins. | def _on_validation_epoch_start_log():
"""Called when the epoch begins."""
return {"on_step": [False, True], "on_epoch": [False, True]} | [
"def",
"_on_validation_epoch_start_log",
"(",
")",
":",
"return",
"{",
"\"on_step\"",
":",
"[",
"False",
",",
"True",
"]",
",",
"\"on_epoch\"",
":",
"[",
"False",
",",
"True",
"]",
"}"
] | [
103,
4
] | [
105,
68
] | python | en | ['en', 'de', 'en'] | True |
CallbackHookNameValidator._on_validation_epoch_end_log | () | Called when the epoch ends. | Called when the epoch ends. | def _on_validation_epoch_end_log():
"""Called when the epoch ends."""
return {"on_step": [False], "on_epoch": [False, True]} | [
"def",
"_on_validation_epoch_end_log",
"(",
")",
":",
"return",
"{",
"\"on_step\"",
":",
"[",
"False",
"]",
",",
"\"on_epoch\"",
":",
"[",
"False",
",",
"True",
"]",
"}"
] | [
108,
4
] | [
110,
62
] | python | en | ['en', 'en', 'en'] | True |
CallbackHookNameValidator._on_test_epoch_start_log | () | Called when the epoch begins. | Called when the epoch begins. | def _on_test_epoch_start_log():
"""Called when the epoch begins."""
return {"on_step": [False, True], "on_epoch": [False, True]} | [
"def",
"_on_test_epoch_start_log",
"(",
")",
":",
"return",
"{",
"\"on_step\"",
":",
"[",
"False",
",",
"True",
"]",
",",
"\"on_epoch\"",
":",
"[",
"False",
",",
"True",
"]",
"}"
] | [
113,
4
] | [
115,
68
] | python | en | ['en', 'de', 'en'] | True |
CallbackHookNameValidator._on_test_epoch_end_log | () | Called when the epoch ends. | Called when the epoch ends. | def _on_test_epoch_end_log():
"""Called when the epoch ends."""
return {"on_step": [False], "on_epoch": [False, True]} | [
"def",
"_on_test_epoch_end_log",
"(",
")",
":",
"return",
"{",
"\"on_step\"",
":",
"[",
"False",
"]",
",",
"\"on_epoch\"",
":",
"[",
"False",
",",
"True",
"]",
"}"
] | [
118,
4
] | [
120,
62
] | python | en | ['en', 'en', 'en'] | True |
CallbackHookNameValidator._on_epoch_start_log | () | Called when the epoch begins. | Called when the epoch begins. | def _on_epoch_start_log():
"""Called when the epoch begins."""
return {"on_step": [False, True], "on_epoch": [False, True]} | [
"def",
"_on_epoch_start_log",
"(",
")",
":",
"return",
"{",
"\"on_step\"",
":",
"[",
"False",
",",
"True",
"]",
",",
"\"on_epoch\"",
":",
"[",
"False",
",",
"True",
"]",
"}"
] | [
123,
4
] | [
125,
68
] | python | en | ['en', 'de', 'en'] | True |
CallbackHookNameValidator._on_epoch_end_log | () | Called when the epoch ends. | Called when the epoch ends. | def _on_epoch_end_log():
"""Called when the epoch ends."""
return {"on_step": [False], "on_epoch": [False, True]} | [
"def",
"_on_epoch_end_log",
"(",
")",
":",
"return",
"{",
"\"on_step\"",
":",
"[",
"False",
"]",
",",
"\"on_epoch\"",
":",
"[",
"False",
",",
"True",
"]",
"}"
] | [
128,
4
] | [
130,
62
] | python | en | ['en', 'en', 'en'] | True |
CallbackHookNameValidator._on_train_start_log | () | Called when the train begins. | Called when the train begins. | def _on_train_start_log():
"""Called when the train begins."""
return {"on_step": [False, True], "on_epoch": [False, True]} | [
"def",
"_on_train_start_log",
"(",
")",
":",
"return",
"{",
"\"on_step\"",
":",
"[",
"False",
",",
"True",
"]",
",",
"\"on_epoch\"",
":",
"[",
"False",
",",
"True",
"]",
"}"
] | [
133,
4
] | [
135,
68
] | python | en | ['en', 'en', 'en'] | True |
CallbackHookNameValidator._on_train_end_log | () | Called when the train ends. | Called when the train ends. | def _on_train_end_log():
"""Called when the train ends."""
return None | [
"def",
"_on_train_end_log",
"(",
")",
":",
"return",
"None"
] | [
138,
4
] | [
140,
19
] | python | en | ['en', 'en', 'en'] | True |
CallbackHookNameValidator._on_pretrain_routine_start_log | () | Called when the train begins. | Called when the train begins. | def _on_pretrain_routine_start_log():
"""Called when the train begins."""
return None | [
"def",
"_on_pretrain_routine_start_log",
"(",
")",
":",
"return",
"None"
] | [
143,
4
] | [
145,
19
] | python | en | ['en', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.