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 |
|---|---|---|---|---|---|---|---|---|---|
fb6173465dbe16ed88857c96387fafdabb6637fcc350ae47125bb136dc4702a3 | def compute_network_pass_size(model):
'Computes the size of a network pass in bytes using cached\n parameters as well as gradients'
num_bytes = 0
print('Adding layer caches for forward pass:')
for layer in model.cache.keys():
key_num_bytes = 0
for value in model.cache[layer]:
... | Computes the size of a network pass in bytes using cached
parameters as well as gradients | exercise_05/exercise_code/networks/compute_network_size.py | compute_network_pass_size | Sihifu/i2dl | 0 | python | def compute_network_pass_size(model):
'Computes the size of a network pass in bytes using cached\n parameters as well as gradients'
num_bytes = 0
print('Adding layer caches for forward pass:')
for layer in model.cache.keys():
key_num_bytes = 0
for value in model.cache[layer]:
... | def compute_network_pass_size(model):
'Computes the size of a network pass in bytes using cached\n parameters as well as gradients'
num_bytes = 0
print('Adding layer caches for forward pass:')
for layer in model.cache.keys():
key_num_bytes = 0
for value in model.cache[layer]:
... |
7424f22f09aeba10cd68a6ecbe1f6de1ea06851e2c06747f767523a39379ef30 | def __init__(self, intermediate_directory='intermediates'):
'\n :param intermediate_directory: Directory, where the\n intermediate pandas dataframe should be persisted\n to.\n '
super(NumpyNullPreprocessor, self).__init__()
self._intermediate_directory = intermediate_dire... | :param intermediate_directory: Directory, where the
intermediate pandas dataframe should be persisted
to. | brewPipe/preprocess/numpy_null.py | __init__ | meyerd/brewPipe | 0 | python | def __init__(self, intermediate_directory='intermediates'):
'\n :param intermediate_directory: Directory, where the\n intermediate pandas dataframe should be persisted\n to.\n '
super(NumpyNullPreprocessor, self).__init__()
self._intermediate_directory = intermediate_dire... | def __init__(self, intermediate_directory='intermediates'):
'\n :param intermediate_directory: Directory, where the\n intermediate pandas dataframe should be persisted\n to.\n '
super(NumpyNullPreprocessor, self).__init__()
self._intermediate_directory = intermediate_dire... |
50e92de0ef9f73bd74a30030912580551c4dd71ffe70dee2598709f6c2b8b715 | def fix_queryselector(elems):
"Workaround for web components breaking querySelector.\n\n Because someone thought it was a good idea to just yeet the moral equivalent\n of iframes everywhere over a single page 🤦\n\n Shadow DOM was a terrible idea and everyone involved should feel professionally\n ashame... | Workaround for web components breaking querySelector.
Because someone thought it was a good idea to just yeet the moral equivalent
of iframes everywhere over a single page 🤦
Shadow DOM was a terrible idea and everyone involved should feel professionally
ashamed of themselves. Every problem it tried to solved could a... | tests/integration/test_charm.py | fix_queryselector | VariableDeclared/kubeflow-dashboard-operator | 0 | python | def fix_queryselector(elems):
"Workaround for web components breaking querySelector.\n\n Because someone thought it was a good idea to just yeet the moral equivalent\n of iframes everywhere over a single page 🤦\n\n Shadow DOM was a terrible idea and everyone involved should feel professionally\n ashame... | def fix_queryselector(elems):
"Workaround for web components breaking querySelector.\n\n Because someone thought it was a good idea to just yeet the moral equivalent\n of iframes everywhere over a single page 🤦\n\n Shadow DOM was a terrible idea and everyone involved should feel professionally\n ashame... |
e93a67e923afe1f55526c988fa95ac28a4f5624f31ed3e52abb9ddb38db92e1e | def __init__(self, audit_reason_id=None, comment=None):
'GetEdocWithAuditReasonRequest - a model defined in Swagger'
self._audit_reason_id = None
self._comment = None
self.discriminator = None
if (audit_reason_id is not None):
self.audit_reason_id = audit_reason_id
if (comment is not Non... | GetEdocWithAuditReasonRequest - a model defined in Swagger | laserfiche_api/models/get_edoc_with_audit_reason_request.py | __init__ | Layer8Err/laserfiche_api | 1 | python | def __init__(self, audit_reason_id=None, comment=None):
self._audit_reason_id = None
self._comment = None
self.discriminator = None
if (audit_reason_id is not None):
self.audit_reason_id = audit_reason_id
if (comment is not None):
self.comment = comment | def __init__(self, audit_reason_id=None, comment=None):
self._audit_reason_id = None
self._comment = None
self.discriminator = None
if (audit_reason_id is not None):
self.audit_reason_id = audit_reason_id
if (comment is not None):
self.comment = comment<|docstring|>GetEdocWithAu... |
296aa5d2830efa69b740ef9966359e342a0f8779b51cf412a6050527c098c9b0 | @property
def audit_reason_id(self):
'Gets the audit_reason_id of this GetEdocWithAuditReasonRequest. # noqa: E501\n\n The reason id for this audit event. # noqa: E501\n\n :return: The audit_reason_id of this GetEdocWithAuditReasonRequest. # noqa: E501\n :rtype: int\n '
return sel... | Gets the audit_reason_id of this GetEdocWithAuditReasonRequest. # noqa: E501
The reason id for this audit event. # noqa: E501
:return: The audit_reason_id of this GetEdocWithAuditReasonRequest. # noqa: E501
:rtype: int | laserfiche_api/models/get_edoc_with_audit_reason_request.py | audit_reason_id | Layer8Err/laserfiche_api | 1 | python | @property
def audit_reason_id(self):
'Gets the audit_reason_id of this GetEdocWithAuditReasonRequest. # noqa: E501\n\n The reason id for this audit event. # noqa: E501\n\n :return: The audit_reason_id of this GetEdocWithAuditReasonRequest. # noqa: E501\n :rtype: int\n '
return sel... | @property
def audit_reason_id(self):
'Gets the audit_reason_id of this GetEdocWithAuditReasonRequest. # noqa: E501\n\n The reason id for this audit event. # noqa: E501\n\n :return: The audit_reason_id of this GetEdocWithAuditReasonRequest. # noqa: E501\n :rtype: int\n '
return sel... |
c0e6f73a8c29b475fb9f152fd7d2db0b9562f54df1e924b8ab267e6d12a8f7b2 | @audit_reason_id.setter
def audit_reason_id(self, audit_reason_id):
'Sets the audit_reason_id of this GetEdocWithAuditReasonRequest.\n\n The reason id for this audit event. # noqa: E501\n\n :param audit_reason_id: The audit_reason_id of this GetEdocWithAuditReasonRequest. # noqa: E501\n :type... | Sets the audit_reason_id of this GetEdocWithAuditReasonRequest.
The reason id for this audit event. # noqa: E501
:param audit_reason_id: The audit_reason_id of this GetEdocWithAuditReasonRequest. # noqa: E501
:type: int | laserfiche_api/models/get_edoc_with_audit_reason_request.py | audit_reason_id | Layer8Err/laserfiche_api | 1 | python | @audit_reason_id.setter
def audit_reason_id(self, audit_reason_id):
'Sets the audit_reason_id of this GetEdocWithAuditReasonRequest.\n\n The reason id for this audit event. # noqa: E501\n\n :param audit_reason_id: The audit_reason_id of this GetEdocWithAuditReasonRequest. # noqa: E501\n :type... | @audit_reason_id.setter
def audit_reason_id(self, audit_reason_id):
'Sets the audit_reason_id of this GetEdocWithAuditReasonRequest.\n\n The reason id for this audit event. # noqa: E501\n\n :param audit_reason_id: The audit_reason_id of this GetEdocWithAuditReasonRequest. # noqa: E501\n :type... |
c93eaf8be37260e8c680a7eef89900148ff12ff0211c134c6068abc5022108e1 | @property
def comment(self):
'Gets the comment of this GetEdocWithAuditReasonRequest. # noqa: E501\n\n The comment for this audit event. # noqa: E501\n\n :return: The comment of this GetEdocWithAuditReasonRequest. # noqa: E501\n :rtype: str\n '
return self._comment | Gets the comment of this GetEdocWithAuditReasonRequest. # noqa: E501
The comment for this audit event. # noqa: E501
:return: The comment of this GetEdocWithAuditReasonRequest. # noqa: E501
:rtype: str | laserfiche_api/models/get_edoc_with_audit_reason_request.py | comment | Layer8Err/laserfiche_api | 1 | python | @property
def comment(self):
'Gets the comment of this GetEdocWithAuditReasonRequest. # noqa: E501\n\n The comment for this audit event. # noqa: E501\n\n :return: The comment of this GetEdocWithAuditReasonRequest. # noqa: E501\n :rtype: str\n '
return self._comment | @property
def comment(self):
'Gets the comment of this GetEdocWithAuditReasonRequest. # noqa: E501\n\n The comment for this audit event. # noqa: E501\n\n :return: The comment of this GetEdocWithAuditReasonRequest. # noqa: E501\n :rtype: str\n '
return self._comment<|docstring|>Get... |
7e61abd25102d2ee68ae1a2d6fcc4f9e5341ef6f4f9a2abce26bf40036d3b6f0 | @comment.setter
def comment(self, comment):
'Sets the comment of this GetEdocWithAuditReasonRequest.\n\n The comment for this audit event. # noqa: E501\n\n :param comment: The comment of this GetEdocWithAuditReasonRequest. # noqa: E501\n :type: str\n '
self._comment = comment | Sets the comment of this GetEdocWithAuditReasonRequest.
The comment for this audit event. # noqa: E501
:param comment: The comment of this GetEdocWithAuditReasonRequest. # noqa: E501
:type: str | laserfiche_api/models/get_edoc_with_audit_reason_request.py | comment | Layer8Err/laserfiche_api | 1 | python | @comment.setter
def comment(self, comment):
'Sets the comment of this GetEdocWithAuditReasonRequest.\n\n The comment for this audit event. # noqa: E501\n\n :param comment: The comment of this GetEdocWithAuditReasonRequest. # noqa: E501\n :type: str\n '
self._comment = comment | @comment.setter
def comment(self, comment):
'Sets the comment of this GetEdocWithAuditReasonRequest.\n\n The comment for this audit event. # noqa: E501\n\n :param comment: The comment of this GetEdocWithAuditReasonRequest. # noqa: E501\n :type: str\n '
self._comment = comment<|docs... |
79d8de7adf9d153041da991026d253b6af9d943dd3b83a4e0bf3d7156619d035 | def to_dict(self):
'Returns the model properties as a dict'
result = {}
for (attr, _) in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
e... | Returns the model properties as a dict | laserfiche_api/models/get_edoc_with_audit_reason_request.py | to_dict | Layer8Err/laserfiche_api | 1 | python | def to_dict(self):
result = {}
for (attr, _) in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
elif hasattr(value, 'to_dict'):
... | def to_dict(self):
result = {}
for (attr, _) in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
elif hasattr(value, 'to_dict'):
... |
cbb19eaa2fc8a113d9e32f924ef280a7e97563f8915f94f65dab438997af2e99 | def to_str(self):
'Returns the string representation of the model'
return pprint.pformat(self.to_dict()) | Returns the string representation of the model | laserfiche_api/models/get_edoc_with_audit_reason_request.py | to_str | Layer8Err/laserfiche_api | 1 | python | def to_str(self):
return pprint.pformat(self.to_dict()) | def to_str(self):
return pprint.pformat(self.to_dict())<|docstring|>Returns the string representation of the model<|endoftext|> |
772243a2c2b3261a9b954d07aaf295e3c1242a579a495e2d6a5679c677861703 | def __repr__(self):
'For `print` and `pprint`'
return self.to_str() | For `print` and `pprint` | laserfiche_api/models/get_edoc_with_audit_reason_request.py | __repr__ | Layer8Err/laserfiche_api | 1 | python | def __repr__(self):
return self.to_str() | def __repr__(self):
return self.to_str()<|docstring|>For `print` and `pprint`<|endoftext|> |
d2789e8921f8d5f33322b814bad6f6781119573d482862c089e132669d798049 | def __eq__(self, other):
'Returns true if both objects are equal'
if (not isinstance(other, GetEdocWithAuditReasonRequest)):
return False
return (self.__dict__ == other.__dict__) | Returns true if both objects are equal | laserfiche_api/models/get_edoc_with_audit_reason_request.py | __eq__ | Layer8Err/laserfiche_api | 1 | python | def __eq__(self, other):
if (not isinstance(other, GetEdocWithAuditReasonRequest)):
return False
return (self.__dict__ == other.__dict__) | def __eq__(self, other):
if (not isinstance(other, GetEdocWithAuditReasonRequest)):
return False
return (self.__dict__ == other.__dict__)<|docstring|>Returns true if both objects are equal<|endoftext|> |
43dc6740163eb9fc1161d09cb2208a64c7ad0cc8d9c8637ac3264522d3ec7e42 | def __ne__(self, other):
'Returns true if both objects are not equal'
return (not (self == other)) | Returns true if both objects are not equal | laserfiche_api/models/get_edoc_with_audit_reason_request.py | __ne__ | Layer8Err/laserfiche_api | 1 | python | def __ne__(self, other):
return (not (self == other)) | def __ne__(self, other):
return (not (self == other))<|docstring|>Returns true if both objects are not equal<|endoftext|> |
c6a8159b49b2c14bf77106850830e466d51330f2c72d5f5740e78c626a8d66e5 | @property
def numpy_dtype(self):
'The NumPy dtype this PandasDtype wraps.'
return self._dtype | The NumPy dtype this PandasDtype wraps. | extern_libs/Python27/lib/python2.7/site-packages/pandas/core/arrays/numpy_.py | numpy_dtype | onceawaken/MKL-DNN_Eigen_Boost_OpenMPI_GoogleTests_Examples | 6,989 | python | @property
def numpy_dtype(self):
return self._dtype | @property
def numpy_dtype(self):
return self._dtype<|docstring|>The NumPy dtype this PandasDtype wraps.<|endoftext|> |
d0551daf5369537e56a9419fbc596457608ccf2143fad7e0f1aae9c70f69a9f7 | @property
def itemsize(self):
'The element size of this data-type object.'
return self._dtype.itemsize | The element size of this data-type object. | extern_libs/Python27/lib/python2.7/site-packages/pandas/core/arrays/numpy_.py | itemsize | onceawaken/MKL-DNN_Eigen_Boost_OpenMPI_GoogleTests_Examples | 6,989 | python | @property
def itemsize(self):
return self._dtype.itemsize | @property
def itemsize(self):
return self._dtype.itemsize<|docstring|>The element size of this data-type object.<|endoftext|> |
94c9100fb267bc8d3e436e2996ceb11dff2409ee53babe8847c56cead83ac75f | def to_numpy(self, dtype=None, copy=False):
'\n Convert the PandasArray to a :class:`numpy.ndarray`.\n\n By default, this requires no coercion or copying of data.\n\n Parameters\n ----------\n dtype : numpy.dtype\n The NumPy dtype to pass to :func:`numpy.asarray`.\n ... | Convert the PandasArray to a :class:`numpy.ndarray`.
By default, this requires no coercion or copying of data.
Parameters
----------
dtype : numpy.dtype
The NumPy dtype to pass to :func:`numpy.asarray`.
copy : bool, default False
Whether to copy the underlying data.
Returns
-------
ndarray | extern_libs/Python27/lib/python2.7/site-packages/pandas/core/arrays/numpy_.py | to_numpy | onceawaken/MKL-DNN_Eigen_Boost_OpenMPI_GoogleTests_Examples | 6,989 | python | def to_numpy(self, dtype=None, copy=False):
'\n Convert the PandasArray to a :class:`numpy.ndarray`.\n\n By default, this requires no coercion or copying of data.\n\n Parameters\n ----------\n dtype : numpy.dtype\n The NumPy dtype to pass to :func:`numpy.asarray`.\n ... | def to_numpy(self, dtype=None, copy=False):
'\n Convert the PandasArray to a :class:`numpy.ndarray`.\n\n By default, this requires no coercion or copying of data.\n\n Parameters\n ----------\n dtype : numpy.dtype\n The NumPy dtype to pass to :func:`numpy.asarray`.\n ... |
f0933f100bb3b8025c0c4ac5276195ef43e3adbbe25e43c7c742f05cfb5e844e | def main():
'主程序入口'
qApp = createQApp()
ee = EventEngine()
me = MainEngine(ee)
me.addGateway(secGateway)
me.addGateway(ctpGateway)
me.addGateway(ctpsecGateway)
me.addApp(riskManager)
me.addApp(optionMaster)
mw = MainWindow(me, ee)
mw.showMaximized()
sys.exit(qApp.exec_()) | 主程序入口 | examples/OptionMaster/run.py | main | ChetWang1993/vnpy | 5 | python | def main():
qApp = createQApp()
ee = EventEngine()
me = MainEngine(ee)
me.addGateway(secGateway)
me.addGateway(ctpGateway)
me.addGateway(ctpsecGateway)
me.addApp(riskManager)
me.addApp(optionMaster)
mw = MainWindow(me, ee)
mw.showMaximized()
sys.exit(qApp.exec_()) | def main():
qApp = createQApp()
ee = EventEngine()
me = MainEngine(ee)
me.addGateway(secGateway)
me.addGateway(ctpGateway)
me.addGateway(ctpsecGateway)
me.addApp(riskManager)
me.addApp(optionMaster)
mw = MainWindow(me, ee)
mw.showMaximized()
sys.exit(qApp.exec_())<|docst... |
6f093eb6df3e55a942982c0fe7df9fa9b460683952e621f66e82cdfed7ca3b04 | def __repr__(self) -> str:
'Non-literal text representation.'
return '<{cls}: {prediction} for pixel ({n_x}|{n_y}) at {start_at}>'.format(cls=self.__class__.__name__, prediction=self.prediction, n_x=self.pixel.n_x, n_y=self.pixel.n_y, start_at=self.start_at) | Non-literal text representation. | src/urban_meal_delivery/db/forecasts.py | __repr__ | webartifex/urban-meal-delivery | 1 | python | def __repr__(self) -> str:
return '<{cls}: {prediction} for pixel ({n_x}|{n_y}) at {start_at}>'.format(cls=self.__class__.__name__, prediction=self.prediction, n_x=self.pixel.n_x, n_y=self.pixel.n_y, start_at=self.start_at) | def __repr__(self) -> str:
return '<{cls}: {prediction} for pixel ({n_x}|{n_y}) at {start_at}>'.format(cls=self.__class__.__name__, prediction=self.prediction, n_x=self.pixel.n_x, n_y=self.pixel.n_y, start_at=self.start_at)<|docstring|>Non-literal text representation.<|endoftext|> |
951d4b7d4d4ccb4db33c7685a3599f42cedb9eb717a1aabacb174ab701cf9c0f | @classmethod
def from_dataframe(cls, pixel: db.Pixel, time_step: int, train_horizon: int, model: str, data: pd.Dataframe) -> List[db.Forecast]:
'Convert results from the forecasting `*Model`s into `Forecast` objects.\n\n This is an alternative constructor method.\n\n Background: The functions in `urba... | Convert results from the forecasting `*Model`s into `Forecast` objects.
This is an alternative constructor method.
Background: The functions in `urban_meal_delivery.forecasts.methods`
return `pd.Dataframe`s with "start_at" (i.e., `pd.Timestamp` objects)
values in the index and five columns "prediction", "low80", "hig... | src/urban_meal_delivery/db/forecasts.py | from_dataframe | webartifex/urban-meal-delivery | 1 | python | @classmethod
def from_dataframe(cls, pixel: db.Pixel, time_step: int, train_horizon: int, model: str, data: pd.Dataframe) -> List[db.Forecast]:
'Convert results from the forecasting `*Model`s into `Forecast` objects.\n\n This is an alternative constructor method.\n\n Background: The functions in `urba... | @classmethod
def from_dataframe(cls, pixel: db.Pixel, time_step: int, train_horizon: int, model: str, data: pd.Dataframe) -> List[db.Forecast]:
'Convert results from the forecasting `*Model`s into `Forecast` objects.\n\n This is an alternative constructor method.\n\n Background: The functions in `urba... |
61018fd11306fa2939e2783bd5b428982893768619022a82bc19bc812295dec1 | def result_noraise(future, flat=True):
'Extracts result from future, never raising an exception.\n\n If `flat` is True -- returns result or exception instance (including\n CancelledError), if `flat` is False -- returns tuple of (`result`,\n `exception` object).\n\n If traceback is needed -- just re-rais... | Extracts result from future, never raising an exception.
If `flat` is True -- returns result or exception instance (including
CancelledError), if `flat` is False -- returns tuple of (`result`,
`exception` object).
If traceback is needed -- just re-raise returned exception. | asyncio_pool/results.py | result_noraise | jtojnar/asyncio-pool | 0 | python | def result_noraise(future, flat=True):
'Extracts result from future, never raising an exception.\n\n If `flat` is True -- returns result or exception instance (including\n CancelledError), if `flat` is False -- returns tuple of (`result`,\n `exception` object).\n\n If traceback is needed -- just re-rais... | def result_noraise(future, flat=True):
'Extracts result from future, never raising an exception.\n\n If `flat` is True -- returns result or exception instance (including\n CancelledError), if `flat` is False -- returns tuple of (`result`,\n `exception` object).\n\n If traceback is needed -- just re-rais... |
30f97c3d1b8643decd6523bec6f8b2e0bfd7e29d9f31fda66ead3e889ef5b96a | def test_not_a_git_repo():
" Run 'git up' being not on a git repo "
os.chdir(repo_path)
from PyGitUp.gitup import GitUp
with pytest.raises(GitError):
GitUp(testing=True) | Run 'git up' being not on a git repo | PyGitUp/tests/test_not_on_a_git_repo.py | test_not_a_git_repo | hugovk/PyGitUp | 431 | python | def test_not_a_git_repo():
" "
os.chdir(repo_path)
from PyGitUp.gitup import GitUp
with pytest.raises(GitError):
GitUp(testing=True) | def test_not_a_git_repo():
" "
os.chdir(repo_path)
from PyGitUp.gitup import GitUp
with pytest.raises(GitError):
GitUp(testing=True)<|docstring|>Run 'git up' being not on a git repo<|endoftext|> |
9ded6f9d9591505e951055063978d790bf0e11819aae08fec30420713c1fc42a | def create(self, request):
' First check that the an authorized user posted the request. Then validate the API request body. Next convert\n the request body into a format suitable for the database. Finally, store the new OLTPBench test result in the\n database. '
user = BasicAuthentication().authe... | First check that the an authorized user posted the request. Then validate the API request body. Next convert
the request body into a format suitable for the database. Finally, store the new OLTPBench test result in the
database. | performance-storage-service/pss_project/api/views/oltpbench.py | create | cmu-db/noisepage-stats | 23 | python | def create(self, request):
' First check that the an authorized user posted the request. Then validate the API request body. Next convert\n the request body into a format suitable for the database. Finally, store the new OLTPBench test result in the\n database. '
user = BasicAuthentication().authe... | def create(self, request):
' First check that the an authorized user posted the request. Then validate the API request body. Next convert\n the request body into a format suitable for the database. Finally, store the new OLTPBench test result in the\n database. '
user = BasicAuthentication().authe... |
4e28ba1d336dc8971982d969e2fb3a5d4b4fd259478047127b03de0fe9604303 | def mish(x):
'Mish: A Self Regularized Non-Monotonic Neural Activation Function (https://arxiv.org/abs/1908.08681)'
return (x * nn.Tanh()(f.softplus(x))) | Mish: A Self Regularized Non-Monotonic Neural Activation Function (https://arxiv.org/abs/1908.08681) | models/wideresnet.py | mish | WangChen0902/FixMatch-Paddle | 0 | python | def mish(x):
return (x * nn.Tanh()(f.softplus(x))) | def mish(x):
return (x * nn.Tanh()(f.softplus(x)))<|docstring|>Mish: A Self Regularized Non-Monotonic Neural Activation Function (https://arxiv.org/abs/1908.08681)<|endoftext|> |
60b6c7187a373b529a9c59d6d2b57dccc02aa13ed6b70f14bca3af7206e2830a | def chebyshev_nodes(n: int) -> numpy.ndarray:
'Generate N Chebyshev nodes in the range [-1,1].'
d = (math.pi * 0.5)
return numpy.sin(numpy.linspace((- d), d, ((2 * n) + 1))[1::2]) | Generate N Chebyshev nodes in the range [-1,1]. | math/coeffs/calc.py | chebyshev_nodes | depp/ultrafxr | 9 | python | def chebyshev_nodes(n: int) -> numpy.ndarray:
d = (math.pi * 0.5)
return numpy.sin(numpy.linspace((- d), d, ((2 * n) + 1))[1::2]) | def chebyshev_nodes(n: int) -> numpy.ndarray:
d = (math.pi * 0.5)
return numpy.sin(numpy.linspace((- d), d, ((2 * n) + 1))[1::2])<|docstring|>Generate N Chebyshev nodes in the range [-1,1].<|endoftext|> |
347dcf97c1fc90ed7b66db4b8b328cdb6989c5df028d64dcc34a708d371b16c2 | def rescale(x, xrange):
'Rescale the x array so it covers xrange exactly.'
(x0, x1) = xrange
xmin = numpy.min(x)
xmax = numpy.max(x)
xspan = (xmax - xmin)
return (((x - xmin) * (x1 / xspan)) + ((xmax - x) * (x0 / xspan))) | Rescale the x array so it covers xrange exactly. | math/coeffs/calc.py | rescale | depp/ultrafxr | 9 | python | def rescale(x, xrange):
(x0, x1) = xrange
xmin = numpy.min(x)
xmax = numpy.max(x)
xspan = (xmax - xmin)
return (((x - xmin) * (x1 / xspan)) + ((xmax - x) * (x0 / xspan))) | def rescale(x, xrange):
(x0, x1) = xrange
xmin = numpy.min(x)
xmax = numpy.max(x)
xspan = (xmax - xmin)
return (((x - xmin) * (x1 / xspan)) + ((xmax - x) * (x0 / xspan)))<|docstring|>Rescale the x array so it covers xrange exactly.<|endoftext|> |
65af6aa0907c7711ca2f2a221f539a4051a7c3efc08fc30fca3e79bd8e978d77 | @function(name='exp2', min_order=2)
def exp2_coeffs(order: int) -> numpy.ndarray:
'Coefficients for 2^x on (-0.5, 0.5).\n \n Coefficients are chosen to minimize maximum equivalent input error.\n '
xrange = ((- 0.5), 0.5)
(x0, x1) = xrange
signs = numpy.zeros(((order + 2),))
signs[0::2] = 1
... | Coefficients for 2^x on (-0.5, 0.5).
Coefficients are chosen to minimize maximum equivalent input error. | math/coeffs/calc.py | exp2_coeffs | depp/ultrafxr | 9 | python | @function(name='exp2', min_order=2)
def exp2_coeffs(order: int) -> numpy.ndarray:
'Coefficients for 2^x on (-0.5, 0.5).\n \n Coefficients are chosen to minimize maximum equivalent input error.\n '
xrange = ((- 0.5), 0.5)
(x0, x1) = xrange
signs = numpy.zeros(((order + 2),))
signs[0::2] = 1
... | @function(name='exp2', min_order=2)
def exp2_coeffs(order: int) -> numpy.ndarray:
'Coefficients for 2^x on (-0.5, 0.5).\n \n Coefficients are chosen to minimize maximum equivalent input error.\n '
xrange = ((- 0.5), 0.5)
(x0, x1) = xrange
signs = numpy.zeros(((order + 2),))
signs[0::2] = 1
... |
a1be48fb0a8535bf06ebd9002e48da431328d1fd1f18f2c2e30e8d87c3a8a3e6 | @function(name='sin1_smooth', min_order=1)
def sin1_smooth_coeffs(order: int) -> numpy.ndarray:
'Coefficients for sin(2 pi x) on (-0.25, 0.25).\n\n Coefficients are chosen to make higher order derivatives smooth. Only\n odd-numbered coefficients are included.\n '
mat_coeffs = numpy.zeros((order, order)... | Coefficients for sin(2 pi x) on (-0.25, 0.25).
Coefficients are chosen to make higher order derivatives smooth. Only
odd-numbered coefficients are included. | math/coeffs/calc.py | sin1_smooth_coeffs | depp/ultrafxr | 9 | python | @function(name='sin1_smooth', min_order=1)
def sin1_smooth_coeffs(order: int) -> numpy.ndarray:
'Coefficients for sin(2 pi x) on (-0.25, 0.25).\n\n Coefficients are chosen to make higher order derivatives smooth. Only\n odd-numbered coefficients are included.\n '
mat_coeffs = numpy.zeros((order, order)... | @function(name='sin1_smooth', min_order=1)
def sin1_smooth_coeffs(order: int) -> numpy.ndarray:
'Coefficients for sin(2 pi x) on (-0.25, 0.25).\n\n Coefficients are chosen to make higher order derivatives smooth. Only\n odd-numbered coefficients are included.\n '
mat_coeffs = numpy.zeros((order, order)... |
bdf777076cf6cb1d872a0c9b550c28da870018df7a5748cc4eb83882f6691320 | @function(name='sin1_l1', min_order=2)
def sin1_l1_coeffs(order: int) -> numpy.ndarray:
'Coefficients for sin(2 pi x) on (0, 0.25).\n\n Constant coefficient is chosen to be zero, and omitted from result. Maximum\n error is minimized.\n '
signs = numpy.zeros(((order + 2),))
signs[0::2] = 1
signs... | Coefficients for sin(2 pi x) on (0, 0.25).
Constant coefficient is chosen to be zero, and omitted from result. Maximum
error is minimized. | math/coeffs/calc.py | sin1_l1_coeffs | depp/ultrafxr | 9 | python | @function(name='sin1_l1', min_order=2)
def sin1_l1_coeffs(order: int) -> numpy.ndarray:
'Coefficients for sin(2 pi x) on (0, 0.25).\n\n Constant coefficient is chosen to be zero, and omitted from result. Maximum\n error is minimized.\n '
signs = numpy.zeros(((order + 2),))
signs[0::2] = 1
signs... | @function(name='sin1_l1', min_order=2)
def sin1_l1_coeffs(order: int) -> numpy.ndarray:
'Coefficients for sin(2 pi x) on (0, 0.25).\n\n Constant coefficient is chosen to be zero, and omitted from result. Maximum\n error is minimized.\n '
signs = numpy.zeros(((order + 2),))
signs[0::2] = 1
signs... |
02df1f1bdccf046719f93f77e35f08b2d530f97bfcd0f702696616a67ea867d3 | def create_cell_conv(input_nodes):
'Create a cell with convolution.\n\n Args:\n input_nodes (list(Node)): a list of input_nodes for this cell.\n\n Returns:\n Cell: the corresponding cell.\n '
cell = Cell(input_nodes)
n1 = ConstantNode(op=Conv1D(filter_size=20, num_filters=128), name='... | Create a cell with convolution.
Args:
input_nodes (list(Node)): a list of input_nodes for this cell.
Returns:
Cell: the corresponding cell. | nas4candle/candle/NT3/models/candle_conv_mlp_baseline.py | create_cell_conv | scrlnas2019/nas4candle | 1 | python | def create_cell_conv(input_nodes):
'Create a cell with convolution.\n\n Args:\n input_nodes (list(Node)): a list of input_nodes for this cell.\n\n Returns:\n Cell: the corresponding cell.\n '
cell = Cell(input_nodes)
n1 = ConstantNode(op=Conv1D(filter_size=20, num_filters=128), name='... | def create_cell_conv(input_nodes):
'Create a cell with convolution.\n\n Args:\n input_nodes (list(Node)): a list of input_nodes for this cell.\n\n Returns:\n Cell: the corresponding cell.\n '
cell = Cell(input_nodes)
n1 = ConstantNode(op=Conv1D(filter_size=20, num_filters=128), name='... |
e83ea4323e567578e9e0260b129c51e336d21ee74bba8b5586eaca0a75fcc9e2 | def _no_grad_trunc_normal_(tensor: Tensor, mean: float, std: float, a: float, b: float) -> Tensor:
"Cut & paste from PyTorch official master until it's in a few official\n releases - RW Method based on https://people.sc.fsu.edu/~jburkardt/presentations/truncated_normal.pdf\n \n Args:\n tensor (Tenso... | Cut & paste from PyTorch official master until it's in a few official
releases - RW Method based on https://people.sc.fsu.edu/~jburkardt/presentations/truncated_normal.pdf
Args:
tensor (Tensor):
An n-dimensional `Tensor`.
mean (float):
Mean of the normal distribution.
std (float):
S... | src/onevision/nn/layer/weight_init.py | _no_grad_trunc_normal_ | phlong3105/onevision | 2 | python | def _no_grad_trunc_normal_(tensor: Tensor, mean: float, std: float, a: float, b: float) -> Tensor:
"Cut & paste from PyTorch official master until it's in a few official\n releases - RW Method based on https://people.sc.fsu.edu/~jburkardt/presentations/truncated_normal.pdf\n \n Args:\n tensor (Tenso... | def _no_grad_trunc_normal_(tensor: Tensor, mean: float, std: float, a: float, b: float) -> Tensor:
"Cut & paste from PyTorch official master until it's in a few official\n releases - RW Method based on https://people.sc.fsu.edu/~jburkardt/presentations/truncated_normal.pdf\n \n Args:\n tensor (Tenso... |
46c7f578fa7c55e6c0222385949952829ceaca1d1f8426434e6a48ba53864361 | def trunc_normal_(tensor: Tensor, mean: float=0.0, std: float=1.0, a: float=(- 2.0), b: float=2.0) -> Tensor:
'Fills the input Tensor with values drawn from a truncated normal\n distribution. Fvalues are effectively drawn from the normal\n distribution :math:`\\mathcal{N}(\\text{mean}, \\text{std}^2)` with va... | Fills the input Tensor with values drawn from a truncated normal
distribution. Fvalues are effectively drawn from the normal
distribution :math:`\mathcal{N}(\text{mean}, \text{std}^2)` with values
outside :math:`[a, b]` redrawn until they are within the bounds. Fmethod
used for generating the random values works best w... | src/onevision/nn/layer/weight_init.py | trunc_normal_ | phlong3105/onevision | 2 | python | def trunc_normal_(tensor: Tensor, mean: float=0.0, std: float=1.0, a: float=(- 2.0), b: float=2.0) -> Tensor:
'Fills the input Tensor with values drawn from a truncated normal\n distribution. Fvalues are effectively drawn from the normal\n distribution :math:`\\mathcal{N}(\\text{mean}, \\text{std}^2)` with va... | def trunc_normal_(tensor: Tensor, mean: float=0.0, std: float=1.0, a: float=(- 2.0), b: float=2.0) -> Tensor:
'Fills the input Tensor with values drawn from a truncated normal\n distribution. Fvalues are effectively drawn from the normal\n distribution :math:`\\mathcal{N}(\\text{mean}, \\text{std}^2)` with va... |
434e3b1e530d2378e3036b7b7debcda1013934ed2d6febe4a9a3232961cc852e | def before_validate(self):
'\n Sets the number of inputs in `self.dls`\n '
x = self.dl.one_batch()
self.learn.dls.n_inp = len(x) | Sets the number of inputs in `self.dls` | adaptnlp/callback.py | before_validate | mfredriksz/adaptnlp | 410 | python | def before_validate(self):
'\n \n '
x = self.dl.one_batch()
self.learn.dls.n_inp = len(x) | def before_validate(self):
'\n \n '
x = self.dl.one_batch()
self.learn.dls.n_inp = len(x)<|docstring|>Sets the number of inputs in `self.dls`<|endoftext|> |
2f354f98fda9becd33fe1887327adabe675161c47685227c2593d78d90eb8416 | def before_batch(self):
'\n Turns `self.xb` from a tuple to a dictionary of either\n `{"input_ids", "attention_masks", "token_type_ids"}`d\n or\n `{"input_ids", "attention_masks"}`\n '
inputs = {'input_ids': self.learn.xb[0], 'attention_mask': self.learn.xb[1]}
if ... | Turns `self.xb` from a tuple to a dictionary of either
`{"input_ids", "attention_masks", "token_type_ids"}`d
or
`{"input_ids", "attention_masks"}` | adaptnlp/callback.py | before_batch | mfredriksz/adaptnlp | 410 | python | def before_batch(self):
'\n Turns `self.xb` from a tuple to a dictionary of either\n `{"input_ids", "attention_masks", "token_type_ids"}`d\n or\n `{"input_ids", "attention_masks"}`\n '
inputs = {'input_ids': self.learn.xb[0], 'attention_mask': self.learn.xb[1]}
if ... | def before_batch(self):
'\n Turns `self.xb` from a tuple to a dictionary of either\n `{"input_ids", "attention_masks", "token_type_ids"}`d\n or\n `{"input_ids", "attention_masks"}`\n '
inputs = {'input_ids': self.learn.xb[0], 'attention_mask': self.learn.xb[1]}
if ... |
19b098f1e04b7e62e4e460dd3a4a9021bb93b3c282490a2bd3c74aa5cf2ed894 | def before_batch(self):
'\n Set `self.learn.xb` to `self.learn.inputs.values()`\n '
if (not self.as_dict):
self.learn.xb = list(self.learn.inputs.values())
else:
self.learn.xb = self.learn.inputs | Set `self.learn.xb` to `self.learn.inputs.values()` | adaptnlp/callback.py | before_batch | mfredriksz/adaptnlp | 410 | python | def before_batch(self):
'\n \n '
if (not self.as_dict):
self.learn.xb = list(self.learn.inputs.values())
else:
self.learn.xb = self.learn.inputs | def before_batch(self):
'\n \n '
if (not self.as_dict):
self.learn.xb = list(self.learn.inputs.values())
else:
self.learn.xb = self.learn.inputs<|docstring|>Set `self.learn.xb` to `self.learn.inputs.values()`<|endoftext|> |
5391f37a50220c97e66b55b1f155e6750d5d1036e80133d89dc6e0a79e3858fe | def before_batch(self):
'\n Run model-specific inference\n '
pred = self.learn.model.generate(input_ids=self.xb['input_ids'], attention_mask=self.xb['attention_mask'], num_beams=self.num_beams, min_length=self.min_length, max_length=self.max_length, early_stopping=self.early_stopping, **self.kwarg... | Run model-specific inference | adaptnlp/callback.py | before_batch | mfredriksz/adaptnlp | 410 | python | def before_batch(self):
'\n \n '
pred = self.learn.model.generate(input_ids=self.xb['input_ids'], attention_mask=self.xb['attention_mask'], num_beams=self.num_beams, min_length=self.min_length, max_length=self.max_length, early_stopping=self.early_stopping, **self.kwargs)
self.learn.pred = pre... | def before_batch(self):
'\n \n '
pred = self.learn.model.generate(input_ids=self.xb['input_ids'], attention_mask=self.xb['attention_mask'], num_beams=self.num_beams, min_length=self.min_length, max_length=self.max_length, early_stopping=self.early_stopping, **self.kwargs)
self.learn.pred = pre... |
ed623fda61d27f87be29b5690aabbedf0699ca8fdd52077fdfb6038b0d7defcf | def bar_compare(run_path, test_path):
'\n compare if two csv files are same\n only compare H/C/L/O but drop the first column\n '
run_data = pd.read_csv(run_path)
test_data = pd.read_csv(test_path)
run_subset = run_data[['close', 'high', 'open', 'low']]
test_subset = test_data[['C', 'H', 'O'... | compare if two csv files are same
only compare H/C/L/O but drop the first column | tests/preprocess/bar_test.py | bar_compare | crazywiden/fmlpy | 3 | python | def bar_compare(run_path, test_path):
'\n compare if two csv files are same\n only compare H/C/L/O but drop the first column\n '
run_data = pd.read_csv(run_path)
test_data = pd.read_csv(test_path)
run_subset = run_data[['close', 'high', 'open', 'low']]
test_subset = test_data[['C', 'H', 'O'... | def bar_compare(run_path, test_path):
'\n compare if two csv files are same\n only compare H/C/L/O but drop the first column\n '
run_data = pd.read_csv(run_path)
test_data = pd.read_csv(test_path)
run_subset = run_data[['close', 'high', 'open', 'low']]
test_subset = test_data[['C', 'H', 'O'... |
1951359a6a72d295f920e8779fcdc94414365ec2019a417cf80358b2a96791c2 | def __init__(self, map, lap=0, flagLMPC=0):
'Initialization\n map: map\n lap: number of laps to run. If set to 0 then the simulation is completed when ClosedLoopData is full\n flagLMPC: set to 0 for standart controller. Set to 1 for LMPC --> at iteration j add data to SS^{j-1} (look line 9999)\... | Initialization
map: map
lap: number of laps to run. If set to 0 then the simulation is completed when ClosedLoopData is full
flagLMPC: set to 0 for standart controller. Set to 1 for LMPC --> at iteration j add data to SS^{j-1} (look line 9999) | src/fnc/SysModel.py | __init__ | SSubhnil/RacingLMPC | 1 | python | def __init__(self, map, lap=0, flagLMPC=0):
'Initialization\n map: map\n lap: number of laps to run. If set to 0 then the simulation is completed when ClosedLoopData is full\n flagLMPC: set to 0 for standart controller. Set to 1 for LMPC --> at iteration j add data to SS^{j-1} (look line 9999)\... | def __init__(self, map, lap=0, flagLMPC=0):
'Initialization\n map: map\n lap: number of laps to run. If set to 0 then the simulation is completed when ClosedLoopData is full\n flagLMPC: set to 0 for standart controller. Set to 1 for LMPC --> at iteration j add data to SS^{j-1} (look line 9999)\... |
c61e7f799a05810b945fae35de3c3d60450d45f189ae553ba9e4166d217846b6 | def Sim(self, ClosedLoopData, Controller, LMPCprediction=0):
'Simulate closed-loop system\n ClosedLoopData: object where the closed-loop data are written\n Controller: controller used in the closed-loop\n LMPCprediction: object where the open-loop predictions and safe set are stored\n '
... | Simulate closed-loop system
ClosedLoopData: object where the closed-loop data are written
Controller: controller used in the closed-loop
LMPCprediction: object where the open-loop predictions and safe set are stored | src/fnc/SysModel.py | Sim | SSubhnil/RacingLMPC | 1 | python | def Sim(self, ClosedLoopData, Controller, LMPCprediction=0):
'Simulate closed-loop system\n ClosedLoopData: object where the closed-loop data are written\n Controller: controller used in the closed-loop\n LMPCprediction: object where the open-loop predictions and safe set are stored\n '
... | def Sim(self, ClosedLoopData, Controller, LMPCprediction=0):
'Simulate closed-loop system\n ClosedLoopData: object where the closed-loop data are written\n Controller: controller used in the closed-loop\n LMPCprediction: object where the open-loop predictions and safe set are stored\n '
... |
aca8fdcbe989f6a3bdee8d8e1e9ac7b0ba68c656627e6b7bd0e031d51521273a | def __init__(self, vt):
'Initialization\n Arguments:\n vt: target velocity\n '
self.vt = vt
self.uPred = np.zeros([1, 2])
startTimer = datetime.datetime.now()
endTimer = datetime.datetime.now()
deltaTimer = (endTimer - startTimer)
self.solverTime = deltaTimer
sel... | Initialization
Arguments:
vt: target velocity | src/fnc/SysModel.py | __init__ | SSubhnil/RacingLMPC | 1 | python | def __init__(self, vt):
'Initialization\n Arguments:\n vt: target velocity\n '
self.vt = vt
self.uPred = np.zeros([1, 2])
startTimer = datetime.datetime.now()
endTimer = datetime.datetime.now()
deltaTimer = (endTimer - startTimer)
self.solverTime = deltaTimer
sel... | def __init__(self, vt):
'Initialization\n Arguments:\n vt: target velocity\n '
self.vt = vt
self.uPred = np.zeros([1, 2])
startTimer = datetime.datetime.now()
endTimer = datetime.datetime.now()
deltaTimer = (endTimer - startTimer)
self.solverTime = deltaTimer
sel... |
5c2ac1af12a53aeadb8be629a1aea43c41e1259a2b6f6925bcff428a2964a115 | def solve(self, x0):
'Computes control action\n Arguments:\n x0: current state position\n '
vt = self.vt
self.uPred[(0, 0)] = ((((- 0.6) * x0[5]) - (0.9 * x0[3])) + np.max([(- 0.9), np.min([(np.random.randn() * 0.25), 0.9])]))
self.uPred[(0, 1)] = ((1.5 * (vt - x0[0])) + np.max(... | Computes control action
Arguments:
x0: current state position | src/fnc/SysModel.py | solve | SSubhnil/RacingLMPC | 1 | python | def solve(self, x0):
'Computes control action\n Arguments:\n x0: current state position\n '
vt = self.vt
self.uPred[(0, 0)] = ((((- 0.6) * x0[5]) - (0.9 * x0[3])) + np.max([(- 0.9), np.min([(np.random.randn() * 0.25), 0.9])]))
self.uPred[(0, 1)] = ((1.5 * (vt - x0[0])) + np.max(... | def solve(self, x0):
'Computes control action\n Arguments:\n x0: current state position\n '
vt = self.vt
self.uPred[(0, 0)] = ((((- 0.6) * x0[5]) - (0.9 * x0[3])) + np.max([(- 0.9), np.min([(np.random.randn() * 0.25), 0.9])]))
self.uPred[(0, 1)] = ((1.5 * (vt - x0[0])) + np.max(... |
e901a6f091c900d093981502c64bfb73f746d85600e33d719dfc39a56355ab4e | def plot_connectivity(mtx, filename=None):
'\n Create a connectivity matrix plot.\n\n If mtx has 3 dimensions, average first along the last axis.\n\n Parameters\n ----------\n mtx : numpy.ndarray\n A (square) array with connectivity information inside.\n filename : None, str, or os.PathLike... | Create a connectivity matrix plot.
If mtx has 3 dimensions, average first along the last axis.
Parameters
----------
mtx : numpy.ndarray
A (square) array with connectivity information inside.
filename : None, str, or os.PathLike, optional
The path to save the plot on disk.
Returns
-------
0
If there are ... | nigsp/viz.py | plot_connectivity | smoia/nigsp | 2 | python | def plot_connectivity(mtx, filename=None):
'\n Create a connectivity matrix plot.\n\n If mtx has 3 dimensions, average first along the last axis.\n\n Parameters\n ----------\n mtx : numpy.ndarray\n A (square) array with connectivity information inside.\n filename : None, str, or os.PathLike... | def plot_connectivity(mtx, filename=None):
'\n Create a connectivity matrix plot.\n\n If mtx has 3 dimensions, average first along the last axis.\n\n Parameters\n ----------\n mtx : numpy.ndarray\n A (square) array with connectivity information inside.\n filename : None, str, or os.PathLike... |
b73879a3b0446cfa81a0976df48cb6a8d37abf0a60582cf1d5b2c5c989165c74 | def plot_grayplot(timeseries, filename=None):
'\n Create a grayplot (a.k.a. carpet plot a.k.a. timeseries plot).\n\n If timeseries has 3 dimensions, average first along the last axis.\n\n Parameters\n ----------\n timeseries : numpy.ndarray\n An array representing a timeseries. Time has to be ... | Create a grayplot (a.k.a. carpet plot a.k.a. timeseries plot).
If timeseries has 3 dimensions, average first along the last axis.
Parameters
----------
timeseries : numpy.ndarray
An array representing a timeseries. Time has to be encoded in the
second dimension.
filename : None, str, or os.PathLike, optional
... | nigsp/viz.py | plot_grayplot | smoia/nigsp | 2 | python | def plot_grayplot(timeseries, filename=None):
'\n Create a grayplot (a.k.a. carpet plot a.k.a. timeseries plot).\n\n If timeseries has 3 dimensions, average first along the last axis.\n\n Parameters\n ----------\n timeseries : numpy.ndarray\n An array representing a timeseries. Time has to be ... | def plot_grayplot(timeseries, filename=None):
'\n Create a grayplot (a.k.a. carpet plot a.k.a. timeseries plot).\n\n If timeseries has 3 dimensions, average first along the last axis.\n\n Parameters\n ----------\n timeseries : numpy.ndarray\n An array representing a timeseries. Time has to be ... |
f5394db6b412012d248b2c797cd2dab9fc1924564b326e2c1ec16ab6a1e8c192 | def plot_nodes(ns, atlas, filename=None):
"\n Create a marker plot in the MNI space.\n\n If ns has 2 dimensions, average first along last dimension.\n\n Parameters\n ----------\n ns : numpy.ndarray\n A 1- or 2- D array that contains the value of the nodes.\n atlas : str, os.PathLike, 3D Nif... | Create a marker plot in the MNI space.
If ns has 2 dimensions, average first along last dimension.
Parameters
----------
ns : numpy.ndarray
A 1- or 2- D array that contains the value of the nodes.
atlas : str, os.PathLike, 3D Nifti1Image, or numpy.ndarray
The 3d nifti image of an atlas, a string or path to it... | nigsp/viz.py | plot_nodes | smoia/nigsp | 2 | python | def plot_nodes(ns, atlas, filename=None):
"\n Create a marker plot in the MNI space.\n\n If ns has 2 dimensions, average first along last dimension.\n\n Parameters\n ----------\n ns : numpy.ndarray\n A 1- or 2- D array that contains the value of the nodes.\n atlas : str, os.PathLike, 3D Nif... | def plot_nodes(ns, atlas, filename=None):
"\n Create a marker plot in the MNI space.\n\n If ns has 2 dimensions, average first along last dimension.\n\n Parameters\n ----------\n ns : numpy.ndarray\n A 1- or 2- D array that contains the value of the nodes.\n atlas : str, os.PathLike, 3D Nif... |
bf40e620c65a0c9d0fe8bc2cff4ac8bede41357edbc4aab263aaf95b3ba6e14b | def test_quittung_create(self):
'Test case for quittung_create\n\n Create a receipt for an energy delivery (only valid in Germany). # noqa: E501\n '
pass | Test case for quittung_create
Create a receipt for an energy delivery (only valid in Germany). # noqa: E501 | out/python/test/test_strom_quittung_api.py | test_quittung_create | energychain/corrently-api | 0 | python | def test_quittung_create(self):
'Test case for quittung_create\n\n Create a receipt for an energy delivery (only valid in Germany). # noqa: E501\n '
pass | def test_quittung_create(self):
'Test case for quittung_create\n\n Create a receipt for an energy delivery (only valid in Germany). # noqa: E501\n '
pass<|docstring|>Test case for quittung_create
Create a receipt for an energy delivery (only valid in Germany). # noqa: E501<|endoftext|> |
443f0d39317b339aa83507f655a7cd27830e8c07a8bfb0446e4427c98f9c8fbe | def rx_pi(self, theta, q):
'Apply Rx to q.'
return self.append(CX_PIGate(theta), [q], []) | Apply Rx to q. | qiskit/extensions/standard/rx_pi.py | rx_pi | shaimach/qiskit-terra-osq | 0 | python | def rx_pi(self, theta, q):
return self.append(CX_PIGate(theta), [q], []) | def rx_pi(self, theta, q):
return self.append(CX_PIGate(theta), [q], [])<|docstring|>Apply Rx to q.<|endoftext|> |
760f218466d6b117fc24c4f836309b1be8f046618a9e59a7593a29e623d934c8 | def __init__(self, theta):
'Create new rx single qubit gate.'
if ((theta % 1) != 0):
raise QiskitError('the desired angle is not supported by the gate ')
super().__init__('rx_pi/2', 1, [theta]) | Create new rx single qubit gate. | qiskit/extensions/standard/rx_pi.py | __init__ | shaimach/qiskit-terra-osq | 0 | python | def __init__(self, theta):
if ((theta % 1) != 0):
raise QiskitError('the desired angle is not supported by the gate ')
super().__init__('rx_pi/2', 1, [theta]) | def __init__(self, theta):
if ((theta % 1) != 0):
raise QiskitError('the desired angle is not supported by the gate ')
super().__init__('rx_pi/2', 1, [theta])<|docstring|>Create new rx single qubit gate.<|endoftext|> |
760a1fd6e40c489c07889d51c03562b438d7173e6661fe9d95137306ec2148f4 | def _define(self):
'\n gate rx(theta) a {u3(theta, -pi/2, pi/2) a;}\n '
definition = []
q = QuantumRegister(1, 'q')
rule = [(U3Gate(((self.params[0] * pi) / 2), ((- pi) / 2), (pi / 2)), [q[0]], [])]
for inst in rule:
definition.append(inst)
self.definition = definition | gate rx(theta) a {u3(theta, -pi/2, pi/2) a;} | qiskit/extensions/standard/rx_pi.py | _define | shaimach/qiskit-terra-osq | 0 | python | def _define(self):
'\n \n '
definition = []
q = QuantumRegister(1, 'q')
rule = [(U3Gate(((self.params[0] * pi) / 2), ((- pi) / 2), (pi / 2)), [q[0]], [])]
for inst in rule:
definition.append(inst)
self.definition = definition | def _define(self):
'\n \n '
definition = []
q = QuantumRegister(1, 'q')
rule = [(U3Gate(((self.params[0] * pi) / 2), ((- pi) / 2), (pi / 2)), [q[0]], [])]
for inst in rule:
definition.append(inst)
self.definition = definition<|docstring|>gate rx(theta) a {u3(theta, -pi/2, p... |
0a19e909d02b8b355a19dcc73ab1bd4569fa7f7389ef67f15ac70640feb63e76 | def inverse(self):
'Invert this gate.\n\n rx(theta)^dagger = rx(-theta)\n '
return CX_PIGate((- self.params[0])) | Invert this gate.
rx(theta)^dagger = rx(-theta) | qiskit/extensions/standard/rx_pi.py | inverse | shaimach/qiskit-terra-osq | 0 | python | def inverse(self):
'Invert this gate.\n\n rx(theta)^dagger = rx(-theta)\n '
return CX_PIGate((- self.params[0])) | def inverse(self):
'Invert this gate.\n\n rx(theta)^dagger = rx(-theta)\n '
return CX_PIGate((- self.params[0]))<|docstring|>Invert this gate.
rx(theta)^dagger = rx(-theta)<|endoftext|> |
0c0f548a7b2d473bc7cde52e5dce44e21142358f2007c2b171b6188101f36a01 | def to_matrix(self):
'Return a Numpy.array for the U3 gate.'
lam = self.params[0]
lam = float(lam)
return numpy.array([[1, 0], [0, numpy.exp((1j * lam))]], dtype=complex) | Return a Numpy.array for the U3 gate. | qiskit/extensions/standard/rx_pi.py | to_matrix | shaimach/qiskit-terra-osq | 0 | python | def to_matrix(self):
lam = self.params[0]
lam = float(lam)
return numpy.array([[1, 0], [0, numpy.exp((1j * lam))]], dtype=complex) | def to_matrix(self):
lam = self.params[0]
lam = float(lam)
return numpy.array([[1, 0], [0, numpy.exp((1j * lam))]], dtype=complex)<|docstring|>Return a Numpy.array for the U3 gate.<|endoftext|> |
72e8f1ec81ec0063770eaa3ebfe0498622178236c2e1682ca199bc7e53e34d34 | def get_MS1(time, rep, cond, species):
'Returns the desired MS1 intensity of given experiment and desired species\n\n Parameters\n ----------\n time : int/float\n Timepoint of the experiment\n\n rep : int\n Replicate of the experiment\n\n cond : str\n Condition/Treatment of the e... | Returns the desired MS1 intensity of given experiment and desired species
Parameters
----------
time : int/float
Timepoint of the experiment
rep : int
Replicate of the experiment
cond : str
Condition/Treatment of the experiment
species : str
Species of which the MS1 data should be returned
Returns
... | Site-specific_intensities_H3.py | get_MS1 | functional-proteo-metabolomics/CoMetChem | 0 | python | def get_MS1(time, rep, cond, species):
'Returns the desired MS1 intensity of given experiment and desired species\n\n Parameters\n ----------\n time : int/float\n Timepoint of the experiment\n\n rep : int\n Replicate of the experiment\n\n cond : str\n Condition/Treatment of the e... | def get_MS1(time, rep, cond, species):
'Returns the desired MS1 intensity of given experiment and desired species\n\n Parameters\n ----------\n time : int/float\n Timepoint of the experiment\n\n rep : int\n Replicate of the experiment\n\n cond : str\n Condition/Treatment of the e... |
b514ba7fcd06a6a1a157fb3ce384ded18219994518c365200cf964a4aed8c4fb | def main():
'\n This program simulates a bouncing ball at (START_X, START_Y)\n that has VX as x velocity and 0 as y velocity. Each bounce reduces\n y velocity to REDUCE of itself.\n '
ball.filled = True
ball.fill_color = 'black'
window.add(ball)
onmouseclicked(bounce) | This program simulates a bouncing ball at (START_X, START_Y)
that has VX as x velocity and 0 as y velocity. Each bounce reduces
y velocity to REDUCE of itself. | bouncing_ball/bouncing_ball.py | main | pe11te18r/MystanCodeProjects | 0 | python | def main():
'\n This program simulates a bouncing ball at (START_X, START_Y)\n that has VX as x velocity and 0 as y velocity. Each bounce reduces\n y velocity to REDUCE of itself.\n '
ball.filled = True
ball.fill_color = 'black'
window.add(ball)
onmouseclicked(bounce) | def main():
'\n This program simulates a bouncing ball at (START_X, START_Y)\n that has VX as x velocity and 0 as y velocity. Each bounce reduces\n y velocity to REDUCE of itself.\n '
ball.filled = True
ball.fill_color = 'black'
window.add(ball)
onmouseclicked(bounce)<|docstring|>This pr... |
d0b3ba1ff287e426a58024aca576cd9187dfcbf26f29a8376b1d6d6f09ca1e00 | @_dispatch.add_dispatch_list
@tf_export('audio_microfrontend')
def audio_microfrontend(audio, sample_rate=16000, window_size=25, window_step=10, num_channels=32, upper_band_limit=7500, lower_band_limit=125, smoothing_bits=10, even_smoothing=0.025, odd_smoothing=0.06, min_signal_remaining=0.05, enable_pcan=False, pcan_s... | Audio Microfrontend Op.
This Op converts a sequence of audio data into one or more
feature vectors containing filterbanks of the input. The
conversion process uses a lightweight library to perform:
1. A slicing window function
2. Short-time FFTs
3. Filterbank calculations
4. Noise reduction
5. PCAN Auto Gain Control
... | venv/lib/python3.6/site-packages/tensorflow_core/lite/experimental/microfrontend/ops/gen_audio_microfrontend_op.py | audio_microfrontend | databill86/HyperFoods | 2 | python | @_dispatch.add_dispatch_list
@tf_export('audio_microfrontend')
def audio_microfrontend(audio, sample_rate=16000, window_size=25, window_step=10, num_channels=32, upper_band_limit=7500, lower_band_limit=125, smoothing_bits=10, even_smoothing=0.025, odd_smoothing=0.06, min_signal_remaining=0.05, enable_pcan=False, pcan_s... | @_dispatch.add_dispatch_list
@tf_export('audio_microfrontend')
def audio_microfrontend(audio, sample_rate=16000, window_size=25, window_step=10, num_channels=32, upper_band_limit=7500, lower_band_limit=125, smoothing_bits=10, even_smoothing=0.025, odd_smoothing=0.06, min_signal_remaining=0.05, enable_pcan=False, pcan_s... |
05472cfce800e484442ffa387c8d9b51241b7f1f96f781f542a3918df3a19ac8 | def check_modified_graph(self, new_stages):
'Generate graph including the new stage to check for errors'
if (not getattr(self, '_skip_graph_checks', False)):
self._collect_graph((self.stages + new_stages)) | Generate graph including the new stage to check for errors | dvc/repo/__init__.py | check_modified_graph | shizacat/dvc | 0 | python | def check_modified_graph(self, new_stages):
if (not getattr(self, '_skip_graph_checks', False)):
self._collect_graph((self.stages + new_stages)) | def check_modified_graph(self, new_stages):
if (not getattr(self, '_skip_graph_checks', False)):
self._collect_graph((self.stages + new_stages))<|docstring|>Generate graph including the new stage to check for errors<|endoftext|> |
8ea64cdfcea42a0a06fef18963732e81a5fb68d60b8596c991beb0982656389c | def used_cache(self, targets=None, all_branches=False, with_deps=False, all_tags=False, all_commits=False, remote=None, force=False, jobs=None, recursive=False):
"Get the stages related to the given target and collect\n the `info` of its outputs.\n\n This is useful to know what files from the cache ar... | Get the stages related to the given target and collect
the `info` of its outputs.
This is useful to know what files from the cache are _in use_
(namely, a file described as an output on a stage).
The scope is, by default, the working directory, but you can use
`all_branches`/`all_tags`/`all_commits` to expand the sco... | dvc/repo/__init__.py | used_cache | shizacat/dvc | 0 | python | def used_cache(self, targets=None, all_branches=False, with_deps=False, all_tags=False, all_commits=False, remote=None, force=False, jobs=None, recursive=False):
"Get the stages related to the given target and collect\n the `info` of its outputs.\n\n This is useful to know what files from the cache ar... | def used_cache(self, targets=None, all_branches=False, with_deps=False, all_tags=False, all_commits=False, remote=None, force=False, jobs=None, recursive=False):
"Get the stages related to the given target and collect\n the `info` of its outputs.\n\n This is useful to know what files from the cache ar... |
dedaa7b6bbaf239d2301f8b7023548220daf1ed62dcfacea50bc80f07361fdd0 | def _collect_graph(self, stages=None):
'Generate a graph by using the given stages on the given directory\n\n The nodes of the graph are the stage\'s path relative to the root.\n\n Edges are created when the output of one stage is used as a\n dependency in other stage.\n\n The direction ... | Generate a graph by using the given stages on the given directory
The nodes of the graph are the stage's path relative to the root.
Edges are created when the output of one stage is used as a
dependency in other stage.
The direction of the edges goes from the stage to its dependency:
For example, running the follow... | dvc/repo/__init__.py | _collect_graph | shizacat/dvc | 0 | python | def _collect_graph(self, stages=None):
'Generate a graph by using the given stages on the given directory\n\n The nodes of the graph are the stage\'s path relative to the root.\n\n Edges are created when the output of one stage is used as a\n dependency in other stage.\n\n The direction ... | def _collect_graph(self, stages=None):
'Generate a graph by using the given stages on the given directory\n\n The nodes of the graph are the stage\'s path relative to the root.\n\n Edges are created when the output of one stage is used as a\n dependency in other stage.\n\n The direction ... |
3704efe6e2b1b56e743e8fd194bbeeba9ffa92bdf52961c3d9411e5f11ddea22 | @cached_property
def stages(self):
'\n Walks down the root directory looking for Dvcfiles,\n skipping the directories that are related with\n any SCM (e.g. `.git`), DVC itself (`.dvc`), or directories\n tracked by DVC (e.g. `dvc add data` would skip `data/`)\n\n NOTE: For large re... | Walks down the root directory looking for Dvcfiles,
skipping the directories that are related with
any SCM (e.g. `.git`), DVC itself (`.dvc`), or directories
tracked by DVC (e.g. `dvc add data` would skip `data/`)
NOTE: For large repos, this could be an expensive
operation. Consider using some memoization. | dvc/repo/__init__.py | stages | shizacat/dvc | 0 | python | @cached_property
def stages(self):
'\n Walks down the root directory looking for Dvcfiles,\n skipping the directories that are related with\n any SCM (e.g. `.git`), DVC itself (`.dvc`), or directories\n tracked by DVC (e.g. `dvc add data` would skip `data/`)\n\n NOTE: For large re... | @cached_property
def stages(self):
'\n Walks down the root directory looking for Dvcfiles,\n skipping the directories that are related with\n any SCM (e.g. `.git`), DVC itself (`.dvc`), or directories\n tracked by DVC (e.g. `dvc add data` would skip `data/`)\n\n NOTE: For large re... |
475d918ec49b3eac3cedb9356315df44d1aff4ec99fcafae40c9456f1ae2feed | @contextmanager
def open_by_relpath(self, path, remote=None, mode='r', encoding=None):
'Opens a specified resource as a file descriptor'
cause = None
try:
out = self.find_out_by_relpath(path)
except OutputNotFoundError as exc:
out = None
cause = exc
if (out and out.use_cache)... | Opens a specified resource as a file descriptor | dvc/repo/__init__.py | open_by_relpath | shizacat/dvc | 0 | python | @contextmanager
def open_by_relpath(self, path, remote=None, mode='r', encoding=None):
cause = None
try:
out = self.find_out_by_relpath(path)
except OutputNotFoundError as exc:
out = None
cause = exc
if (out and out.use_cache):
try:
with self._open_cached... | @contextmanager
def open_by_relpath(self, path, remote=None, mode='r', encoding=None):
cause = None
try:
out = self.find_out_by_relpath(path)
except OutputNotFoundError as exc:
out = None
cause = exc
if (out and out.use_cache):
try:
with self._open_cached... |
7d0671f88c8a73205efaed00e7b530210387203b272c66333035d534b1086887 | @decorate
def defer(coro, delay=1):
'\n Returns a coroutine function wrapper that will defer the given coroutine\n execution for a certain amount of seconds in a non-blocking way.\n\n This function can be used as decorator.\n\n Arguments:\n coro (coroutinefunction): coroutine function to defer.\n... | Returns a coroutine function wrapper that will defer the given coroutine
execution for a certain amount of seconds in a non-blocking way.
This function can be used as decorator.
Arguments:
coro (coroutinefunction): coroutine function to defer.
delay (int/float): number of seconds to defer execution.
Raises:
... | paco/defer.py | defer | thatmattbone/paco | 208 | python | @decorate
def defer(coro, delay=1):
'\n Returns a coroutine function wrapper that will defer the given coroutine\n execution for a certain amount of seconds in a non-blocking way.\n\n This function can be used as decorator.\n\n Arguments:\n coro (coroutinefunction): coroutine function to defer.\n... | @decorate
def defer(coro, delay=1):
'\n Returns a coroutine function wrapper that will defer the given coroutine\n execution for a certain amount of seconds in a non-blocking way.\n\n This function can be used as decorator.\n\n Arguments:\n coro (coroutinefunction): coroutine function to defer.\n... |
772cabecc66d6038ceff84e709d71ecb1ad207899fe439b82c1bcea78a81633e | def main(session):
'\n This example uses the declarePathForTags method.\n '
animation_player_service = session.service('ALAnimationPlayer')
animation_player_service.declarePathForTags('myanimlib/[robot]/[posture]/') | This example uses the declarePathForTags method. | naoqi-sdk-2.5.5.5-linux64/doc/_downloads/alanimationplayer_tutorial_declarePathForTags.py | main | applejenny66/docker_pepper | 0 | python | def main(session):
'\n \n '
animation_player_service = session.service('ALAnimationPlayer')
animation_player_service.declarePathForTags('myanimlib/[robot]/[posture]/') | def main(session):
'\n \n '
animation_player_service = session.service('ALAnimationPlayer')
animation_player_service.declarePathForTags('myanimlib/[robot]/[posture]/')<|docstring|>This example uses the declarePathForTags method.<|endoftext|> |
465e09ad8b1bcfc4b949e497c1e6c76fee69392793733b2afb992cadb78dfa35 | def _get_input_fn(x, y, input_fn, feed_fn, batch_size, shuffle=False, epochs=1):
'Make inputs into input and feed functions.\n\n Args:\n x: Numpy, Pandas or Dask matrix or iterable.\n y: Numpy, Pandas or Dask matrix or iterable.\n input_fn: Pre-defined input function for training data.\n feed_fn: Pre-d... | Make inputs into input and feed functions.
Args:
x: Numpy, Pandas or Dask matrix or iterable.
y: Numpy, Pandas or Dask matrix or iterable.
input_fn: Pre-defined input function for training data.
feed_fn: Pre-defined data feeder function.
batch_size: Size to split data into parts. Must be >= 1.
shuffle: Whe... | tensorflow/contrib/learn/python/learn/estimators/estimator.py | _get_input_fn | PedroLelis/tensorflow | 1 | python | def _get_input_fn(x, y, input_fn, feed_fn, batch_size, shuffle=False, epochs=1):
'Make inputs into input and feed functions.\n\n Args:\n x: Numpy, Pandas or Dask matrix or iterable.\n y: Numpy, Pandas or Dask matrix or iterable.\n input_fn: Pre-defined input function for training data.\n feed_fn: Pre-d... | def _get_input_fn(x, y, input_fn, feed_fn, batch_size, shuffle=False, epochs=1):
'Make inputs into input and feed functions.\n\n Args:\n x: Numpy, Pandas or Dask matrix or iterable.\n y: Numpy, Pandas or Dask matrix or iterable.\n input_fn: Pre-defined input function for training data.\n feed_fn: Pre-d... |
5ab3f0f479f17d6e4c0d27b30c32fa56c8027b9f0e0a787abddeec1b6afa3dcd | def infer_real_valued_columns_from_input_fn(input_fn):
'Creates `FeatureColumn` objects for inputs defined by `input_fn`.\n\n This interprets all inputs as dense, fixed-length float values. This creates\n a local graph in which it calls `input_fn` to build the tensors, then discards\n it.\n\n Args:\n input_f... | Creates `FeatureColumn` objects for inputs defined by `input_fn`.
This interprets all inputs as dense, fixed-length float values. This creates
a local graph in which it calls `input_fn` to build the tensors, then discards
it.
Args:
input_fn: Input function returning a tuple of:
features - Dictionary of string... | tensorflow/contrib/learn/python/learn/estimators/estimator.py | infer_real_valued_columns_from_input_fn | PedroLelis/tensorflow | 1 | python | def infer_real_valued_columns_from_input_fn(input_fn):
'Creates `FeatureColumn` objects for inputs defined by `input_fn`.\n\n This interprets all inputs as dense, fixed-length float values. This creates\n a local graph in which it calls `input_fn` to build the tensors, then discards\n it.\n\n Args:\n input_f... | def infer_real_valued_columns_from_input_fn(input_fn):
'Creates `FeatureColumn` objects for inputs defined by `input_fn`.\n\n This interprets all inputs as dense, fixed-length float values. This creates\n a local graph in which it calls `input_fn` to build the tensors, then discards\n it.\n\n Args:\n input_f... |
0393098720a4149df74956f3eabf657b2e9176a50c7351d5fe44087adc0cff23 | def infer_real_valued_columns_from_input(x):
'Creates `FeatureColumn` objects for inputs defined by input `x`.\n\n This interprets all inputs as dense, fixed-length float values.\n\n Args:\n x: Real-valued matrix of shape [n_samples, n_features...]. Can be\n iterator that returns arrays of features.\n\n ... | Creates `FeatureColumn` objects for inputs defined by input `x`.
This interprets all inputs as dense, fixed-length float values.
Args:
x: Real-valued matrix of shape [n_samples, n_features...]. Can be
iterator that returns arrays of features.
Returns:
List of `FeatureColumn` objects. | tensorflow/contrib/learn/python/learn/estimators/estimator.py | infer_real_valued_columns_from_input | PedroLelis/tensorflow | 1 | python | def infer_real_valued_columns_from_input(x):
'Creates `FeatureColumn` objects for inputs defined by input `x`.\n\n This interprets all inputs as dense, fixed-length float values.\n\n Args:\n x: Real-valued matrix of shape [n_samples, n_features...]. Can be\n iterator that returns arrays of features.\n\n ... | def infer_real_valued_columns_from_input(x):
'Creates `FeatureColumn` objects for inputs defined by input `x`.\n\n This interprets all inputs as dense, fixed-length float values.\n\n Args:\n x: Real-valued matrix of shape [n_samples, n_features...]. Can be\n iterator that returns arrays of features.\n\n ... |
0ed3468c1cfd0f6b51d3883e2615bd0ed1ed90eeec48c6e715d1e88ce2b3d288 | def _get_arguments(func):
'Returns list of arguments this function has.'
if hasattr(func, '__code__'):
return inspect.getargspec(func).args
elif hasattr(func, '__call__'):
return _get_arguments(func.__call__)
elif hasattr(func, 'func'):
return _get_arguments(func.func) | Returns list of arguments this function has. | tensorflow/contrib/learn/python/learn/estimators/estimator.py | _get_arguments | PedroLelis/tensorflow | 1 | python | def _get_arguments(func):
if hasattr(func, '__code__'):
return inspect.getargspec(func).args
elif hasattr(func, '__call__'):
return _get_arguments(func.__call__)
elif hasattr(func, 'func'):
return _get_arguments(func.func) | def _get_arguments(func):
if hasattr(func, '__code__'):
return inspect.getargspec(func).args
elif hasattr(func, '__call__'):
return _get_arguments(func.__call__)
elif hasattr(func, 'func'):
return _get_arguments(func.func)<|docstring|>Returns list of arguments this function has.... |
5c40b24f01fc8505a07a7ebdc52e763434b752d4c96fae1ff9a4944b4cab3e67 | def _get_replica_device_setter(config):
'Creates a replica device setter if required.\n\n Args:\n config: A RunConfig instance.\n\n Returns:\n A replica device setter, or None.\n '
ps_ops = ['Variable', 'AutoReloadVariable', 'MutableHashTable', 'MutableHashTableOfTensors', 'MutableDenseHashTable']
... | Creates a replica device setter if required.
Args:
config: A RunConfig instance.
Returns:
A replica device setter, or None. | tensorflow/contrib/learn/python/learn/estimators/estimator.py | _get_replica_device_setter | PedroLelis/tensorflow | 1 | python | def _get_replica_device_setter(config):
'Creates a replica device setter if required.\n\n Args:\n config: A RunConfig instance.\n\n Returns:\n A replica device setter, or None.\n '
ps_ops = ['Variable', 'AutoReloadVariable', 'MutableHashTable', 'MutableHashTableOfTensors', 'MutableDenseHashTable']
... | def _get_replica_device_setter(config):
'Creates a replica device setter if required.\n\n Args:\n config: A RunConfig instance.\n\n Returns:\n A replica device setter, or None.\n '
ps_ops = ['Variable', 'AutoReloadVariable', 'MutableHashTable', 'MutableHashTableOfTensors', 'MutableDenseHashTable']
... |
805f65f0f4789ab028c57d27894dca7dc64b1789a9a789e776291f2dec39540f | def _make_metrics_ops(metrics, features, labels, predictions):
'Add metrics based on `features`, `labels`, and `predictions`.\n\n `metrics` contains a specification for how to run metrics. It is a dict\n mapping friendly names to either `MetricSpec` objects, or directly to a metric\n function (assuming that `pre... | Add metrics based on `features`, `labels`, and `predictions`.
`metrics` contains a specification for how to run metrics. It is a dict
mapping friendly names to either `MetricSpec` objects, or directly to a metric
function (assuming that `predictions` and `labels` are single tensors), or to
`(pred_name, metric)` `tuple... | tensorflow/contrib/learn/python/learn/estimators/estimator.py | _make_metrics_ops | PedroLelis/tensorflow | 1 | python | def _make_metrics_ops(metrics, features, labels, predictions):
'Add metrics based on `features`, `labels`, and `predictions`.\n\n `metrics` contains a specification for how to run metrics. It is a dict\n mapping friendly names to either `MetricSpec` objects, or directly to a metric\n function (assuming that `pre... | def _make_metrics_ops(metrics, features, labels, predictions):
'Add metrics based on `features`, `labels`, and `predictions`.\n\n `metrics` contains a specification for how to run metrics. It is a dict\n mapping friendly names to either `MetricSpec` objects, or directly to a metric\n function (assuming that `pre... |
bd997856ec65f405c090e796e13a6dd63f21a8157985fab639abe10a722e356b | def __init__(self, model_dir=None, config=None):
'Initializes a BaseEstimator instance.\n\n Args:\n model_dir: Directory to save model parameters, graph and etc. This can\n also be used to load checkpoints from the directory into a estimator to\n continue training a previously saved model.\n ... | Initializes a BaseEstimator instance.
Args:
model_dir: Directory to save model parameters, graph and etc. This can
also be used to load checkpoints from the directory into a estimator to
continue training a previously saved model.
config: A RunConfig instance. | tensorflow/contrib/learn/python/learn/estimators/estimator.py | __init__ | PedroLelis/tensorflow | 1 | python | def __init__(self, model_dir=None, config=None):
'Initializes a BaseEstimator instance.\n\n Args:\n model_dir: Directory to save model parameters, graph and etc. This can\n also be used to load checkpoints from the directory into a estimator to\n continue training a previously saved model.\n ... | def __init__(self, model_dir=None, config=None):
'Initializes a BaseEstimator instance.\n\n Args:\n model_dir: Directory to save model parameters, graph and etc. This can\n also be used to load checkpoints from the directory into a estimator to\n continue training a previously saved model.\n ... |
2651b9418c8cdd2efb43328b33411e28d35aa923417e1acc08309374db1f4a04 | @deprecated_args(SCIKIT_DECOUPLE_DATE, SCIKIT_DECOUPLE_INSTRUCTIONS, 'x', 'y', 'batch_size')
def fit(self, x=None, y=None, input_fn=None, steps=None, batch_size=None, monitors=None, max_steps=None):
'See `Trainable`.\n\n Raises:\n ValueError: If `x` or `y` are not `None` while `input_fn` is not `None`.\n ... | See `Trainable`.
Raises:
ValueError: If `x` or `y` are not `None` while `input_fn` is not `None`.
ValueError: If both `steps` and `max_steps` are not `None`. | tensorflow/contrib/learn/python/learn/estimators/estimator.py | fit | PedroLelis/tensorflow | 1 | python | @deprecated_args(SCIKIT_DECOUPLE_DATE, SCIKIT_DECOUPLE_INSTRUCTIONS, 'x', 'y', 'batch_size')
def fit(self, x=None, y=None, input_fn=None, steps=None, batch_size=None, monitors=None, max_steps=None):
'See `Trainable`.\n\n Raises:\n ValueError: If `x` or `y` are not `None` while `input_fn` is not `None`.\n ... | @deprecated_args(SCIKIT_DECOUPLE_DATE, SCIKIT_DECOUPLE_INSTRUCTIONS, 'x', 'y', 'batch_size')
def fit(self, x=None, y=None, input_fn=None, steps=None, batch_size=None, monitors=None, max_steps=None):
'See `Trainable`.\n\n Raises:\n ValueError: If `x` or `y` are not `None` while `input_fn` is not `None`.\n ... |
5f2e302b3f959b2f01cf0e409b2c5ab10f43fd2f77b9fce25f559cee6df971cc | @deprecated_args(SCIKIT_DECOUPLE_DATE, SCIKIT_DECOUPLE_INSTRUCTIONS, 'x', 'y', 'batch_size')
def partial_fit(self, x=None, y=None, input_fn=None, steps=1, batch_size=None, monitors=None):
'Incremental fit on a batch of samples.\n\n This method is expected to be called several times consecutively\n on differen... | Incremental fit on a batch of samples.
This method is expected to be called several times consecutively
on different or the same chunks of the dataset. This either can
implement iterative training or out-of-core/online training.
This is especially useful when the whole dataset is too big to
fit in memory at the same ... | tensorflow/contrib/learn/python/learn/estimators/estimator.py | partial_fit | PedroLelis/tensorflow | 1 | python | @deprecated_args(SCIKIT_DECOUPLE_DATE, SCIKIT_DECOUPLE_INSTRUCTIONS, 'x', 'y', 'batch_size')
def partial_fit(self, x=None, y=None, input_fn=None, steps=1, batch_size=None, monitors=None):
'Incremental fit on a batch of samples.\n\n This method is expected to be called several times consecutively\n on differen... | @deprecated_args(SCIKIT_DECOUPLE_DATE, SCIKIT_DECOUPLE_INSTRUCTIONS, 'x', 'y', 'batch_size')
def partial_fit(self, x=None, y=None, input_fn=None, steps=1, batch_size=None, monitors=None):
'Incremental fit on a batch of samples.\n\n This method is expected to be called several times consecutively\n on differen... |
daa6965ed4df6d9cf292711ca3ea8ded7d41282092ba58713dc3f7d326833de3 | @deprecated_args(SCIKIT_DECOUPLE_DATE, SCIKIT_DECOUPLE_INSTRUCTIONS, 'x', 'y', 'batch_size')
def evaluate(self, x=None, y=None, input_fn=None, feed_fn=None, batch_size=None, steps=None, metrics=None, name=None):
'See `Evaluable`.\n\n Raises:\n ValueError: If at least one of `x` or `y` is provided, and at le... | See `Evaluable`.
Raises:
ValueError: If at least one of `x` or `y` is provided, and at least one of
`input_fn` or `feed_fn` is provided.
Or if `metrics` is not `None` or `dict`. | tensorflow/contrib/learn/python/learn/estimators/estimator.py | evaluate | PedroLelis/tensorflow | 1 | python | @deprecated_args(SCIKIT_DECOUPLE_DATE, SCIKIT_DECOUPLE_INSTRUCTIONS, 'x', 'y', 'batch_size')
def evaluate(self, x=None, y=None, input_fn=None, feed_fn=None, batch_size=None, steps=None, metrics=None, name=None):
'See `Evaluable`.\n\n Raises:\n ValueError: If at least one of `x` or `y` is provided, and at le... | @deprecated_args(SCIKIT_DECOUPLE_DATE, SCIKIT_DECOUPLE_INSTRUCTIONS, 'x', 'y', 'batch_size')
def evaluate(self, x=None, y=None, input_fn=None, feed_fn=None, batch_size=None, steps=None, metrics=None, name=None):
'See `Evaluable`.\n\n Raises:\n ValueError: If at least one of `x` or `y` is provided, and at le... |
e1d61e5553e126ef6a68828128263726dfd4a53927d7683b9664ed05cf8016cd | @deprecated_args(SCIKIT_DECOUPLE_DATE, SCIKIT_DECOUPLE_INSTRUCTIONS, 'x', 'batch_size', 'as_iterable')
def predict(self, x=None, input_fn=None, batch_size=None, outputs=None, as_iterable=True):
"Returns predictions for given features.\n\n Args:\n x: Matrix of shape [n_samples, n_features...]. Can be iterato... | Returns predictions for given features.
Args:
x: Matrix of shape [n_samples, n_features...]. Can be iterator that
returns arrays of features. The training input samples for fitting the
model. If set, `input_fn` must be `None`.
input_fn: Input function. If set, `x` and 'batch_size' must be `None`.
batch... | tensorflow/contrib/learn/python/learn/estimators/estimator.py | predict | PedroLelis/tensorflow | 1 | python | @deprecated_args(SCIKIT_DECOUPLE_DATE, SCIKIT_DECOUPLE_INSTRUCTIONS, 'x', 'batch_size', 'as_iterable')
def predict(self, x=None, input_fn=None, batch_size=None, outputs=None, as_iterable=True):
"Returns predictions for given features.\n\n Args:\n x: Matrix of shape [n_samples, n_features...]. Can be iterato... | @deprecated_args(SCIKIT_DECOUPLE_DATE, SCIKIT_DECOUPLE_INSTRUCTIONS, 'x', 'batch_size', 'as_iterable')
def predict(self, x=None, input_fn=None, batch_size=None, outputs=None, as_iterable=True):
"Returns predictions for given features.\n\n Args:\n x: Matrix of shape [n_samples, n_features...]. Can be iterato... |
c132ed43875eb0c39f2eba744bb443fd571275a5e637c7894cfb7a38efea55bd | def get_variable_value(self, name):
'Returns value of the variable given by name.\n\n Args:\n name: string, name of the tensor.\n\n Returns:\n Numpy array - value of the tensor.\n '
return load_variable(self.model_dir, name) | Returns value of the variable given by name.
Args:
name: string, name of the tensor.
Returns:
Numpy array - value of the tensor. | tensorflow/contrib/learn/python/learn/estimators/estimator.py | get_variable_value | PedroLelis/tensorflow | 1 | python | def get_variable_value(self, name):
'Returns value of the variable given by name.\n\n Args:\n name: string, name of the tensor.\n\n Returns:\n Numpy array - value of the tensor.\n '
return load_variable(self.model_dir, name) | def get_variable_value(self, name):
'Returns value of the variable given by name.\n\n Args:\n name: string, name of the tensor.\n\n Returns:\n Numpy array - value of the tensor.\n '
return load_variable(self.model_dir, name)<|docstring|>Returns value of the variable given by name.
Args:
na... |
b1ce67ad8027b76bb524785a41101241efcb673571931b5f51751a5435dac623 | def get_variable_names(self):
'Returns list of all variable names in this model.\n\n Returns:\n List of names.\n '
return [name for (name, _) in list_variables(self.model_dir)] | Returns list of all variable names in this model.
Returns:
List of names. | tensorflow/contrib/learn/python/learn/estimators/estimator.py | get_variable_names | PedroLelis/tensorflow | 1 | python | def get_variable_names(self):
'Returns list of all variable names in this model.\n\n Returns:\n List of names.\n '
return [name for (name, _) in list_variables(self.model_dir)] | def get_variable_names(self):
'Returns list of all variable names in this model.\n\n Returns:\n List of names.\n '
return [name for (name, _) in list_variables(self.model_dir)]<|docstring|>Returns list of all variable names in this model.
Returns:
List of names.<|endoftext|> |
25799618fbc88979703f376ac4aceeb821ee8d3f41542bbc6cc031d443ef28dd | @deprecated_arg_values('2016-09-23', "The signature of the input_fn accepted by export is changing to be consistent with what's used by tf.Learn Estimator's train/evaluate. input_fn (and in most cases, input_feature_key) will become required args, and use_deprecated_input_fn will default to False and be removed altoget... | Exports inference graph into given dir.
Args:
export_dir: A string containing a directory to write the exported graph
and checkpoints.
input_fn: If `use_deprecated_input_fn` is true, then a function that given
`Tensor` of `Example` strings, parses it into features that are then
passed to the model. Oth... | tensorflow/contrib/learn/python/learn/estimators/estimator.py | export | PedroLelis/tensorflow | 1 | python | @deprecated_arg_values('2016-09-23', "The signature of the input_fn accepted by export is changing to be consistent with what's used by tf.Learn Estimator's train/evaluate. input_fn (and in most cases, input_feature_key) will become required args, and use_deprecated_input_fn will default to False and be removed altoget... | @deprecated_arg_values('2016-09-23', "The signature of the input_fn accepted by export is changing to be consistent with what's used by tf.Learn Estimator's train/evaluate. input_fn (and in most cases, input_feature_key) will become required args, and use_deprecated_input_fn will default to False and be removed altoget... |
c575f6ef0fd06f45562725bdbd1ba50cfd961ba0bc7ee4be5b2044f171823a1b | @abc.abstractproperty
def _get_train_ops(self, features, labels):
'Method that builds model graph and returns trainer ops.\n\n Expected to be overriden by sub-classes that require custom support.\n\n Args:\n features: `Tensor` or `dict` of `Tensor` objects.\n labels: `Tensor` or `dict` of `Tensor` o... | Method that builds model graph and returns trainer ops.
Expected to be overriden by sub-classes that require custom support.
Args:
features: `Tensor` or `dict` of `Tensor` objects.
labels: `Tensor` or `dict` of `Tensor` objects.
Returns:
A `ModelFnOps` object. | tensorflow/contrib/learn/python/learn/estimators/estimator.py | _get_train_ops | PedroLelis/tensorflow | 1 | python | @abc.abstractproperty
def _get_train_ops(self, features, labels):
'Method that builds model graph and returns trainer ops.\n\n Expected to be overriden by sub-classes that require custom support.\n\n Args:\n features: `Tensor` or `dict` of `Tensor` objects.\n labels: `Tensor` or `dict` of `Tensor` o... | @abc.abstractproperty
def _get_train_ops(self, features, labels):
'Method that builds model graph and returns trainer ops.\n\n Expected to be overriden by sub-classes that require custom support.\n\n Args:\n features: `Tensor` or `dict` of `Tensor` objects.\n labels: `Tensor` or `dict` of `Tensor` o... |
024d38f0b799da6c91c09adb6f6973c46212ffe97d0434ec49a784c0ac308cc6 | @abc.abstractproperty
def _get_predict_ops(self, features):
'Method that builds model graph and returns prediction ops.\n\n Args:\n features: `Tensor` or `dict` of `Tensor` objects.\n\n Returns:\n A `ModelFnOps` object.\n '
pass | Method that builds model graph and returns prediction ops.
Args:
features: `Tensor` or `dict` of `Tensor` objects.
Returns:
A `ModelFnOps` object. | tensorflow/contrib/learn/python/learn/estimators/estimator.py | _get_predict_ops | PedroLelis/tensorflow | 1 | python | @abc.abstractproperty
def _get_predict_ops(self, features):
'Method that builds model graph and returns prediction ops.\n\n Args:\n features: `Tensor` or `dict` of `Tensor` objects.\n\n Returns:\n A `ModelFnOps` object.\n '
pass | @abc.abstractproperty
def _get_predict_ops(self, features):
'Method that builds model graph and returns prediction ops.\n\n Args:\n features: `Tensor` or `dict` of `Tensor` objects.\n\n Returns:\n A `ModelFnOps` object.\n '
pass<|docstring|>Method that builds model graph and returns predictio... |
384fd1b2a662676db7ac6596c010c2b2bfb436e91a165ec56f23848587f93c6a | def _get_eval_ops(self, features, labels, metrics):
'Method that builds model graph and returns evaluation ops.\n\n Expected to be overriden by sub-classes that require custom support.\n\n Args:\n features: `Tensor` or `dict` of `Tensor` objects.\n labels: `Tensor` or `dict` of `Tensor` objects.\n ... | Method that builds model graph and returns evaluation ops.
Expected to be overriden by sub-classes that require custom support.
Args:
features: `Tensor` or `dict` of `Tensor` objects.
labels: `Tensor` or `dict` of `Tensor` objects.
metrics: Dict of metrics to run. If None, the default metric functions
are u... | tensorflow/contrib/learn/python/learn/estimators/estimator.py | _get_eval_ops | PedroLelis/tensorflow | 1 | python | def _get_eval_ops(self, features, labels, metrics):
'Method that builds model graph and returns evaluation ops.\n\n Expected to be overriden by sub-classes that require custom support.\n\n Args:\n features: `Tensor` or `dict` of `Tensor` objects.\n labels: `Tensor` or `dict` of `Tensor` objects.\n ... | def _get_eval_ops(self, features, labels, metrics):
'Method that builds model graph and returns evaluation ops.\n\n Expected to be overriden by sub-classes that require custom support.\n\n Args:\n features: `Tensor` or `dict` of `Tensor` objects.\n labels: `Tensor` or `dict` of `Tensor` objects.\n ... |
66faa95459ede715efb3a352ae0936e63834eb3a731fb3bf6130709775c79c52 | @deprecated('2016-09-23', "The signature of the input_fn accepted by export is changing to be consistent with what's used by tf.Learn Estimator's train/evaluate, which makes this function useless. This will be removed after the deprecation date.")
def _get_feature_ops_from_example(self, examples_batch):
'Returns fe... | Returns feature parser for given example batch using features info.
This function requires `fit()` has been called.
Args:
examples_batch: batch of tf.Example
Returns:
features: `Tensor` or `dict` of `Tensor` objects.
Raises:
ValueError: If `_features_info` attribute is not available (usually
because `fit()`... | tensorflow/contrib/learn/python/learn/estimators/estimator.py | _get_feature_ops_from_example | PedroLelis/tensorflow | 1 | python | @deprecated('2016-09-23', "The signature of the input_fn accepted by export is changing to be consistent with what's used by tf.Learn Estimator's train/evaluate, which makes this function useless. This will be removed after the deprecation date.")
def _get_feature_ops_from_example(self, examples_batch):
'Returns fe... | @deprecated('2016-09-23', "The signature of the input_fn accepted by export is changing to be consistent with what's used by tf.Learn Estimator's train/evaluate, which makes this function useless. This will be removed after the deprecation date.")
def _get_feature_ops_from_example(self, examples_batch):
'Returns fe... |
52820747918dd33bc481372aeb7581aba210bb852c32eb66d92c86b137a1c938 | def _extract_metric_update_ops(self, eval_dict):
'Separate update operations from metric value operations.'
update_ops = []
value_ops = {}
for (name, metric_ops) in six.iteritems(eval_dict):
if isinstance(metric_ops, (list, tuple)):
if (len(metric_ops) == 2):
value_op... | Separate update operations from metric value operations. | tensorflow/contrib/learn/python/learn/estimators/estimator.py | _extract_metric_update_ops | PedroLelis/tensorflow | 1 | python | def _extract_metric_update_ops(self, eval_dict):
update_ops = []
value_ops = {}
for (name, metric_ops) in six.iteritems(eval_dict):
if isinstance(metric_ops, (list, tuple)):
if (len(metric_ops) == 2):
value_ops[name] = metric_ops[0]
update_ops.append(... | def _extract_metric_update_ops(self, eval_dict):
update_ops = []
value_ops = {}
for (name, metric_ops) in six.iteritems(eval_dict):
if isinstance(metric_ops, (list, tuple)):
if (len(metric_ops) == 2):
value_ops[name] = metric_ops[0]
update_ops.append(... |
5fba301cf0d3adcd8bc9f27d223e8d70c8569dc1e5aacbd8f80467cf5c6df658 | def __init__(self, model_fn=None, model_dir=None, config=None, params=None, feature_engineering_fn=None):
"Constructs an `Estimator` instance.\n\n Args:\n model_fn: Model function. Follows the signature:\n * Args:\n * `features` are single `Tensor` or `dict` of `Tensor`s\n (d... | Constructs an `Estimator` instance.
Args:
model_fn: Model function. Follows the signature:
* Args:
* `features` are single `Tensor` or `dict` of `Tensor`s
(depending on data passed to `fit`),
* `labels` are `Tensor` or `dict` of `Tensor`s (for multi-head
models). If mode is ... | tensorflow/contrib/learn/python/learn/estimators/estimator.py | __init__ | PedroLelis/tensorflow | 1 | python | def __init__(self, model_fn=None, model_dir=None, config=None, params=None, feature_engineering_fn=None):
"Constructs an `Estimator` instance.\n\n Args:\n model_fn: Model function. Follows the signature:\n * Args:\n * `features` are single `Tensor` or `dict` of `Tensor`s\n (d... | def __init__(self, model_fn=None, model_dir=None, config=None, params=None, feature_engineering_fn=None):
"Constructs an `Estimator` instance.\n\n Args:\n model_fn: Model function. Follows the signature:\n * Args:\n * `features` are single `Tensor` or `dict` of `Tensor`s\n (d... |
76e9ac00d6e695f00e53470ececca4a51de3306e73a6ce9f6c8ef6ee1c52f4b6 | def _call_model_fn(self, features, labels, mode):
'Calls model function with support of 2, 3 or 4 arguments.\n\n Args:\n features: features dict.\n labels: labels dict.\n mode: ModeKeys\n\n Returns:\n A `ModelFnOps` object. If model_fn returns a tuple, wraps them up in a\n `ModelFnOps... | Calls model function with support of 2, 3 or 4 arguments.
Args:
features: features dict.
labels: labels dict.
mode: ModeKeys
Returns:
A `ModelFnOps` object. If model_fn returns a tuple, wraps them up in a
`ModelFnOps` object.
Raises:
ValueError: if model_fn returns invalid objects. | tensorflow/contrib/learn/python/learn/estimators/estimator.py | _call_model_fn | PedroLelis/tensorflow | 1 | python | def _call_model_fn(self, features, labels, mode):
'Calls model function with support of 2, 3 or 4 arguments.\n\n Args:\n features: features dict.\n labels: labels dict.\n mode: ModeKeys\n\n Returns:\n A `ModelFnOps` object. If model_fn returns a tuple, wraps them up in a\n `ModelFnOps... | def _call_model_fn(self, features, labels, mode):
'Calls model function with support of 2, 3 or 4 arguments.\n\n Args:\n features: features dict.\n labels: labels dict.\n mode: ModeKeys\n\n Returns:\n A `ModelFnOps` object. If model_fn returns a tuple, wraps them up in a\n `ModelFnOps... |
64226145ac77bda4c279742eb2fefd2ac471d72659ab368d38196bfbaf9ef6be | def _get_train_ops(self, features, labels):
'Method that builds model graph and returns trainer ops.\n\n Expected to be overriden by sub-classes that require custom support.\n This implementation uses `model_fn` passed as parameter to constructor to\n build model.\n\n Args:\n features: `Tensor` or ... | Method that builds model graph and returns trainer ops.
Expected to be overriden by sub-classes that require custom support.
This implementation uses `model_fn` passed as parameter to constructor to
build model.
Args:
features: `Tensor` or `dict` of `Tensor` objects.
labels: `Tensor` or `dict` of `Tensor` objects... | tensorflow/contrib/learn/python/learn/estimators/estimator.py | _get_train_ops | PedroLelis/tensorflow | 1 | python | def _get_train_ops(self, features, labels):
'Method that builds model graph and returns trainer ops.\n\n Expected to be overriden by sub-classes that require custom support.\n This implementation uses `model_fn` passed as parameter to constructor to\n build model.\n\n Args:\n features: `Tensor` or ... | def _get_train_ops(self, features, labels):
'Method that builds model graph and returns trainer ops.\n\n Expected to be overriden by sub-classes that require custom support.\n This implementation uses `model_fn` passed as parameter to constructor to\n build model.\n\n Args:\n features: `Tensor` or ... |
25815dd813d1eef73cae50461f4d41e14f6081b4408e0be28c168e12676a59fb | def _get_eval_ops(self, features, labels, metrics):
"Method that builds model graph and returns evaluation ops.\n\n Expected to be overriden by sub-classes that require custom support.\n This implementation uses `model_fn` passed as parameter to constructor to\n build model.\n\n Args:\n features: `... | Method that builds model graph and returns evaluation ops.
Expected to be overriden by sub-classes that require custom support.
This implementation uses `model_fn` passed as parameter to constructor to
build model.
Args:
features: `Tensor` or `dict` of `Tensor` objects.
labels: `Tensor` or `dict` of `Tensor` obje... | tensorflow/contrib/learn/python/learn/estimators/estimator.py | _get_eval_ops | PedroLelis/tensorflow | 1 | python | def _get_eval_ops(self, features, labels, metrics):
"Method that builds model graph and returns evaluation ops.\n\n Expected to be overriden by sub-classes that require custom support.\n This implementation uses `model_fn` passed as parameter to constructor to\n build model.\n\n Args:\n features: `... | def _get_eval_ops(self, features, labels, metrics):
"Method that builds model graph and returns evaluation ops.\n\n Expected to be overriden by sub-classes that require custom support.\n This implementation uses `model_fn` passed as parameter to constructor to\n build model.\n\n Args:\n features: `... |
8d13f19a35f3de85f14451421e48102a6481d9ec56df119acdaddc8dc2dfcddb | def _get_predict_ops(self, features):
'Method that builds model graph and returns prediction ops.\n\n Expected to be overriden by sub-classes that require custom support.\n This implementation uses `model_fn` passed as parameter to constructor to\n build model.\n\n Args:\n features: `Tensor` or `di... | Method that builds model graph and returns prediction ops.
Expected to be overriden by sub-classes that require custom support.
This implementation uses `model_fn` passed as parameter to constructor to
build model.
Args:
features: `Tensor` or `dict` of `Tensor` objects.
Returns:
`ModelFnOps` object. | tensorflow/contrib/learn/python/learn/estimators/estimator.py | _get_predict_ops | PedroLelis/tensorflow | 1 | python | def _get_predict_ops(self, features):
'Method that builds model graph and returns prediction ops.\n\n Expected to be overriden by sub-classes that require custom support.\n This implementation uses `model_fn` passed as parameter to constructor to\n build model.\n\n Args:\n features: `Tensor` or `di... | def _get_predict_ops(self, features):
'Method that builds model graph and returns prediction ops.\n\n Expected to be overriden by sub-classes that require custom support.\n This implementation uses `model_fn` passed as parameter to constructor to\n build model.\n\n Args:\n features: `Tensor` or `di... |
54713279f7b567d4b275ce70fcfb3b9fc1be225c85d554b1b54545b97f64f0ee | def setUp(self):
'\n Set up the app for following tests\n '
settings.DEBUG = True
call_command('init_proj_config')
self.factory = RequestFactory()
data = {'access_token': 'myaccesstoken', 'refresh_token': 'bar', 'expires_in': 36000}
self.oh_member = OpenHumansMember.create(oh_id='1... | Set up the app for following tests | main/tests/tests_management.py | setUp | jhdulaney/oh-ubiome-source | 0 | python | def setUp(self):
'\n \n '
settings.DEBUG = True
call_command('init_proj_config')
self.factory = RequestFactory()
data = {'access_token': 'myaccesstoken', 'refresh_token': 'bar', 'expires_in': 36000}
self.oh_member = OpenHumansMember.create(oh_id='1234', data=data)
self.oh_membe... | def setUp(self):
'\n \n '
settings.DEBUG = True
call_command('init_proj_config')
self.factory = RequestFactory()
data = {'access_token': 'myaccesstoken', 'refresh_token': 'bar', 'expires_in': 36000}
self.oh_member = OpenHumansMember.create(oh_id='1234', data=data)
self.oh_membe... |
b3889f8804e41b8469f84c1e9201fd6e6f510786cf7a8c532fb26b8bbfd94a61 | def __init__(self, class_size, pretrained_name='bert-base-chinese'):
'\n Args: \n class_size :指定分类模型的最终类别数目,以确定线性分类器的映射维度\n pretrained_name :用以指定bert的预训练模型\n '
super(BertSST2Model, self).__init__()
self.bert = BertModel.from_pretrained(pretrained_name, return_dict=True)
... | Args:
class_size :指定分类模型的最终类别数目,以确定线性分类器的映射维度
pretrained_name :用以指定bert的预训练模型 | bert-sst2/bert_sst2.py | __init__ | yyxx1997/pytorch | 1 | python | def __init__(self, class_size, pretrained_name='bert-base-chinese'):
'\n Args: \n class_size :指定分类模型的最终类别数目,以确定线性分类器的映射维度\n pretrained_name :用以指定bert的预训练模型\n '
super(BertSST2Model, self).__init__()
self.bert = BertModel.from_pretrained(pretrained_name, return_dict=True)
... | def __init__(self, class_size, pretrained_name='bert-base-chinese'):
'\n Args: \n class_size :指定分类模型的最终类别数目,以确定线性分类器的映射维度\n pretrained_name :用以指定bert的预训练模型\n '
super(BertSST2Model, self).__init__()
self.bert = BertModel.from_pretrained(pretrained_name, return_dict=True)
... |
bf8900b3df1a80eb91154514da71eae3fe8190390dbb2405bf80238ec1ba2cf3 | def zipdir(dirpath, zipfileobj):
'does the work of writing data into our zipfile'
for (root, dirs, files) in os.walk(dirpath):
for file in files:
print(os.path.join(root, file))
zipfileobj.write(os.path.join(root, file))
return None | does the work of writing data into our zipfile | ZipFileLearn/zip.file.py | zipdir | subash-kc/2022-01-04-Python | 1 | python | def zipdir(dirpath, zipfileobj):
for (root, dirs, files) in os.walk(dirpath):
for file in files:
print(os.path.join(root, file))
zipfileobj.write(os.path.join(root, file))
return None | def zipdir(dirpath, zipfileobj):
for (root, dirs, files) in os.walk(dirpath):
for file in files:
print(os.path.join(root, file))
zipfileobj.write(os.path.join(root, file))
return None<|docstring|>does the work of writing data into our zipfile<|endoftext|> |
6a59f3a2211627bbb077fcbcd3dcecefe9d017b78ab3aa0a4532bcaafa0e1470 | def main():
'called at runtime'
dirpath = input('What directory are we archiving today? ')
if os.path.isdir(dirpath):
zippedfn = input('What should we call the finished archive? ')
with zipfile.ZipFile(zippedfn, 'w', zipfile.ZIP_DEFLATED) as zipfileobj:
zipdir(dirpath, zipfileobj... | called at runtime | ZipFileLearn/zip.file.py | main | subash-kc/2022-01-04-Python | 1 | python | def main():
dirpath = input('What directory are we archiving today? ')
if os.path.isdir(dirpath):
zippedfn = input('What should we call the finished archive? ')
with zipfile.ZipFile(zippedfn, 'w', zipfile.ZIP_DEFLATED) as zipfileobj:
zipdir(dirpath, zipfileobj)
else:
... | def main():
dirpath = input('What directory are we archiving today? ')
if os.path.isdir(dirpath):
zippedfn = input('What should we call the finished archive? ')
with zipfile.ZipFile(zippedfn, 'w', zipfile.ZIP_DEFLATED) as zipfileobj:
zipdir(dirpath, zipfileobj)
else:
... |
74023bb7f4f9ff6f5dfc7c79f0ba28845f0240641efd3e218ab2ea62619c9856 | @grok.adapter(icemac.addressbook.interfaces.IAddressBook)
@grok.implementer(icemac.ab.calendar.interfaces.ICalendar)
def calendar(address_book):
'Adapt the event to its calendar.'
return address_book.calendar | Adapt the event to its calendar. | src/icemac/ab/calendar/calendar.py | calendar | icemac/icemac.ab.calendar | 1 | python | @grok.adapter(icemac.addressbook.interfaces.IAddressBook)
@grok.implementer(icemac.ab.calendar.interfaces.ICalendar)
def calendar(address_book):
return address_book.calendar | @grok.adapter(icemac.addressbook.interfaces.IAddressBook)
@grok.implementer(icemac.ab.calendar.interfaces.ICalendar)
def calendar(address_book):
return address_book.calendar<|docstring|>Adapt the event to its calendar.<|endoftext|> |
41b8dc33141fd7e14e0e4d7e2a866806515c314a9243437ca507a7e27d9da300 | def get_events_for_month(self, month, timezone=None):
'Get all events which belong to `month`.'
timezone = self._timezone_name_to_timezone(timezone)
midnight = time(0, 0, 0)
start = timezone.localize(datetime.combine(month.firstOfMonth(), midnight))
end = timezone.localize(datetime.combine((month + ... | Get all events which belong to `month`. | src/icemac/ab/calendar/calendar.py | get_events_for_month | icemac/icemac.ab.calendar | 1 | python | def get_events_for_month(self, month, timezone=None):
timezone = self._timezone_name_to_timezone(timezone)
midnight = time(0, 0, 0)
start = timezone.localize(datetime.combine(month.firstOfMonth(), midnight))
end = timezone.localize(datetime.combine((month + 1).firstOfMonth(), midnight))
return ... | def get_events_for_month(self, month, timezone=None):
timezone = self._timezone_name_to_timezone(timezone)
midnight = time(0, 0, 0)
start = timezone.localize(datetime.combine(month.firstOfMonth(), midnight))
end = timezone.localize(datetime.combine((month + 1).firstOfMonth(), midnight))
return ... |
acfbe1d21507f3583b2204d5a4a8bb6f6ffc292dc00916a6601653aab672d2ce | def get_events(self, start, end, timezone=None, categories=[]):
'Get all events between `start` and `end` with one of `categories`.\n\n `start` and `end` have to be datetime objects.\n `categories` is a list of category titles.\n `start` is part of the interval, but `end` is not.\n '
... | Get all events between `start` and `end` with one of `categories`.
`start` and `end` have to be datetime objects.
`categories` is a list of category titles.
`start` is part of the interval, but `end` is not. | src/icemac/ab/calendar/calendar.py | get_events | icemac/icemac.ab.calendar | 1 | python | def get_events(self, start, end, timezone=None, categories=[]):
'Get all events between `start` and `end` with one of `categories`.\n\n `start` and `end` have to be datetime objects.\n `categories` is a list of category titles.\n `start` is part of the interval, but `end` is not.\n '
... | def get_events(self, start, end, timezone=None, categories=[]):
'Get all events between `start` and `end` with one of `categories`.\n\n `start` and `end` have to be datetime objects.\n `categories` is a list of category titles.\n `start` is part of the interval, but `end` is not.\n '
... |
52c63c51a30ea6dbe382d5d96096a1466698d295ee10c3dbb7725dff9d6f6ce6 | def _get_events(self, start, end, timezone, categories):
'Get all events between `start` and `end`.\n\n `start` is part of the interval, but `end` is not.\n `categories` is a list of category titles.\n Only return events of the given `categories`.\n If `categories` is an empty list, do n... | Get all events between `start` and `end`.
`start` is part of the interval, but `end` is not.
`categories` is a list of category titles.
Only return events of the given `categories`.
If `categories` is an empty list, do not restrict by category. | src/icemac/ab/calendar/calendar.py | _get_events | icemac/icemac.ab.calendar | 1 | python | def _get_events(self, start, end, timezone, categories):
'Get all events between `start` and `end`.\n\n `start` is part of the interval, but `end` is not.\n `categories` is a list of category titles.\n Only return events of the given `categories`.\n If `categories` is an empty list, do n... | def _get_events(self, start, end, timezone, categories):
'Get all events between `start` and `end`.\n\n `start` is part of the interval, but `end` is not.\n `categories` is a list of category titles.\n Only return events of the given `categories`.\n If `categories` is an empty list, do n... |
88d47993df8166fb81148b98c9791cf937cfc548951053034a3b3b6334c04751 | def _timezone_name_to_timezone(self, name):
'Return a timezone object. If `name` is None, return UTC.'
if (name is None):
timezone = pytz.utc
else:
timezone = pytz.timezone(name)
return timezone | Return a timezone object. If `name` is None, return UTC. | src/icemac/ab/calendar/calendar.py | _timezone_name_to_timezone | icemac/icemac.ab.calendar | 1 | python | def _timezone_name_to_timezone(self, name):
if (name is None):
timezone = pytz.utc
else:
timezone = pytz.timezone(name)
return timezone | def _timezone_name_to_timezone(self, name):
if (name is None):
timezone = pytz.utc
else:
timezone = pytz.timezone(name)
return timezone<|docstring|>Return a timezone object. If `name` is None, return UTC.<|endoftext|> |
58f4030ca60fd5b994ae499595638151946d726f4ed71f2703a3229c94794698 | def cancel_scheduled_docker_run_state_by_id(self, dataset_id, scheduled_id, **kwargs):
'cancel_scheduled_docker_run_state_by_id # noqa: E501\n\n Cancel a scheduled run. This will fail if the state of the scheduled run is no longer OPEN (e.g when it is LOCKED) # noqa: E501\n This method makes a sync... | cancel_scheduled_docker_run_state_by_id # noqa: E501
Cancel a scheduled run. This will fail if the state of the scheduled run is no longer OPEN (e.g when it is LOCKED) # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = ... | lightly/openapi_generated/swagger_client/api/docker_api.py | cancel_scheduled_docker_run_state_by_id | dczifra/lightly | 1 | python | def cancel_scheduled_docker_run_state_by_id(self, dataset_id, scheduled_id, **kwargs):
'cancel_scheduled_docker_run_state_by_id # noqa: E501\n\n Cancel a scheduled run. This will fail if the state of the scheduled run is no longer OPEN (e.g when it is LOCKED) # noqa: E501\n This method makes a sync... | def cancel_scheduled_docker_run_state_by_id(self, dataset_id, scheduled_id, **kwargs):
'cancel_scheduled_docker_run_state_by_id # noqa: E501\n\n Cancel a scheduled run. This will fail if the state of the scheduled run is no longer OPEN (e.g when it is LOCKED) # noqa: E501\n This method makes a sync... |
63f06886db2cae355b9ac9ebe59127fa260ea0bdc3845e3822c4e25b1a543fdb | def cancel_scheduled_docker_run_state_by_id_with_http_info(self, dataset_id, scheduled_id, **kwargs):
'cancel_scheduled_docker_run_state_by_id # noqa: E501\n\n Cancel a scheduled run. This will fail if the state of the scheduled run is no longer OPEN (e.g when it is LOCKED) # noqa: E501\n This meth... | cancel_scheduled_docker_run_state_by_id # noqa: E501
Cancel a scheduled run. This will fail if the state of the scheduled run is no longer OPEN (e.g when it is LOCKED) # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = ... | lightly/openapi_generated/swagger_client/api/docker_api.py | cancel_scheduled_docker_run_state_by_id_with_http_info | dczifra/lightly | 1 | python | def cancel_scheduled_docker_run_state_by_id_with_http_info(self, dataset_id, scheduled_id, **kwargs):
'cancel_scheduled_docker_run_state_by_id # noqa: E501\n\n Cancel a scheduled run. This will fail if the state of the scheduled run is no longer OPEN (e.g when it is LOCKED) # noqa: E501\n This meth... | def cancel_scheduled_docker_run_state_by_id_with_http_info(self, dataset_id, scheduled_id, **kwargs):
'cancel_scheduled_docker_run_state_by_id # noqa: E501\n\n Cancel a scheduled run. This will fail if the state of the scheduled run is no longer OPEN (e.g when it is LOCKED) # noqa: E501\n This meth... |
0dfec1952a75ff80e284e0469d03da308ea9a9ec0291f785f7ec7a93034d3419 | def create_docker_run(self, body, **kwargs):
'create_docker_run # noqa: E501\n\n Creates a new docker run database entry. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.create... | create_docker_run # noqa: E501
Creates a new docker run database entry. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_docker_run(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:par... | lightly/openapi_generated/swagger_client/api/docker_api.py | create_docker_run | dczifra/lightly | 1 | python | def create_docker_run(self, body, **kwargs):
'create_docker_run # noqa: E501\n\n Creates a new docker run database entry. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.create... | def create_docker_run(self, body, **kwargs):
'create_docker_run # noqa: E501\n\n Creates a new docker run database entry. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.create... |
222489d641c656861048e0a89864bda8012df7981ef1d8d0f7c11612a92329a6 | def create_docker_run_with_http_info(self, body, **kwargs):
'create_docker_run # noqa: E501\n\n Creates a new docker run database entry. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thre... | create_docker_run # noqa: E501
Creates a new docker run database entry. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_docker_run_with_http_info(body, async_req=True)
>>> result = thread.get()
:param asyn... | lightly/openapi_generated/swagger_client/api/docker_api.py | create_docker_run_with_http_info | dczifra/lightly | 1 | python | def create_docker_run_with_http_info(self, body, **kwargs):
'create_docker_run # noqa: E501\n\n Creates a new docker run database entry. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thre... | def create_docker_run_with_http_info(self, body, **kwargs):
'create_docker_run # noqa: E501\n\n Creates a new docker run database entry. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thre... |
ab5bed2ce416023a8d07d7ffdc8c6809ecf0331897fb096757aa563733192bef | def create_docker_run_scheduled_by_dataset_id(self, body, dataset_id, **kwargs):
"create_docker_run_scheduled_by_dataset_id # noqa: E501\n\n Schedule a docker run by dataset id. With docker runs it's possible to process unlabeled images from a datasource and use active learning to select the most relevant s... | create_docker_run_scheduled_by_dataset_id # noqa: E501
Schedule a docker run by dataset id. With docker runs it's possible to process unlabeled images from a datasource and use active learning to select the most relevant samples for further processing and visualization in the web app # noqa: E501
This method makes ... | lightly/openapi_generated/swagger_client/api/docker_api.py | create_docker_run_scheduled_by_dataset_id | dczifra/lightly | 1 | python | def create_docker_run_scheduled_by_dataset_id(self, body, dataset_id, **kwargs):
"create_docker_run_scheduled_by_dataset_id # noqa: E501\n\n Schedule a docker run by dataset id. With docker runs it's possible to process unlabeled images from a datasource and use active learning to select the most relevant s... | def create_docker_run_scheduled_by_dataset_id(self, body, dataset_id, **kwargs):
"create_docker_run_scheduled_by_dataset_id # noqa: E501\n\n Schedule a docker run by dataset id. With docker runs it's possible to process unlabeled images from a datasource and use active learning to select the most relevant s... |
23edf72cc01bc8915aeb6a9f757ec022c772285a65faf7a151ffddb4d02ed633 | def create_docker_run_scheduled_by_dataset_id_with_http_info(self, body, dataset_id, **kwargs):
"create_docker_run_scheduled_by_dataset_id # noqa: E501\n\n Schedule a docker run by dataset id. With docker runs it's possible to process unlabeled images from a datasource and use active learning to select the ... | create_docker_run_scheduled_by_dataset_id # noqa: E501
Schedule a docker run by dataset id. With docker runs it's possible to process unlabeled images from a datasource and use active learning to select the most relevant samples for further processing and visualization in the web app # noqa: E501
This method makes ... | lightly/openapi_generated/swagger_client/api/docker_api.py | create_docker_run_scheduled_by_dataset_id_with_http_info | dczifra/lightly | 1 | python | def create_docker_run_scheduled_by_dataset_id_with_http_info(self, body, dataset_id, **kwargs):
"create_docker_run_scheduled_by_dataset_id # noqa: E501\n\n Schedule a docker run by dataset id. With docker runs it's possible to process unlabeled images from a datasource and use active learning to select the ... | def create_docker_run_scheduled_by_dataset_id_with_http_info(self, body, dataset_id, **kwargs):
"create_docker_run_scheduled_by_dataset_id # noqa: E501\n\n Schedule a docker run by dataset id. With docker runs it's possible to process unlabeled images from a datasource and use active learning to select the ... |
bade6b664060137cb451bdd312c98e712fa298154b4660a223d8f4d6fdde41cf | def create_docker_worker_config(self, body, **kwargs):
'create_docker_worker_config # noqa: E501\n\n Creates a docker worker configuration. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> t... | create_docker_worker_config # noqa: E501
Creates a docker worker configuration. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_docker_worker_config(body, async_req=True)
>>> result = thread.get()
:param a... | lightly/openapi_generated/swagger_client/api/docker_api.py | create_docker_worker_config | dczifra/lightly | 1 | python | def create_docker_worker_config(self, body, **kwargs):
'create_docker_worker_config # noqa: E501\n\n Creates a docker worker configuration. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> t... | def create_docker_worker_config(self, body, **kwargs):
'create_docker_worker_config # noqa: E501\n\n Creates a docker worker configuration. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> t... |
846afe5b9ea502b855be42e89dce05b54dc015f7370d2ed89ebb40e9d605851e | def create_docker_worker_config_with_http_info(self, body, **kwargs):
'create_docker_worker_config # noqa: E501\n\n Creates a docker worker configuration. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True... | create_docker_worker_config # noqa: E501
Creates a docker worker configuration. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_docker_worker_config_with_http_info(body, async_req=True)
>>> result = thread.... | lightly/openapi_generated/swagger_client/api/docker_api.py | create_docker_worker_config_with_http_info | dczifra/lightly | 1 | python | def create_docker_worker_config_with_http_info(self, body, **kwargs):
'create_docker_worker_config # noqa: E501\n\n Creates a docker worker configuration. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True... | def create_docker_worker_config_with_http_info(self, body, **kwargs):
'create_docker_worker_config # noqa: E501\n\n Creates a docker worker configuration. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.