body stringlengths 26 98.2k | body_hash int64 -9,222,864,604,528,158,000 9,221,803,474B | docstring stringlengths 1 16.8k | path stringlengths 5 230 | name stringlengths 1 96 | repository_name stringlengths 7 89 | lang stringclasses 1
value | body_without_docstring stringlengths 20 98.2k |
|---|---|---|---|---|---|---|---|
def build_model(self, norm=True, act='relu'):
'Build DCE using the initialized attributes\n\n Args:\n norm: boolean, wheher to add a normalization layer at the begining\n of the autoencoder\n act: string, keras activation function name for autoencoder\n '
aut... | -1,438,000,602,470,540,500 | Build DCE using the initialized attributes
Args:
norm: boolean, wheher to add a normalization layer at the begining
of the autoencoder
act: string, keras activation function name for autoencoder | deepchembed/dce.py | build_model | chembed/DeepChEmbed | python | def build_model(self, norm=True, act='relu'):
'Build DCE using the initialized attributes\n\n Args:\n norm: boolean, wheher to add a normalization layer at the begining\n of the autoencoder\n act: string, keras activation function name for autoencoder\n '
aut... |
def train_model(self, data_train, labels_train=None, data_test=None, labels_test=None, verbose=1, compiled=False, clustering_loss='kld', decoder_loss='mse', clustering_loss_weight=0.5, hardening_order=1, hardening_strength=2.0, compiled=False, optimizer='adam', lr=0.001, decay=0.0):
'Train DCE Model:\n\n ... | -9,053,447,958,165,298,000 | Train DCE Model:
If labels_train are not present, train DCE model in a unsupervised
learning process; otherwise, train DCE model in a supervised learning
process.
Args:
data_train: input training data
labels_train: true labels of traning data
data_test: input test data
labels_test: true lables of ... | deepchembed/dce.py | train_model | chembed/DeepChEmbed | python | def train_model(self, data_train, labels_train=None, data_test=None, labels_test=None, verbose=1, compiled=False, clustering_loss='kld', decoder_loss='mse', clustering_loss_weight=0.5, hardening_order=1, hardening_strength=2.0, compiled=False, optimizer='adam', lr=0.001, decay=0.0):
'Train DCE Model:\n\n ... |
@staticmethod
def hardening(q, h_func, stength):
'hardening distribution P and return Q\n\n Args:\n q: input distributions.\n h_func: input harderning function.\n strength: hardening strength.\n\n returns:\n p: hardened and normatlized distributions.\n\n ... | 4,162,263,595,985,963,500 | hardening distribution P and return Q
Args:
q: input distributions.
h_func: input harderning function.
strength: hardening strength.
returns:
p: hardened and normatlized distributions. | deepchembed/dce.py | hardening | chembed/DeepChEmbed | python | @staticmethod
def hardening(q, h_func, stength):
'hardening distribution P and return Q\n\n Args:\n q: input distributions.\n h_func: input harderning function.\n strength: hardening strength.\n\n returns:\n p: hardened and normatlized distributions.\n\n ... |
def authenticate_active(self, request, principal, auth, life=None, sign=True, skip_handling_check=False, *args, **kwargs):
"Generate a WLS 'success' response based on interaction with the user\n\n This function creates a WLS response specifying that the principal was\n authenticated based on 'fresh' i... | 8,779,146,282,649,714,000 | Generate a WLS 'success' response based on interaction with the user
This function creates a WLS response specifying that the principal was
authenticated based on 'fresh' interaction with the user (e.g. input of
a username and password).
Args:
request (AuthRequest): the original WAA request
principal (AuthPri... | ucam_wls/context.py | authenticate_active | edwinbalani/ucam-wls | python | def authenticate_active(self, request, principal, auth, life=None, sign=True, skip_handling_check=False, *args, **kwargs):
"Generate a WLS 'success' response based on interaction with the user\n\n This function creates a WLS response specifying that the principal was\n authenticated based on 'fresh' i... |
def authenticate_passive(self, request, principal, sso=[], sign=True, skip_handling_check=False, *args, **kwargs):
"Generate a WLS 'success' response based on a pre-existing identity\n\n This function creates a WLS response specifying that the principal was\n authenticated based on previous successful... | 1,335,896,058,374,553,300 | Generate a WLS 'success' response based on a pre-existing identity
This function creates a WLS response specifying that the principal was
authenticated based on previous successful authentication (e.g. an
existing WLS session cookie).
Args:
request (AuthRequest): the original WAA request
principal (AuthPrinci... | ucam_wls/context.py | authenticate_passive | edwinbalani/ucam-wls | python | def authenticate_passive(self, request, principal, sso=[], sign=True, skip_handling_check=False, *args, **kwargs):
"Generate a WLS 'success' response based on a pre-existing identity\n\n This function creates a WLS response specifying that the principal was\n authenticated based on previous successful... |
def generate_failure(self, code, request, msg='', sign=True, skip_handling_check=False, *args, **kwargs):
"Generate a response indicating failure.\n\n This is to be used in all cases where the outcome of user interaction\n is not success. This function will refuse to handle a request where\n t... | -3,337,601,949,590,731,300 | Generate a response indicating failure.
This is to be used in all cases where the outcome of user interaction
is not success. This function will refuse to handle a request where
the 'fail' parameter is 'yes' (in which case the WLS must not redirect
back to the WAA).
Args:
code (int): the response status code. V... | ucam_wls/context.py | generate_failure | edwinbalani/ucam-wls | python | def generate_failure(self, code, request, msg=, sign=True, skip_handling_check=False, *args, **kwargs):
"Generate a response indicating failure.\n\n This is to be used in all cases where the outcome of user interaction\n is not success. This function will refuse to handle a request where\n the... |
def __init__(__self__, *, enable_magnetic_store_writes: Optional[bool]=None, magnetic_store_rejected_data_location: Optional['outputs.TableMagneticStoreWritePropertiesMagneticStoreRejectedDataLocation']=None):
"\n :param bool enable_magnetic_store_writes: A flag to enable magnetic store writes.\n :par... | 2,888,393,677,886,899,000 | :param bool enable_magnetic_store_writes: A flag to enable magnetic store writes.
:param 'TableMagneticStoreWritePropertiesMagneticStoreRejectedDataLocationArgs' magnetic_store_rejected_data_location: The location to write error reports for records rejected asynchronously during magnetic store writes. See Magnetic Stor... | sdk/python/pulumi_aws/timestreamwrite/outputs.py | __init__ | chivandikwa/pulumi-aws | python | def __init__(__self__, *, enable_magnetic_store_writes: Optional[bool]=None, magnetic_store_rejected_data_location: Optional['outputs.TableMagneticStoreWritePropertiesMagneticStoreRejectedDataLocation']=None):
"\n :param bool enable_magnetic_store_writes: A flag to enable magnetic store writes.\n :par... |
@property
@pulumi.getter(name='enableMagneticStoreWrites')
def enable_magnetic_store_writes(self) -> Optional[bool]:
'\n A flag to enable magnetic store writes.\n '
return pulumi.get(self, 'enable_magnetic_store_writes') | -2,718,757,825,877,902,300 | A flag to enable magnetic store writes. | sdk/python/pulumi_aws/timestreamwrite/outputs.py | enable_magnetic_store_writes | chivandikwa/pulumi-aws | python | @property
@pulumi.getter(name='enableMagneticStoreWrites')
def enable_magnetic_store_writes(self) -> Optional[bool]:
'\n \n '
return pulumi.get(self, 'enable_magnetic_store_writes') |
@property
@pulumi.getter(name='magneticStoreRejectedDataLocation')
def magnetic_store_rejected_data_location(self) -> Optional['outputs.TableMagneticStoreWritePropertiesMagneticStoreRejectedDataLocation']:
'\n The location to write error reports for records rejected asynchronously during magnetic store write... | 7,316,370,310,385,799,000 | The location to write error reports for records rejected asynchronously during magnetic store writes. See Magnetic Store Rejected Data Location below for more details. | sdk/python/pulumi_aws/timestreamwrite/outputs.py | magnetic_store_rejected_data_location | chivandikwa/pulumi-aws | python | @property
@pulumi.getter(name='magneticStoreRejectedDataLocation')
def magnetic_store_rejected_data_location(self) -> Optional['outputs.TableMagneticStoreWritePropertiesMagneticStoreRejectedDataLocation']:
'\n \n '
return pulumi.get(self, 'magnetic_store_rejected_data_location') |
def __init__(__self__, *, s3_configuration: Optional['outputs.TableMagneticStoreWritePropertiesMagneticStoreRejectedDataLocationS3Configuration']=None):
"\n :param 'TableMagneticStoreWritePropertiesMagneticStoreRejectedDataLocationS3ConfigurationArgs' s3_configuration: Configuration of an S3 location to writ... | -6,933,671,522,388,319,000 | :param 'TableMagneticStoreWritePropertiesMagneticStoreRejectedDataLocationS3ConfigurationArgs' s3_configuration: Configuration of an S3 location to write error reports for records rejected, asynchronously, during magnetic store writes. See S3 Configuration below for more details. | sdk/python/pulumi_aws/timestreamwrite/outputs.py | __init__ | chivandikwa/pulumi-aws | python | def __init__(__self__, *, s3_configuration: Optional['outputs.TableMagneticStoreWritePropertiesMagneticStoreRejectedDataLocationS3Configuration']=None):
"\n \n "
if (s3_configuration is not None):
pulumi.set(__self__, 's3_configuration', s3_configuration) |
@property
@pulumi.getter(name='s3Configuration')
def s3_configuration(self) -> Optional['outputs.TableMagneticStoreWritePropertiesMagneticStoreRejectedDataLocationS3Configuration']:
'\n Configuration of an S3 location to write error reports for records rejected, asynchronously, during magnetic store writes. ... | 8,736,312,081,624,449,000 | Configuration of an S3 location to write error reports for records rejected, asynchronously, during magnetic store writes. See S3 Configuration below for more details. | sdk/python/pulumi_aws/timestreamwrite/outputs.py | s3_configuration | chivandikwa/pulumi-aws | python | @property
@pulumi.getter(name='s3Configuration')
def s3_configuration(self) -> Optional['outputs.TableMagneticStoreWritePropertiesMagneticStoreRejectedDataLocationS3Configuration']:
'\n \n '
return pulumi.get(self, 's3_configuration') |
def __init__(__self__, *, bucket_name: Optional[str]=None, encryption_option: Optional[str]=None, kms_key_id: Optional[str]=None, object_key_prefix: Optional[str]=None):
'\n :param str bucket_name: Bucket name of the customer S3 bucket.\n :param str encryption_option: Encryption option for the custome... | -8,271,482,238,891,445,000 | :param str bucket_name: Bucket name of the customer S3 bucket.
:param str encryption_option: Encryption option for the customer s3 location. Options are S3 server side encryption with an S3-managed key or KMS managed key. Valid values are `SSE_KMS` and `SSE_S3`.
:param str kms_key_id: KMS key arn for the customer s3 lo... | sdk/python/pulumi_aws/timestreamwrite/outputs.py | __init__ | chivandikwa/pulumi-aws | python | def __init__(__self__, *, bucket_name: Optional[str]=None, encryption_option: Optional[str]=None, kms_key_id: Optional[str]=None, object_key_prefix: Optional[str]=None):
'\n :param str bucket_name: Bucket name of the customer S3 bucket.\n :param str encryption_option: Encryption option for the custome... |
@property
@pulumi.getter(name='bucketName')
def bucket_name(self) -> Optional[str]:
'\n Bucket name of the customer S3 bucket.\n '
return pulumi.get(self, 'bucket_name') | 4,003,761,450,091,991 | Bucket name of the customer S3 bucket. | sdk/python/pulumi_aws/timestreamwrite/outputs.py | bucket_name | chivandikwa/pulumi-aws | python | @property
@pulumi.getter(name='bucketName')
def bucket_name(self) -> Optional[str]:
'\n \n '
return pulumi.get(self, 'bucket_name') |
@property
@pulumi.getter(name='encryptionOption')
def encryption_option(self) -> Optional[str]:
'\n Encryption option for the customer s3 location. Options are S3 server side encryption with an S3-managed key or KMS managed key. Valid values are `SSE_KMS` and `SSE_S3`.\n '
return pulumi.get(self, ... | 9,216,246,817,732,302,000 | Encryption option for the customer s3 location. Options are S3 server side encryption with an S3-managed key or KMS managed key. Valid values are `SSE_KMS` and `SSE_S3`. | sdk/python/pulumi_aws/timestreamwrite/outputs.py | encryption_option | chivandikwa/pulumi-aws | python | @property
@pulumi.getter(name='encryptionOption')
def encryption_option(self) -> Optional[str]:
'\n \n '
return pulumi.get(self, 'encryption_option') |
@property
@pulumi.getter(name='kmsKeyId')
def kms_key_id(self) -> Optional[str]:
'\n KMS key arn for the customer s3 location when encrypting with a KMS managed key.\n '
return pulumi.get(self, 'kms_key_id') | -4,133,450,127,578,844,700 | KMS key arn for the customer s3 location when encrypting with a KMS managed key. | sdk/python/pulumi_aws/timestreamwrite/outputs.py | kms_key_id | chivandikwa/pulumi-aws | python | @property
@pulumi.getter(name='kmsKeyId')
def kms_key_id(self) -> Optional[str]:
'\n \n '
return pulumi.get(self, 'kms_key_id') |
@property
@pulumi.getter(name='objectKeyPrefix')
def object_key_prefix(self) -> Optional[str]:
'\n Object key prefix for the customer S3 location.\n '
return pulumi.get(self, 'object_key_prefix') | -596,909,029,895,640,700 | Object key prefix for the customer S3 location. | sdk/python/pulumi_aws/timestreamwrite/outputs.py | object_key_prefix | chivandikwa/pulumi-aws | python | @property
@pulumi.getter(name='objectKeyPrefix')
def object_key_prefix(self) -> Optional[str]:
'\n \n '
return pulumi.get(self, 'object_key_prefix') |
def __init__(__self__, *, magnetic_store_retention_period_in_days: int, memory_store_retention_period_in_hours: int):
'\n :param int magnetic_store_retention_period_in_days: The duration for which data must be stored in the magnetic store. Minimum value of 1. Maximum value of 73000.\n :param int memor... | 1,808,947,756,490,085,000 | :param int magnetic_store_retention_period_in_days: The duration for which data must be stored in the magnetic store. Minimum value of 1. Maximum value of 73000.
:param int memory_store_retention_period_in_hours: The duration for which data must be stored in the memory store. Minimum value of 1. Maximum value of 8766. | sdk/python/pulumi_aws/timestreamwrite/outputs.py | __init__ | chivandikwa/pulumi-aws | python | def __init__(__self__, *, magnetic_store_retention_period_in_days: int, memory_store_retention_period_in_hours: int):
'\n :param int magnetic_store_retention_period_in_days: The duration for which data must be stored in the magnetic store. Minimum value of 1. Maximum value of 73000.\n :param int memor... |
@property
@pulumi.getter(name='magneticStoreRetentionPeriodInDays')
def magnetic_store_retention_period_in_days(self) -> int:
'\n The duration for which data must be stored in the magnetic store. Minimum value of 1. Maximum value of 73000.\n '
return pulumi.get(self, 'magnetic_store_retention_peri... | -3,694,460,775,966,215,000 | The duration for which data must be stored in the magnetic store. Minimum value of 1. Maximum value of 73000. | sdk/python/pulumi_aws/timestreamwrite/outputs.py | magnetic_store_retention_period_in_days | chivandikwa/pulumi-aws | python | @property
@pulumi.getter(name='magneticStoreRetentionPeriodInDays')
def magnetic_store_retention_period_in_days(self) -> int:
'\n \n '
return pulumi.get(self, 'magnetic_store_retention_period_in_days') |
@property
@pulumi.getter(name='memoryStoreRetentionPeriodInHours')
def memory_store_retention_period_in_hours(self) -> int:
'\n The duration for which data must be stored in the memory store. Minimum value of 1. Maximum value of 8766.\n '
return pulumi.get(self, 'memory_store_retention_period_in_h... | -7,752,533,847,161,990,000 | The duration for which data must be stored in the memory store. Minimum value of 1. Maximum value of 8766. | sdk/python/pulumi_aws/timestreamwrite/outputs.py | memory_store_retention_period_in_hours | chivandikwa/pulumi-aws | python | @property
@pulumi.getter(name='memoryStoreRetentionPeriodInHours')
def memory_store_retention_period_in_hours(self) -> int:
'\n \n '
return pulumi.get(self, 'memory_store_retention_period_in_hours') |
def __default_grid__(ax):
'This is a temporary function'
ax.grid(b=True, which='major', color='#000000', alpha=0.2, linestyle='-', linewidth=0.5)
ax.grid(b=True, which='minor', color='#000000', alpha=0.1, linestyle='-', linewidth=0.25)
ax.minorticks_on() | -2,463,206,208,069,694,000 | This is a temporary function | nicenquickplotlib/config_types.py | __default_grid__ | SengerM/nicenquickplotlib | python | def __default_grid__(ax):
ax.grid(b=True, which='major', color='#000000', alpha=0.2, linestyle='-', linewidth=0.5)
ax.grid(b=True, which='minor', color='#000000', alpha=0.1, linestyle='-', linewidth=0.25)
ax.minorticks_on() |
def load_data(filename: str) -> pd.DataFrame:
'\n Load city daily temperature dataset and preprocess data.\n Parameters\n ----------\n filename: str\n Path to house prices dataset\n\n Returns\n -------\n Design matrix and response vector (Temp)\n '
data = pd.read_csv(filename, par... | 9,173,056,866,655,160,000 | Load city daily temperature dataset and preprocess data.
Parameters
----------
filename: str
Path to house prices dataset
Returns
-------
Design matrix and response vector (Temp) | exercises/city_temperature_prediction.py | load_data | noamwino/IML.HUJI | python | def load_data(filename: str) -> pd.DataFrame:
'\n Load city daily temperature dataset and preprocess data.\n Parameters\n ----------\n filename: str\n Path to house prices dataset\n\n Returns\n -------\n Design matrix and response vector (Temp)\n '
data = pd.read_csv(filename, par... |
def question_2(data):
' Exploring data specifically in Israel '
data = data.copy()
data = data[(data['Country'] == 'Israel')]
data['Year'] = data['Year'].astype(str)
fig = px.scatter(data, x='DayOfYear', y='Temp', color='Year', width=1500, height=700, labels={'DayOfYear': 'Day of Year', 'Temp': 'Tem... | 543,939,310,610,351,000 | Exploring data specifically in Israel | exercises/city_temperature_prediction.py | question_2 | noamwino/IML.HUJI | python | def question_2(data):
' '
data = data.copy()
data = data[(data['Country'] == 'Israel')]
data['Year'] = data['Year'].astype(str)
fig = px.scatter(data, x='DayOfYear', y='Temp', color='Year', width=1500, height=700, labels={'DayOfYear': 'Day of Year', 'Temp': 'Temperature'}, title='Q2(1) The relation... |
def question_3(data):
' Exploring differences between countries'
agg_data_mean = data.groupby(['Country', 'Month']).mean().reset_index()
agg_data_std = data.groupby(['Country', 'Month']).std().reset_index()
fig = px.line(agg_data_mean, x='Month', y='Temp', color='Country', error_y=agg_data_std['Temp'], ... | -5,551,659,980,031,403,000 | Exploring differences between countries | exercises/city_temperature_prediction.py | question_3 | noamwino/IML.HUJI | python | def question_3(data):
' '
agg_data_mean = data.groupby(['Country', 'Month']).mean().reset_index()
agg_data_std = data.groupby(['Country', 'Month']).std().reset_index()
fig = px.line(agg_data_mean, x='Month', y='Temp', color='Country', error_y=agg_data_std['Temp'], width=1500, height=700, labels={'Temp':... |
def question_4(data):
' Fitting model for different values of `k` '
data = data[(data['Country'] == 'Israel')]
(train_X, train_y, test_X, test_y) = split_train_test(data['DayOfYear'], data['Temp'])
losses = np.array([])
for k in range(1, 11):
poly_fit = PolynomialFitting(k)
poly_fit.... | 5,774,251,136,083,118,000 | Fitting model for different values of `k` | exercises/city_temperature_prediction.py | question_4 | noamwino/IML.HUJI | python | def question_4(data):
' '
data = data[(data['Country'] == 'Israel')]
(train_X, train_y, test_X, test_y) = split_train_test(data['DayOfYear'], data['Temp'])
losses = np.array([])
for k in range(1, 11):
poly_fit = PolynomialFitting(k)
poly_fit.fit(train_X.to_numpy(), train_y.to_numpy(... |
def question_5(data):
' Evaluating fitted model on different countries '
data_israel = data[(data['Country'] == 'Israel')]
poly_fit = PolynomialFitting(k=5)
poly_fit.fit(data_israel['DayOfYear'], data_israel['Temp'])
other_countries = ['Jordan', 'South Africa', 'The Netherlands']
losses = np.arr... | 3,931,820,151,589,127,700 | Evaluating fitted model on different countries | exercises/city_temperature_prediction.py | question_5 | noamwino/IML.HUJI | python | def question_5(data):
' '
data_israel = data[(data['Country'] == 'Israel')]
poly_fit = PolynomialFitting(k=5)
poly_fit.fit(data_israel['DayOfYear'], data_israel['Temp'])
other_countries = ['Jordan', 'South Africa', 'The Netherlands']
losses = np.array([])
for country in other_countries:
... |
async def test_subquery_access(self):
'This test ensures that accessing a query does not modify it (#780)'
tournament_1 = (await Tournament.create(name='1'))
event_1 = (await Event.create(event_id=1, name='event 1', tournament=tournament_1))
event_2 = (await Event.create(event_id=2, name='event 2', tour... | 613,092,107,671,665,800 | This test ensures that accessing a query does not modify it (#780) | tests/test_queryset.py | test_subquery_access | spacemanspiff2007/tortoise-orm | python | async def test_subquery_access(self):
tournament_1 = (await Tournament.create(name='1'))
event_1 = (await Event.create(event_id=1, name='event 1', tournament=tournament_1))
event_2 = (await Event.create(event_id=2, name='event 2', tournament=tournament_1))
team_1 = (await Team.create(id=1, name='te... |
def t(eng, chinese):
"return English or Chinese text according to the user's browser language"
return (chinese if ('zh' in get_info().user_language) else eng) | 5,158,654,429,831,208,000 | return English or Chinese text according to the user's browser language | demos/output_usage.py | t | songshanyuwu/PyWebIO | python | def t(eng, chinese):
return (chinese if ('zh' in get_info().user_language) else eng) |
async def main():
'PyWebIO Output demo\n\n Demonstrate various output usage supported by PyWebIO.\n 演示PyWebIO输出模块的使用\n '
put_markdown(t('# PyWebIO Output demo\n \n You can get the source code of this demo in [here](https://github.com/wang0618/PyWebIO/blob/dev/demos/output_usage.py)\n \n Thi... | 3,378,511,886,882,203,600 | PyWebIO Output demo
Demonstrate various output usage supported by PyWebIO.
演示PyWebIO输出模块的使用 | demos/output_usage.py | main | songshanyuwu/PyWebIO | python | async def main():
'PyWebIO Output demo\n\n Demonstrate various output usage supported by PyWebIO.\n 演示PyWebIO输出模块的使用\n '
put_markdown(t('# PyWebIO Output demo\n \n You can get the source code of this demo in [here](https://github.com/wang0618/PyWebIO/blob/dev/demos/output_usage.py)\n \n Thi... |
def __call__(self, shape, dtype=None, **kwargs):
'Returns a tensor object initialized as specified by the initializer.\n\n Args:\n shape: Shape of the tensor.\n dtype: Optional dtype of the tensor.\n **kwargs: Additional keyword arguments.\n '
raise NotImplementedError | 7,005,630,701,422,536,000 | Returns a tensor object initialized as specified by the initializer.
Args:
shape: Shape of the tensor.
dtype: Optional dtype of the tensor.
**kwargs: Additional keyword arguments. | keras/initializers/initializers_v2.py | __call__ | StanislavParovoy/Keras | python | def __call__(self, shape, dtype=None, **kwargs):
'Returns a tensor object initialized as specified by the initializer.\n\n Args:\n shape: Shape of the tensor.\n dtype: Optional dtype of the tensor.\n **kwargs: Additional keyword arguments.\n '
raise NotImplementedError |
def get_config(self):
'Returns the configuration of the initializer as a JSON-serializable dict.\n\n Returns:\n A JSON-serializable Python dict.\n '
return {} | 6,964,281,744,853,564,000 | Returns the configuration of the initializer as a JSON-serializable dict.
Returns:
A JSON-serializable Python dict. | keras/initializers/initializers_v2.py | get_config | StanislavParovoy/Keras | python | def get_config(self):
'Returns the configuration of the initializer as a JSON-serializable dict.\n\n Returns:\n A JSON-serializable Python dict.\n '
return {} |
@classmethod
def from_config(cls, config):
'Instantiates an initializer from a configuration dictionary.\n\n Example:\n\n ```python\n initializer = RandomUniform(-1, 1)\n config = initializer.get_config()\n initializer = RandomUniform.from_config(config)\n ```\n\n Args:\n config: A Python ... | -3,684,884,346,167,467,500 | Instantiates an initializer from a configuration dictionary.
Example:
```python
initializer = RandomUniform(-1, 1)
config = initializer.get_config()
initializer = RandomUniform.from_config(config)
```
Args:
config: A Python dictionary, the output of `get_config`.
Returns:
A `tf.keras.initializers.Initializer` i... | keras/initializers/initializers_v2.py | from_config | StanislavParovoy/Keras | python | @classmethod
def from_config(cls, config):
'Instantiates an initializer from a configuration dictionary.\n\n Example:\n\n ```python\n initializer = RandomUniform(-1, 1)\n config = initializer.get_config()\n initializer = RandomUniform.from_config(config)\n ```\n\n Args:\n config: A Python ... |
def __call__(self, shape, dtype=None, **kwargs):
'Returns a tensor object initialized as specified by the initializer.\n\n Args:\n shape: Shape of the tensor.\n dtype: Optional dtype of the tensor. Only numeric or boolean dtypes are\n supported. If not specified, `tf.keras.backend.floatx()` is us... | 933,338,983,785,517,400 | Returns a tensor object initialized as specified by the initializer.
Args:
shape: Shape of the tensor.
dtype: Optional dtype of the tensor. Only numeric or boolean dtypes are
supported. If not specified, `tf.keras.backend.floatx()` is used,
which default to `float32` unless you configured it otherwise
(vi... | keras/initializers/initializers_v2.py | __call__ | StanislavParovoy/Keras | python | def __call__(self, shape, dtype=None, **kwargs):
'Returns a tensor object initialized as specified by the initializer.\n\n Args:\n shape: Shape of the tensor.\n dtype: Optional dtype of the tensor. Only numeric or boolean dtypes are\n supported. If not specified, `tf.keras.backend.floatx()` is us... |
def __call__(self, shape, dtype=None, **kwargs):
'Returns a tensor object initialized as specified by the initializer.\n\n Args:\n shape: Shape of the tensor.\n dtype: Optional dtype of the tensor. Only numeric or boolean dtypes are\n supported. If not specified, `tf.keras.backend.floatx()` is us... | 3,836,736,980,779,496,400 | Returns a tensor object initialized as specified by the initializer.
Args:
shape: Shape of the tensor.
dtype: Optional dtype of the tensor. Only numeric or boolean dtypes are
supported. If not specified, `tf.keras.backend.floatx()` is used,
which default to `float32` unless you configured it otherwise
(vi... | keras/initializers/initializers_v2.py | __call__ | StanislavParovoy/Keras | python | def __call__(self, shape, dtype=None, **kwargs):
'Returns a tensor object initialized as specified by the initializer.\n\n Args:\n shape: Shape of the tensor.\n dtype: Optional dtype of the tensor. Only numeric or boolean dtypes are\n supported. If not specified, `tf.keras.backend.floatx()` is us... |
def __call__(self, shape, dtype=None, **kwargs):
'Returns a tensor object initialized to `self.value`.\n\n Args:\n shape: Shape of the tensor.\n dtype: Optional dtype of the tensor. If not specified,\n `tf.keras.backend.floatx()` is used,\n which default to `float32` unless you configured i... | -4,842,611,882,655,564,000 | Returns a tensor object initialized to `self.value`.
Args:
shape: Shape of the tensor.
dtype: Optional dtype of the tensor. If not specified,
`tf.keras.backend.floatx()` is used,
which default to `float32` unless you configured it otherwise
(via `tf.keras.backend.set_floatx(float_dtype)`).
**kwargs: Add... | keras/initializers/initializers_v2.py | __call__ | StanislavParovoy/Keras | python | def __call__(self, shape, dtype=None, **kwargs):
'Returns a tensor object initialized to `self.value`.\n\n Args:\n shape: Shape of the tensor.\n dtype: Optional dtype of the tensor. If not specified,\n `tf.keras.backend.floatx()` is used,\n which default to `float32` unless you configured i... |
def __call__(self, shape, dtype=None, **kwargs):
'Returns a tensor object initialized as specified by the initializer.\n\n Args:\n shape: Shape of the tensor.\n dtype: Optional dtype of the tensor. Only floating point and integer\n types are supported. If not specified,\n `tf.keras.backend.... | 3,468,556,579,783,864,300 | Returns a tensor object initialized as specified by the initializer.
Args:
shape: Shape of the tensor.
dtype: Optional dtype of the tensor. Only floating point and integer
types are supported. If not specified,
`tf.keras.backend.floatx()` is used,
which default to `float32` unless you configured it otherw... | keras/initializers/initializers_v2.py | __call__ | StanislavParovoy/Keras | python | def __call__(self, shape, dtype=None, **kwargs):
'Returns a tensor object initialized as specified by the initializer.\n\n Args:\n shape: Shape of the tensor.\n dtype: Optional dtype of the tensor. Only floating point and integer\n types are supported. If not specified,\n `tf.keras.backend.... |
def __call__(self, shape, dtype=None, **kwargs):
'Returns a tensor object initialized to random normal values.\n\n Args:\n shape: Shape of the tensor.\n dtype: Optional dtype of the tensor. Only floating point types are\n supported. If not specified, `tf.keras.backend.floatx()` is used, which\n ... | 757,155,504,251,613,600 | Returns a tensor object initialized to random normal values.
Args:
shape: Shape of the tensor.
dtype: Optional dtype of the tensor. Only floating point types are
supported. If not specified, `tf.keras.backend.floatx()` is used, which
default to `float32` unless you configured it otherwise (via
`tf.kera... | keras/initializers/initializers_v2.py | __call__ | StanislavParovoy/Keras | python | def __call__(self, shape, dtype=None, **kwargs):
'Returns a tensor object initialized to random normal values.\n\n Args:\n shape: Shape of the tensor.\n dtype: Optional dtype of the tensor. Only floating point types are\n supported. If not specified, `tf.keras.backend.floatx()` is used, which\n ... |
def __call__(self, shape, dtype=None, **kwargs):
'Returns a tensor object initialized to random normal values (truncated).\n\n Args:\n shape: Shape of the tensor.\n dtype: Optional dtype of the tensor. Only floating point types are\n supported. If not specified, `tf.keras.backend.floatx()` is us... | 3,453,308,935,921,840,600 | Returns a tensor object initialized to random normal values (truncated).
Args:
shape: Shape of the tensor.
dtype: Optional dtype of the tensor. Only floating point types are
supported. If not specified, `tf.keras.backend.floatx()` is used, which
default to `float32` unless you configured it otherwise (via
... | keras/initializers/initializers_v2.py | __call__ | StanislavParovoy/Keras | python | def __call__(self, shape, dtype=None, **kwargs):
'Returns a tensor object initialized to random normal values (truncated).\n\n Args:\n shape: Shape of the tensor.\n dtype: Optional dtype of the tensor. Only floating point types are\n supported. If not specified, `tf.keras.backend.floatx()` is us... |
def __call__(self, shape, dtype=None, **kwargs):
'Returns a tensor object initialized as specified by the initializer.\n\n Args:\n shape: Shape of the tensor.\n dtype: Optional dtype of the tensor. Only floating point types are\n supported. If not specified, `tf.keras.backend.floatx()` is used, ... | 8,955,783,661,739,036,000 | Returns a tensor object initialized as specified by the initializer.
Args:
shape: Shape of the tensor.
dtype: Optional dtype of the tensor. Only floating point types are
supported. If not specified, `tf.keras.backend.floatx()` is used, which
default to `float32` unless you configured it otherwise (via
... | keras/initializers/initializers_v2.py | __call__ | StanislavParovoy/Keras | python | def __call__(self, shape, dtype=None, **kwargs):
'Returns a tensor object initialized as specified by the initializer.\n\n Args:\n shape: Shape of the tensor.\n dtype: Optional dtype of the tensor. Only floating point types are\n supported. If not specified, `tf.keras.backend.floatx()` is used, ... |
def __call__(self, shape, dtype=None, **kwargs):
'Returns a tensor object initialized to an orthogonal matrix.\n\n Args:\n shape: Shape of the tensor.\n dtype: Optional dtype of the tensor. Only floating point types are\n supported. If not specified, `tf.keras.backend.floatx()` is used,\n ... | 4,775,635,297,769,653,000 | Returns a tensor object initialized to an orthogonal matrix.
Args:
shape: Shape of the tensor.
dtype: Optional dtype of the tensor. Only floating point types are
supported. If not specified, `tf.keras.backend.floatx()` is used,
which default to `float32` unless you configured it otherwise
(via `tf.keras.... | keras/initializers/initializers_v2.py | __call__ | StanislavParovoy/Keras | python | def __call__(self, shape, dtype=None, **kwargs):
'Returns a tensor object initialized to an orthogonal matrix.\n\n Args:\n shape: Shape of the tensor.\n dtype: Optional dtype of the tensor. Only floating point types are\n supported. If not specified, `tf.keras.backend.floatx()` is used,\n ... |
def __call__(self, shape, dtype=None, **kwargs):
'Returns a tensor object initialized to a 2D identity matrix.\n\n Args:\n shape: Shape of the tensor. It should have exactly rank 2.\n dtype: Optional dtype of the tensor. Only floating point types are\n supported. If not specified, `tf.keras.backe... | -860,620,525,179,975,700 | Returns a tensor object initialized to a 2D identity matrix.
Args:
shape: Shape of the tensor. It should have exactly rank 2.
dtype: Optional dtype of the tensor. Only floating point types are
supported. If not specified, `tf.keras.backend.floatx()` is used,
which default to `float32` unless you configured i... | keras/initializers/initializers_v2.py | __call__ | StanislavParovoy/Keras | python | def __call__(self, shape, dtype=None, **kwargs):
'Returns a tensor object initialized to a 2D identity matrix.\n\n Args:\n shape: Shape of the tensor. It should have exactly rank 2.\n dtype: Optional dtype of the tensor. Only floating point types are\n supported. If not specified, `tf.keras.backe... |
def _get_vlan(self):
'\n Getter method for vlan, mapped from YANG variable /interface/hundredgigabitethernet/switchport/access_mac_group_rspan_vlan_classification/access/vlan (list)\n '
return self.__vlan | 7,771,124,431,135,386,000 | Getter method for vlan, mapped from YANG variable /interface/hundredgigabitethernet/switchport/access_mac_group_rspan_vlan_classification/access/vlan (list) | pybind/nos/v6_0_2f/interface/hundredgigabitethernet/switchport/access_mac_group_rspan_vlan_classification/access/__init__.py | _get_vlan | extremenetworks/pybind | python | def _get_vlan(self):
'\n \n '
return self.__vlan |
def _set_vlan(self, v, load=False):
'\n Setter method for vlan, mapped from YANG variable /interface/hundredgigabitethernet/switchport/access_mac_group_rspan_vlan_classification/access/vlan (list)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_vlan is considered as a p... | -3,941,033,711,324,643,300 | Setter method for vlan, mapped from YANG variable /interface/hundredgigabitethernet/switchport/access_mac_group_rspan_vlan_classification/access/vlan (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_vlan is considered as a private
method. Backends looking to populate this variable... | pybind/nos/v6_0_2f/interface/hundredgigabitethernet/switchport/access_mac_group_rspan_vlan_classification/access/__init__.py | _set_vlan | extremenetworks/pybind | python | def _set_vlan(self, v, load=False):
'\n Setter method for vlan, mapped from YANG variable /interface/hundredgigabitethernet/switchport/access_mac_group_rspan_vlan_classification/access/vlan (list)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_vlan is considered as a p... |
def item_count(self):
'get the number of items in the list'
return GroceryItem.objects.filter(list=self).count() | -8,491,763,321,385,804,000 | get the number of items in the list | v1/list/models.py | item_count | BitFis/openeats-api | python | def item_count(self):
return GroceryItem.objects.filter(list=self).count() |
def _get_error_message_from_exception(self, e):
' This method is used to get appropriate error message from the exception.\n :param e: Exception object\n :return: error message\n '
try:
if e.args:
if (len(e.args) > 1):
error_code = e.args[0]
... | -1,006,598,289,810,020,500 | This method is used to get appropriate error message from the exception.
:param e: Exception object
:return: error message | Apps/phgsgmail/gsgmail_process_email.py | _get_error_message_from_exception | chunmanjimmyf/phantom-apps | python | def _get_error_message_from_exception(self, e):
' This method is used to get appropriate error message from the exception.\n :param e: Exception object\n :return: error message\n '
try:
if e.args:
if (len(e.args) > 1):
error_code = e.args[0]
... |
def load_data(folder, input_path='user_item', cut=40, high_cut=1000000, seed=None):
'\n loads the training,validation,test set from the folder, restricts the users with at least "cut" read articles and\n returns the sets. The Format of the sets is pd.Series with index the UserID and value a list of ArticleIDs... | -7,876,844,019,875,978,000 | loads the training,validation,test set from the folder, restricts the users with at least "cut" read articles and
returns the sets. The Format of the sets is pd.Series with index the UserID and value a list of ArticleIDs
:param folder/input_path: {folder}/{input_path} is the path to look for the *_train.pkl files
:para... | preprocessing.py | load_data | MTC-ETH/RecommenderSystems | python | def load_data(folder, input_path='user_item', cut=40, high_cut=1000000, seed=None):
'\n loads the training,validation,test set from the folder, restricts the users with at least "cut" read articles and\n returns the sets. The Format of the sets is pd.Series with index the UserID and value a list of ArticleIDs... |
def load_data_vertical(folder, input_path='user_item_vertical', cut=40):
'\n loads the training,validation,test set from the folder, restricts the users with at least "cut" read articles and\n returns the sets. The Format of the sets is pd.Series with index the UserID and value a list of ArticleIDs\n :para... | 1,800,058,400,881,477,000 | loads the training,validation,test set from the folder, restricts the users with at least "cut" read articles and
returns the sets. The Format of the sets is pd.Series with index the UserID and value a list of ArticleIDs
:param folder/input_path: {folder}/{input_path} is the path to look for the *_train.pkl files
:para... | preprocessing.py | load_data_vertical | MTC-ETH/RecommenderSystems | python | def load_data_vertical(folder, input_path='user_item_vertical', cut=40):
'\n loads the training,validation,test set from the folder, restricts the users with at least "cut" read articles and\n returns the sets. The Format of the sets is pd.Series with index the UserID and value a list of ArticleIDs\n :para... |
def load_data_cv(folder, input_path='user_item', cut=40, high_cut=100000, seed=1):
'\n Same as load_data but only returns random 80% of the training set\n '
(user_item_train, user_item_test, user_item_validation) = load_data(folder, input_path=input_path, cut=cut, high_cut=high_cut)
user_item_train = ... | 1,705,447,626,688,921,600 | Same as load_data but only returns random 80% of the training set | preprocessing.py | load_data_cv | MTC-ETH/RecommenderSystems | python | def load_data_cv(folder, input_path='user_item', cut=40, high_cut=100000, seed=1):
'\n \n '
(user_item_train, user_item_test, user_item_validation) = load_data(folder, input_path=input_path, cut=cut, high_cut=high_cut)
user_item_train = user_item_train.sample(frac=0.8, random_state=seed)
user_item... |
def load_data_vertical_cv(folder, input_path='user_item_vertical', cut=40, high_cut=100000, seed=1):
'\n Same as load_data but only returns random 80% of the training set\n '
(user_item_train, user_item_test, user_item_validation) = load_data_vertical(folder, input_path=input_path, cut=cut)
user_item_... | -1,286,343,011,307,267,600 | Same as load_data but only returns random 80% of the training set | preprocessing.py | load_data_vertical_cv | MTC-ETH/RecommenderSystems | python | def load_data_vertical_cv(folder, input_path='user_item_vertical', cut=40, high_cut=100000, seed=1):
'\n \n '
(user_item_train, user_item_test, user_item_validation) = load_data_vertical(folder, input_path=input_path, cut=cut)
user_item_train = user_item_train.sample(frac=0.8, random_state=seed)
u... |
def get_metadata(folder, usecols=[]):
'\n Loads and returns the article metadata.\n The algorithms expect the format to be a Dataframe with two columns:\n - "resource_id": unique id for the article\n - "text": full text of the article (without html tags)\n '
if (not usecols):
usecols = ['... | 8,553,378,981,365,157,000 | Loads and returns the article metadata.
The algorithms expect the format to be a Dataframe with two columns:
- "resource_id": unique id for the article
- "text": full text of the article (without html tags) | preprocessing.py | get_metadata | MTC-ETH/RecommenderSystems | python | def get_metadata(folder, usecols=[]):
'\n Loads and returns the article metadata.\n The algorithms expect the format to be a Dataframe with two columns:\n - "resource_id": unique id for the article\n - "text": full text of the article (without html tags)\n '
if (not usecols):
usecols = ['... |
def transform_item_matrix_to_horizontal_format(folder, output_path='user_item_matrix.pkl', input_path='user_item_matrix_vertical.pq', sortby='ts'):
'\n Transforms vertical User-Item matrix where ich row is one click into a horizontal User-item matrix where we have\n one row for each user and each row contains... | 7,652,603,608,182,917,000 | Transforms vertical User-Item matrix where ich row is one click into a horizontal User-item matrix where we have
one row for each user and each row contains a (sorted) list of articles she/he clicked on.
:param folder: Input folder
:param output_path: Filename/path for outputfile
:param input_path: Filename/path for in... | preprocessing.py | transform_item_matrix_to_horizontal_format | MTC-ETH/RecommenderSystems | python | def transform_item_matrix_to_horizontal_format(folder, output_path='user_item_matrix.pkl', input_path='user_item_matrix_vertical.pq', sortby='ts'):
'\n Transforms vertical User-Item matrix where ich row is one click into a horizontal User-item matrix where we have\n one row for each user and each row contains... |
def create_split(folder, input_path='user_item_matrix.pkl', ouput_path='user_item', cut_dump=10):
'\n Loads the horizontal user item data from folder and creates a user-wise a 70% train, 20% validation, 10% test split.\n This means for each user the first 70% read articles are in the train the next 20% in val... | 2,414,461,517,074,541,600 | Loads the horizontal user item data from folder and creates a user-wise a 70% train, 20% validation, 10% test split.
This means for each user the first 70% read articles are in the train the next 20% in validation and the last 10%
read articles in the test set. We remove users with less than 10 clicked articles.
This i... | preprocessing.py | create_split | MTC-ETH/RecommenderSystems | python | def create_split(folder, input_path='user_item_matrix.pkl', ouput_path='user_item', cut_dump=10):
'\n Loads the horizontal user item data from folder and creates a user-wise a 70% train, 20% validation, 10% test split.\n This means for each user the first 70% read articles are in the train the next 20% in val... |
def create_split_vertical(folder, input_path='user_item_matrix_vertical.pq', ouput_path='user_item_vertical', cut_dump=10, time_column='ts'):
'\n Loads the horizontal user item data from folder and creates a user-wise a 70% train, 20% validation, 10% test split.\n This means for each user the first 70% read a... | 7,071,494,411,561,606,000 | Loads the horizontal user item data from folder and creates a user-wise a 70% train, 20% validation, 10% test split.
This means for each user the first 70% read articles are in the train the next 20% in validation and the last 10%
read articles in the test set. We remove users with less than 10 clicked articles.
This i... | preprocessing.py | create_split_vertical | MTC-ETH/RecommenderSystems | python | def create_split_vertical(folder, input_path='user_item_matrix_vertical.pq', ouput_path='user_item_vertical', cut_dump=10, time_column='ts'):
'\n Loads the horizontal user item data from folder and creates a user-wise a 70% train, 20% validation, 10% test split.\n This means for each user the first 70% read a... |
def transform_horizontal_to_vertical(df):
'\n Transforms the horizontal format into vertical format\n :param df:\n :return:\n '
return df.explode().reset_index() | -6,143,747,669,144,615,000 | Transforms the horizontal format into vertical format
:param df:
:return: | preprocessing.py | transform_horizontal_to_vertical | MTC-ETH/RecommenderSystems | python | def transform_horizontal_to_vertical(df):
'\n Transforms the horizontal format into vertical format\n :param df:\n :return:\n '
return df.explode().reset_index() |
@auth.optional
def get(self):
'\n Show register form\n\n Returns:\n Register template with form\n '
return render_template('auth/register.html', form=RegisterForm()) | 1,752,371,931,808,680,400 | Show register form
Returns:
Register template with form | app/controllers/auth/register.py | get | TheSynt4x/flask-blog | python | @auth.optional
def get(self):
'\n Show register form\n\n Returns:\n Register template with form\n '
return render_template('auth/register.html', form=RegisterForm()) |
@auth.optional
def post(self):
'\n Handle the POST request and sign up the user if form validation passes\n\n Returns:\n A redirect or a template with the validation errors\n '
form = RegisterForm()
if form.validate_on_submit():
form.validate_username(form.username)
avatar = 'n... | -7,568,100,965,139,478,000 | Handle the POST request and sign up the user if form validation passes
Returns:
A redirect or a template with the validation errors | app/controllers/auth/register.py | post | TheSynt4x/flask-blog | python | @auth.optional
def post(self):
'\n Handle the POST request and sign up the user if form validation passes\n\n Returns:\n A redirect or a template with the validation errors\n '
form = RegisterForm()
if form.validate_on_submit():
form.validate_username(form.username)
avatar = 'n... |
def get(self, request):
' Returns a list of wiki pages. '
pages = Page.objects.all()
context = {'pages': pages}
return render(request, 'list.html', context=context) | -2,116,179,919,993,262,300 | Returns a list of wiki pages. | wiki/views.py | get | ebonnecab/makewiki | python | def get(self, request):
' '
pages = Page.objects.all()
context = {'pages': pages}
return render(request, 'list.html', context=context) |
def __init__(self, num_inputs, num_hidden_layers, num_inner_features):
'Initializer for linear model.\n\n Args:\n num_inputs: the dimension of input data.\n num_hidden_layers: the number of hidden layers.\n num_inner_features: the number of features in the hidden layers\n ... | 5,918,843,681,598,149,000 | Initializer for linear model.
Args:
num_inputs: the dimension of input data.
num_hidden_layers: the number of hidden layers.
num_inner_features: the number of features in the hidden layers | stock_trading_backend/agent/neural_network_model.py | __init__ | iryzhkov/stock-trading-backend | python | def __init__(self, num_inputs, num_hidden_layers, num_inner_features):
'Initializer for linear model.\n\n Args:\n num_inputs: the dimension of input data.\n num_hidden_layers: the number of hidden layers.\n num_inner_features: the number of features in the hidden layers\n ... |
def forward(self, input_tensor):
'Forward pass on the neural network model.\n\n Args:\n input_tensor: the input tensor.\n\n Returns:\n Tensor with model results.\n '
output = F.relu(self.input_layer(input_tensor))
output = self.hidden_layers(output)
output = se... | -7,529,039,952,037,276,000 | Forward pass on the neural network model.
Args:
input_tensor: the input tensor.
Returns:
Tensor with model results. | stock_trading_backend/agent/neural_network_model.py | forward | iryzhkov/stock-trading-backend | python | def forward(self, input_tensor):
'Forward pass on the neural network model.\n\n Args:\n input_tensor: the input tensor.\n\n Returns:\n Tensor with model results.\n '
output = F.relu(self.input_layer(input_tensor))
output = self.hidden_layers(output)
output = se... |
def __init__(self, learning_rate=0.001, num_hidden_layers=1, num_inner_features=100):
'Initializer for model class.\n\n Args:\n learning_rate: the learning rate of the model.\n num_hidden_layers: number of hidden layers in the network.\n num_inner_features: number of features... | -1,580,914,347,267,366,100 | Initializer for model class.
Args:
learning_rate: the learning rate of the model.
num_hidden_layers: number of hidden layers in the network.
num_inner_features: number of features in the hidden layers. | stock_trading_backend/agent/neural_network_model.py | __init__ | iryzhkov/stock-trading-backend | python | def __init__(self, learning_rate=0.001, num_hidden_layers=1, num_inner_features=100):
'Initializer for model class.\n\n Args:\n learning_rate: the learning rate of the model.\n num_hidden_layers: number of hidden layers in the network.\n num_inner_features: number of features... |
def _init_model(self, num_inputs):
'Initializes internal linear model.\n\n Args:\n num_inputs: number of inputs that model will have.\n '
self.model = NNModel(num_inputs, self.num_hidden_layers, self.num_inner_features)
self.optimizer = optim.Adam(self.model.parameters(), lr=self.le... | -7,363,408,784,865,279,000 | Initializes internal linear model.
Args:
num_inputs: number of inputs that model will have. | stock_trading_backend/agent/neural_network_model.py | _init_model | iryzhkov/stock-trading-backend | python | def _init_model(self, num_inputs):
'Initializes internal linear model.\n\n Args:\n num_inputs: number of inputs that model will have.\n '
self.model = NNModel(num_inputs, self.num_hidden_layers, self.num_inner_features)
self.optimizer = optim.Adam(self.model.parameters(), lr=self.le... |
def _predict(self, state_action_tensor):
'Use provided information to make a prediction.\n\n Args:\n state_action_tensor: pytorch tensor with state-action values.\n\n Returns:\n Predicted values for observation-action tensors.\n '
if (self.model is None):
self.... | -3,101,276,370,257,911,000 | Use provided information to make a prediction.
Args:
state_action_tensor: pytorch tensor with state-action values.
Returns:
Predicted values for observation-action tensors. | stock_trading_backend/agent/neural_network_model.py | _predict | iryzhkov/stock-trading-backend | python | def _predict(self, state_action_tensor):
'Use provided information to make a prediction.\n\n Args:\n state_action_tensor: pytorch tensor with state-action values.\n\n Returns:\n Predicted values for observation-action tensors.\n '
if (self.model is None):
self.... |
def _train(self, state_action_tensor, expected_values_tensor):
'Train the model for 1 epoch.\n\n Args:\n state_action_tensor: pytorch tensor with state-action expected_values.\n expected_values: pytorch tensor with expected values for each state-action.\n\n Returns:\n ... | -8,040,501,734,331,822,000 | Train the model for 1 epoch.
Args:
state_action_tensor: pytorch tensor with state-action expected_values.
expected_values: pytorch tensor with expected values for each state-action.
Returns:
The loss before trainig. | stock_trading_backend/agent/neural_network_model.py | _train | iryzhkov/stock-trading-backend | python | def _train(self, state_action_tensor, expected_values_tensor):
'Train the model for 1 epoch.\n\n Args:\n state_action_tensor: pytorch tensor with state-action expected_values.\n expected_values: pytorch tensor with expected values for each state-action.\n\n Returns:\n ... |
@property
def distributions(self):
'Return the distributions for this trial.\n\n Returns:\n The distributions.\n '
return self._distributions | 8,992,952,435,542,309,000 | Return the distributions for this trial.
Returns:
The distributions. | optuna/structs.py | distributions | VladSkripniuk/optuna | python | @property
def distributions(self):
'Return the distributions for this trial.\n\n Returns:\n The distributions.\n '
return self._distributions |
@distributions.setter
def distributions(self, value):
'Set the distributions for this trial.\n\n Args:\n value: The distributions.\n '
self._distributions = value | -5,502,361,171,038,914,000 | Set the distributions for this trial.
Args:
value: The distributions. | optuna/structs.py | distributions | VladSkripniuk/optuna | python | @distributions.setter
def distributions(self, value):
'Set the distributions for this trial.\n\n Args:\n value: The distributions.\n '
self._distributions = value |
@property
def trial_id(self):
'Return the trial ID.\n\n .. deprecated:: 0.19.0\n The direct use of this attribute is deprecated and it is recommended that you use\n :attr:`~optuna.trial.FrozenTrial.number` instead.\n\n Returns:\n The trial ID.\n '
warnings.w... | 7,157,514,691,564,256,000 | Return the trial ID.
.. deprecated:: 0.19.0
The direct use of this attribute is deprecated and it is recommended that you use
:attr:`~optuna.trial.FrozenTrial.number` instead.
Returns:
The trial ID. | optuna/structs.py | trial_id | VladSkripniuk/optuna | python | @property
def trial_id(self):
'Return the trial ID.\n\n .. deprecated:: 0.19.0\n The direct use of this attribute is deprecated and it is recommended that you use\n :attr:`~optuna.trial.FrozenTrial.number` instead.\n\n Returns:\n The trial ID.\n '
warnings.w... |
@property
def study_id(self):
'Return the study ID.\n\n .. deprecated:: 0.20.0\n The direct use of this attribute is deprecated and it is recommended that you use\n :attr:`~optuna.structs.StudySummary.study_name` instead.\n\n Returns:\n The study ID.\n '
mes... | 4,847,127,753,446,662,000 | Return the study ID.
.. deprecated:: 0.20.0
The direct use of this attribute is deprecated and it is recommended that you use
:attr:`~optuna.structs.StudySummary.study_name` instead.
Returns:
The study ID. | optuna/structs.py | study_id | VladSkripniuk/optuna | python | @property
def study_id(self):
'Return the study ID.\n\n .. deprecated:: 0.20.0\n The direct use of this attribute is deprecated and it is recommended that you use\n :attr:`~optuna.structs.StudySummary.study_name` instead.\n\n Returns:\n The study ID.\n '
mes... |
def __init__(__self__, resource_name, opts=None, api_stages=None, description=None, name=None, product_code=None, quota_settings=None, tags=None, throttle_settings=None, __props__=None, __name__=None, __opts__=None):
'\n Provides an API Gateway Usage Plan.\n\n ## Example Usage\n\n\n\n ```python... | 3,021,579,052,692,282,400 | Provides an API Gateway Usage Plan.
## Example Usage
```python
import pulumi
import pulumi_aws as aws
myapi = aws.apigateway.RestApi("myapi")
dev = aws.apigateway.Deployment("dev",
rest_api=myapi.id,
stage_name="dev")
prod = aws.apigateway.Deployment("prod",
rest_api=myapi.id,
stage_name="prod")
my... | sdk/python/pulumi_aws/apigateway/usage_plan.py | __init__ | JakeGinnivan/pulumi-aws | python | def __init__(__self__, resource_name, opts=None, api_stages=None, description=None, name=None, product_code=None, quota_settings=None, tags=None, throttle_settings=None, __props__=None, __name__=None, __opts__=None):
'\n Provides an API Gateway Usage Plan.\n\n ## Example Usage\n\n\n\n ```python... |
@staticmethod
def get(resource_name, id, opts=None, api_stages=None, arn=None, description=None, name=None, product_code=None, quota_settings=None, tags=None, throttle_settings=None):
'\n Get an existing UsagePlan resource\'s state with the given name, id, and optional extra\n properties used to quali... | -8,477,662,931,629,256,000 | Get an existing UsagePlan resource's state with the given name, id, and optional extra
properties used to qualify the lookup.
:param str resource_name: The unique name of the resulting resource.
:param str id: The unique provider ID of the resource to lookup.
:param pulumi.ResourceOptions opts: Options for the resourc... | sdk/python/pulumi_aws/apigateway/usage_plan.py | get | JakeGinnivan/pulumi-aws | python | @staticmethod
def get(resource_name, id, opts=None, api_stages=None, arn=None, description=None, name=None, product_code=None, quota_settings=None, tags=None, throttle_settings=None):
'\n Get an existing UsagePlan resource\'s state with the given name, id, and optional extra\n properties used to quali... |
@property
def color(self):
"\n The 'color' property is a color and may be specified as:\n - A hex string (e.g. '#ff0000')\n - An rgb/rgba string (e.g. 'rgb(255,0,0)')\n - An hsl/hsla string (e.g. 'hsl(0,100%,50%)')\n - An hsv/hsva string (e.g. 'hsv(0,100%,100%)')\n ... | -9,075,663,790,309,021,000 | The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
... | plotly_study/graph_objs/streamtube/hoverlabel/__init__.py | color | lucasiscovici/plotly_py | python | @property
def color(self):
"\n The 'color' property is a color and may be specified as:\n - A hex string (e.g. '#ff0000')\n - An rgb/rgba string (e.g. 'rgb(255,0,0)')\n - An hsl/hsla string (e.g. 'hsl(0,100%,50%)')\n - An hsv/hsva string (e.g. 'hsv(0,100%,100%)')\n ... |
@property
def colorsrc(self):
"\n Sets the source reference on plot.ly for color .\n \n The 'colorsrc' property must be specified as a string or\n as a plotly_study.grid_objs.Column object\n\n Returns\n -------\n str\n "
return self['colorsrc'] | 2,247,104,057,059,088,600 | Sets the source reference on plot.ly for color .
The 'colorsrc' property must be specified as a string or
as a plotly_study.grid_objs.Column object
Returns
-------
str | plotly_study/graph_objs/streamtube/hoverlabel/__init__.py | colorsrc | lucasiscovici/plotly_py | python | @property
def colorsrc(self):
"\n Sets the source reference on plot.ly for color .\n \n The 'colorsrc' property must be specified as a string or\n as a plotly_study.grid_objs.Column object\n\n Returns\n -------\n str\n "
return self['colorsrc'] |
@property
def family(self):
'\n HTML font family - the typeface that will be applied by the web\n browser. The web browser will only be able to apply a font if\n it is available on the system which it operates. Provide\n multiple font families, separated by commas, to indicate the\n ... | -3,524,569,398,637,699,600 | HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
preference in which to apply fonts if they aren't available on
the system. T... | plotly_study/graph_objs/streamtube/hoverlabel/__init__.py | family | lucasiscovici/plotly_py | python | @property
def family(self):
'\n HTML font family - the typeface that will be applied by the web\n browser. The web browser will only be able to apply a font if\n it is available on the system which it operates. Provide\n multiple font families, separated by commas, to indicate the\n ... |
@property
def familysrc(self):
"\n Sets the source reference on plot.ly for family .\n \n The 'familysrc' property must be specified as a string or\n as a plotly_study.grid_objs.Column object\n\n Returns\n -------\n str\n "
return self['familysrc'] | 2,851,453,137,557,342,000 | Sets the source reference on plot.ly for family .
The 'familysrc' property must be specified as a string or
as a plotly_study.grid_objs.Column object
Returns
-------
str | plotly_study/graph_objs/streamtube/hoverlabel/__init__.py | familysrc | lucasiscovici/plotly_py | python | @property
def familysrc(self):
"\n Sets the source reference on plot.ly for family .\n \n The 'familysrc' property must be specified as a string or\n as a plotly_study.grid_objs.Column object\n\n Returns\n -------\n str\n "
return self['familysrc'] |
@property
def size(self):
"\n The 'size' property is a number and may be specified as:\n - An int or float in the interval [1, inf]\n - A tuple, list, or one-dimensional numpy array of the above\n\n Returns\n -------\n int|float|numpy.ndarray\n "
return self[... | 6,887,128,696,685,480,000 | The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
int|float|numpy.ndarray | plotly_study/graph_objs/streamtube/hoverlabel/__init__.py | size | lucasiscovici/plotly_py | python | @property
def size(self):
"\n The 'size' property is a number and may be specified as:\n - An int or float in the interval [1, inf]\n - A tuple, list, or one-dimensional numpy array of the above\n\n Returns\n -------\n int|float|numpy.ndarray\n "
return self[... |
@property
def sizesrc(self):
"\n Sets the source reference on plot.ly for size .\n \n The 'sizesrc' property must be specified as a string or\n as a plotly_study.grid_objs.Column object\n\n Returns\n -------\n str\n "
return self['sizesrc'] | -2,197,100,178,794,376,400 | Sets the source reference on plot.ly for size .
The 'sizesrc' property must be specified as a string or
as a plotly_study.grid_objs.Column object
Returns
-------
str | plotly_study/graph_objs/streamtube/hoverlabel/__init__.py | sizesrc | lucasiscovici/plotly_py | python | @property
def sizesrc(self):
"\n Sets the source reference on plot.ly for size .\n \n The 'sizesrc' property must be specified as a string or\n as a plotly_study.grid_objs.Column object\n\n Returns\n -------\n str\n "
return self['sizesrc'] |
def __init__(self, arg=None, color=None, colorsrc=None, family=None, familysrc=None, size=None, sizesrc=None, **kwargs):
'\n Construct a new Font object\n \n Sets the font used in hover labels.\n\n Parameters\n ----------\n arg\n dict of properties compatible wit... | 4,897,156,161,566,623,000 | Construct a new Font object
Sets the font used in hover labels.
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
plotly_study.graph_objs.streamtube.hoverlabel.Font
color
colorsrc
Sets the source reference on plot.ly for color .
family
HTML font fami... | plotly_study/graph_objs/streamtube/hoverlabel/__init__.py | __init__ | lucasiscovici/plotly_py | python | def __init__(self, arg=None, color=None, colorsrc=None, family=None, familysrc=None, size=None, sizesrc=None, **kwargs):
'\n Construct a new Font object\n \n Sets the font used in hover labels.\n\n Parameters\n ----------\n arg\n dict of properties compatible wit... |
def getNetworkCellularGatewaySettingsDhcp(self, networkId: str):
'\n **List common DHCP settings of MGs**\n https://developer.cisco.com/meraki/api/#!get-network-cellular-gateway-settings-dhcp\n \n - networkId (string)\n '
metadata = {'tags': ['MG DHCP settings'], 'operation': ... | -1,668,987,376,588,538,000 | **List common DHCP settings of MGs**
https://developer.cisco.com/meraki/api/#!get-network-cellular-gateway-settings-dhcp
- networkId (string) | meraki/api/mg_dhcp_settings.py | getNetworkCellularGatewaySettingsDhcp | NoFliesOnYou/dashboard-api-python | python | def getNetworkCellularGatewaySettingsDhcp(self, networkId: str):
'\n **List common DHCP settings of MGs**\n https://developer.cisco.com/meraki/api/#!get-network-cellular-gateway-settings-dhcp\n \n - networkId (string)\n '
metadata = {'tags': ['MG DHCP settings'], 'operation': ... |
def updateNetworkCellularGatewaySettingsDhcp(self, networkId: str, **kwargs):
"\n **Update common DHCP settings of MGs**\n https://developer.cisco.com/meraki/api/#!update-network-cellular-gateway-settings-dhcp\n \n - networkId (string)\n - dhcpLeaseTime (string): DHCP Lease time f... | 6,057,655,295,595,497,000 | **Update common DHCP settings of MGs**
https://developer.cisco.com/meraki/api/#!update-network-cellular-gateway-settings-dhcp
- networkId (string)
- dhcpLeaseTime (string): DHCP Lease time for all MG of the network. It can be '30 minutes', '1 hour', '4 hours', '12 hours', '1 day' or '1 week'.
- dnsNameservers (string)... | meraki/api/mg_dhcp_settings.py | updateNetworkCellularGatewaySettingsDhcp | NoFliesOnYou/dashboard-api-python | python | def updateNetworkCellularGatewaySettingsDhcp(self, networkId: str, **kwargs):
"\n **Update common DHCP settings of MGs**\n https://developer.cisco.com/meraki/api/#!update-network-cellular-gateway-settings-dhcp\n \n - networkId (string)\n - dhcpLeaseTime (string): DHCP Lease time f... |
@classmethod
def setUpClass(cls):
'Configure raw file and its object in parent class (TestDump).'
super().setUpClass()
super().set_raw_dump_file('v0x04', 'ofpt_port_stats')
super().set_raw_dump_object(PortStats)
super().set_minimum_size(112) | -3,124,006,365,885,124,000 | Configure raw file and its object in parent class (TestDump). | build/lib/tests/v0x04/test_controller2switch/test_port_stats.py | setUpClass | smythtech/python-openflow-legacy | python | @classmethod
def setUpClass(cls):
super().setUpClass()
super().set_raw_dump_file('v0x04', 'ofpt_port_stats')
super().set_raw_dump_object(PortStats)
super().set_minimum_size(112) |
@bottle.post('/api/v3/report/import')
def post_report_import(database: Database):
'Import a preconfigured report into the database.'
report = dict(bottle.request.json)
result = import_json_report(database, report)
result['new_report_uuid'] = report['report_uuid']
return result | 4,125,415,011,259,234,300 | Import a preconfigured report into the database. | components/server/src/routes/report.py | post_report_import | Gamer1120/quality-time | python | @bottle.post('/api/v3/report/import')
def post_report_import(database: Database):
report = dict(bottle.request.json)
result = import_json_report(database, report)
result['new_report_uuid'] = report['report_uuid']
return result |
@bottle.post('/api/v3/report/new')
def post_report_new(database: Database):
'Add a new report.'
report_uuid = uuid()
user = sessions.user(database)
report = dict(report_uuid=report_uuid, title='New report', subjects={}, delta=dict(uuids=[report_uuid], email=user['email'], description=f"{user['user']} cr... | -8,755,332,867,516,317,000 | Add a new report. | components/server/src/routes/report.py | post_report_new | Gamer1120/quality-time | python | @bottle.post('/api/v3/report/new')
def post_report_new(database: Database):
report_uuid = uuid()
user = sessions.user(database)
report = dict(report_uuid=report_uuid, title='New report', subjects={}, delta=dict(uuids=[report_uuid], email=user['email'], description=f"{user['user']} created a new report.... |
@bottle.post('/api/v3/report/<report_uuid>/copy')
def post_report_copy(report_uuid: ReportId, database: Database):
'Copy a report.'
data_model = latest_datamodel(database)
reports = latest_reports(database)
data = ReportData(data_model, reports, report_uuid)
report_copy = copy_report(data.report, da... | 501,560,276,536,554,100 | Copy a report. | components/server/src/routes/report.py | post_report_copy | Gamer1120/quality-time | python | @bottle.post('/api/v3/report/<report_uuid>/copy')
def post_report_copy(report_uuid: ReportId, database: Database):
data_model = latest_datamodel(database)
reports = latest_reports(database)
data = ReportData(data_model, reports, report_uuid)
report_copy = copy_report(data.report, data.datamodel)
... |
@bottle.get('/api/v3/report/<report_uuid>/pdf')
def export_report_as_pdf(report_uuid: ReportId):
'Download the report as pdf.'
renderer_host = os.environ.get('RENDERER_HOST', 'renderer')
renderer_port = os.environ.get('RENDERER_PORT', '9000')
render_url = f'http://{renderer_host}:{renderer_port}/api/ren... | -3,540,804,449,831,905,000 | Download the report as pdf. | components/server/src/routes/report.py | export_report_as_pdf | Gamer1120/quality-time | python | @bottle.get('/api/v3/report/<report_uuid>/pdf')
def export_report_as_pdf(report_uuid: ReportId):
renderer_host = os.environ.get('RENDERER_HOST', 'renderer')
renderer_port = os.environ.get('RENDERER_PORT', '9000')
render_url = f'http://{renderer_host}:{renderer_port}/api/render'
proxy_host = os.envi... |
@bottle.delete('/api/v3/report/<report_uuid>')
def delete_report(report_uuid: ReportId, database: Database):
'Delete a report.'
data_model = latest_datamodel(database)
reports = latest_reports(database)
data = ReportData(data_model, reports, report_uuid)
data.report['deleted'] = 'true'
user = se... | -6,304,560,776,285,529,000 | Delete a report. | components/server/src/routes/report.py | delete_report | Gamer1120/quality-time | python | @bottle.delete('/api/v3/report/<report_uuid>')
def delete_report(report_uuid: ReportId, database: Database):
data_model = latest_datamodel(database)
reports = latest_reports(database)
data = ReportData(data_model, reports, report_uuid)
data.report['deleted'] = 'true'
user = sessions.user(databa... |
@bottle.post('/api/v3/report/<report_uuid>/attribute/<report_attribute>')
def post_report_attribute(report_uuid: ReportId, report_attribute: str, database: Database):
'Set a report attribute.'
data_model = latest_datamodel(database)
reports = latest_reports(database)
data = ReportData(data_model, report... | -7,890,409,386,999,294,000 | Set a report attribute. | components/server/src/routes/report.py | post_report_attribute | Gamer1120/quality-time | python | @bottle.post('/api/v3/report/<report_uuid>/attribute/<report_attribute>')
def post_report_attribute(report_uuid: ReportId, report_attribute: str, database: Database):
data_model = latest_datamodel(database)
reports = latest_reports(database)
data = ReportData(data_model, reports, report_uuid)
value... |
@bottle.get('/api/v3/tagreport/<tag>')
def get_tag_report(tag: str, database: Database):
'Get a report with all metrics that have the specified tag.'
date_time = report_date_time()
reports = latest_reports(database, date_time)
data_model = latest_datamodel(database, date_time)
subjects = _get_subjec... | 2,397,682,409,466,062,000 | Get a report with all metrics that have the specified tag. | components/server/src/routes/report.py | get_tag_report | Gamer1120/quality-time | python | @bottle.get('/api/v3/tagreport/<tag>')
def get_tag_report(tag: str, database: Database):
date_time = report_date_time()
reports = latest_reports(database, date_time)
data_model = latest_datamodel(database, date_time)
subjects = _get_subjects_and_metrics_by_tag(data_model, reports, tag)
tag_repo... |
def _get_subjects_and_metrics_by_tag(data_model, reports, tag: str):
'Return all subjects and metrics that have the tag.'
subjects = {}
for report in reports:
for (subject_uuid, subject) in list(report.get('subjects', {}).items()):
for (metric_uuid, metric) in list(subject.get('metrics',... | 3,139,816,455,561,467,400 | Return all subjects and metrics that have the tag. | components/server/src/routes/report.py | _get_subjects_and_metrics_by_tag | Gamer1120/quality-time | python | def _get_subjects_and_metrics_by_tag(data_model, reports, tag: str):
subjects = {}
for report in reports:
for (subject_uuid, subject) in list(report.get('subjects', {}).items()):
for (metric_uuid, metric) in list(subject.get('metrics', {}).items()):
if (tag not in metric... |
def blend(image1, image2, factor):
'Blend image1 and image2 using \'factor\'.\n\n A value of factor 0.0 means only image1 is used.\n A value of 1.0 means only image2 is used. A value between 0.0 and\n 1.0 means we linearly interpolate the pixel values between the two\n images. A value greater than 1.0 "extrap... | -5,146,605,963,756,331,000 | Blend image1 and image2 using 'factor'.
A value of factor 0.0 means only image1 is used.
A value of 1.0 means only image2 is used. A value between 0.0 and
1.0 means we linearly interpolate the pixel values between the two
images. A value greater than 1.0 "extrapolates" the difference
between the two pixel values, an... | third_party/augment_ops.py | blend | google-research/crest | python | def blend(image1, image2, factor):
'Blend image1 and image2 using \'factor\'.\n\n A value of factor 0.0 means only image1 is used.\n A value of 1.0 means only image2 is used. A value between 0.0 and\n 1.0 means we linearly interpolate the pixel values between the two\n images. A value greater than 1.0 "extrap... |
def wrap(image):
"Returns 'image' with an extra channel set to all 1s."
shape = tf.shape(image)
extended_channel = tf.ones([shape[0], shape[1], 1], image.dtype)
extended = tf.concat([image, extended_channel], 2)
return extended | -2,054,740,842,410,237,000 | Returns 'image' with an extra channel set to all 1s. | third_party/augment_ops.py | wrap | google-research/crest | python | def wrap(image):
shape = tf.shape(image)
extended_channel = tf.ones([shape[0], shape[1], 1], image.dtype)
extended = tf.concat([image, extended_channel], 2)
return extended |
def unwrap(image):
"Unwraps an image produced by wrap.\n\n Where there is a 0 in the last channel for every spatial position,\n the rest of the three channels in that spatial dimension are grayed\n (set to 128). Operations like translate and shear on a wrapped\n Tensor will leave 0s in empty locations. Some t... | 596,681,917,176,061,000 | Unwraps an image produced by wrap.
Where there is a 0 in the last channel for every spatial position,
the rest of the three channels in that spatial dimension are grayed
(set to 128). Operations like translate and shear on a wrapped
Tensor will leave 0s in empty locations. Some transformations look
at the intensity ... | third_party/augment_ops.py | unwrap | google-research/crest | python | def unwrap(image):
"Unwraps an image produced by wrap.\n\n Where there is a 0 in the last channel for every spatial position,\n the rest of the three channels in that spatial dimension are grayed\n (set to 128). Operations like translate and shear on a wrapped\n Tensor will leave 0s in empty locations. Some t... |
def invert(image):
'Inverts the image pixels.'
return (255 - tf.convert_to_tensor(image)) | -8,700,322,171,604,700,000 | Inverts the image pixels. | third_party/augment_ops.py | invert | google-research/crest | python | def invert(image):
return (255 - tf.convert_to_tensor(image)) |
def invert_blend(image, factor):
'Implements blend of invert with original image.'
return blend(invert(image), image, factor) | -4,616,882,108,785,448,000 | Implements blend of invert with original image. | third_party/augment_ops.py | invert_blend | google-research/crest | python | def invert_blend(image, factor):
return blend(invert(image), image, factor) |
def color(image, factor):
'Equivalent of PIL Color.'
degenerate = tf.image.grayscale_to_rgb(tf.image.rgb_to_grayscale(image))
return blend(degenerate, image, factor) | 2,872,861,326,192,433,000 | Equivalent of PIL Color. | third_party/augment_ops.py | color | google-research/crest | python | def color(image, factor):
degenerate = tf.image.grayscale_to_rgb(tf.image.rgb_to_grayscale(image))
return blend(degenerate, image, factor) |
def contrast(image, factor):
'Equivalent of PIL Contrast.'
grayscale_im = tf.image.rgb_to_grayscale(image)
mean = tf.reduce_mean(tf.cast(grayscale_im, tf.float32))
mean = tf.saturate_cast((mean + 0.5), tf.uint8)
degenerate = (tf.ones_like(grayscale_im, dtype=tf.uint8) * mean)
degenerate = tf.ima... | -3,693,930,040,758,899,000 | Equivalent of PIL Contrast. | third_party/augment_ops.py | contrast | google-research/crest | python | def contrast(image, factor):
grayscale_im = tf.image.rgb_to_grayscale(image)
mean = tf.reduce_mean(tf.cast(grayscale_im, tf.float32))
mean = tf.saturate_cast((mean + 0.5), tf.uint8)
degenerate = (tf.ones_like(grayscale_im, dtype=tf.uint8) * mean)
degenerate = tf.image.grayscale_to_rgb(degenerat... |
def brightness(image, factor):
'Equivalent of PIL Brightness.'
degenerate = tf.zeros_like(image)
return blend(degenerate, image, factor) | -5,514,793,971,791,669,000 | Equivalent of PIL Brightness. | third_party/augment_ops.py | brightness | google-research/crest | python | def brightness(image, factor):
degenerate = tf.zeros_like(image)
return blend(degenerate, image, factor) |
def posterize(image, bits):
'Equivalent of PIL Posterize.'
shift = tf.cast((8 - bits), image.dtype)
return tf.bitwise.left_shift(tf.bitwise.right_shift(image, shift), shift) | 7,847,657,482,698,043,000 | Equivalent of PIL Posterize. | third_party/augment_ops.py | posterize | google-research/crest | python | def posterize(image, bits):
shift = tf.cast((8 - bits), image.dtype)
return tf.bitwise.left_shift(tf.bitwise.right_shift(image, shift), shift) |
def rotate(image, degrees):
'Equivalent of PIL Rotation.'
degrees_to_radians = (math.pi / 180.0)
radians = (degrees * degrees_to_radians)
image = tfa_image.transform_ops.rotate(wrap(image), radians)
return unwrap(image) | -6,439,018,474,791,032,000 | Equivalent of PIL Rotation. | third_party/augment_ops.py | rotate | google-research/crest | python | def rotate(image, degrees):
degrees_to_radians = (math.pi / 180.0)
radians = (degrees * degrees_to_radians)
image = tfa_image.transform_ops.rotate(wrap(image), radians)
return unwrap(image) |
def translate_x(image, pixels):
'Equivalent of PIL Translate in X dimension.'
image = tfa_image.translate_ops.translate(wrap(image), [(- pixels), 0])
return unwrap(image) | -5,187,543,649,634,846,000 | Equivalent of PIL Translate in X dimension. | third_party/augment_ops.py | translate_x | google-research/crest | python | def translate_x(image, pixels):
image = tfa_image.translate_ops.translate(wrap(image), [(- pixels), 0])
return unwrap(image) |
def translate_y(image, pixels):
'Equivalent of PIL Translate in Y dimension.'
image = tfa_image.translate_ops.translate(wrap(image), [0, (- pixels)])
return unwrap(image) | -3,589,578,885,919,435,000 | Equivalent of PIL Translate in Y dimension. | third_party/augment_ops.py | translate_y | google-research/crest | python | def translate_y(image, pixels):
image = tfa_image.translate_ops.translate(wrap(image), [0, (- pixels)])
return unwrap(image) |
def shear_x(image, level):
'Equivalent of PIL Shearing in X dimension.'
image = tfa_image.transform_ops.transform(wrap(image), [1.0, level, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0])
return unwrap(image) | -1,900,459,595,508,388,400 | Equivalent of PIL Shearing in X dimension. | third_party/augment_ops.py | shear_x | google-research/crest | python | def shear_x(image, level):
image = tfa_image.transform_ops.transform(wrap(image), [1.0, level, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0])
return unwrap(image) |
def shear_y(image, level):
'Equivalent of PIL Shearing in Y dimension.'
image = tfa_image.transform_ops.transform(wrap(image), [1.0, 0.0, 0.0, level, 1.0, 0.0, 0.0, 0.0])
return unwrap(image) | -8,037,771,224,047,471,000 | Equivalent of PIL Shearing in Y dimension. | third_party/augment_ops.py | shear_y | google-research/crest | python | def shear_y(image, level):
image = tfa_image.transform_ops.transform(wrap(image), [1.0, 0.0, 0.0, level, 1.0, 0.0, 0.0, 0.0])
return unwrap(image) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.