Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def to_flyte_idl(self):
"""
:return: _idl_parameter_ranges.ContinuousParameterRange
"""
if self.scaling_type == _sdk_sagemaker_types.HyperparameterScalingType.AUTO:
scaling_type = _idl_parameter_ranges.HyperparameterScalingType.AUTO
elif self.scaling_type == _sdk_sagemaker_types.HyperparameterScalingType.LINEAR:
scaling_type = _idl_parameter_ranges.HyperparameterScalingType.LINEAR
elif self.scaling_type == _sdk_sagemaker_types.HyperparameterScalingType.LOGARITHMIC:
scaling_type = _idl_parameter_ranges.HyperparameterScalingType.LOGARITHMIC
elif self.scaling_type == _sdk_sagemaker_types.HyperparameterScalingType.REVERSELOGARITHMIC:
scaling_type = _idl_parameter_ranges.HyperparameterScalingType.REVERSELOGARITHMIC
else:
raise _user_exceptions.FlyteValidationException("Invalid SageMaker HyperparameterScalingType specified")
return _idl_parameter_ranges.ContinuousParameterRange(
max_value=self._max_value,
min_value=self._min_value,
scaling_type=scaling_type,
)
def from_flyte_idl(cls, pb2_object):
scaling_type = _sdk_sagemaker_types.HyperparameterScalingType.AUTO
if pb2_object.type == _idl_parameter_ranges.HyperparameterScalingType.LINEAR:
scaling_type = _sdk_sagemaker_types.HyperparameterScalingType.LINEAR
elif pb2_object.type == _idl_parameter_ranges.HyperparameterScalingType.LOGARITHMIC:
scaling_type = _sdk_sagemaker_types.HyperparameterScalingType.LOGARITHMIC
elif pb2_object.type == _idl_parameter_ranges.HyperparameterScalingType.REVERSELOGARITHMIC:
scaling_type = _sdk_sagemaker_types.HyperparameterScalingType.REVERSELOGARITHMIC
return cls(
max_value=pb2_object.max_value,
min_value=pb2_object.min_value,
scaling_type=scaling_type,
)
def to_flyte_idl(self):
"""
:return: _idl_parameter_ranges.IntegerParameterRange
"""
if self.scaling_type == _sdk_sagemaker_types.HyperparameterScalingType.AUTO:
scaling_type = _idl_parameter_ranges.HyperparameterScalingType.AUTO
elif self.scaling_type == _sdk_sagemaker_types.HyperparameterScalingType.LINEAR:
scaling_type = _idl_parameter_ranges.HyperparameterScalingType.LINEAR
elif self.scaling_type == _sdk_sagemaker_types.HyperparameterScalingType.LOGARITHMIC:
scaling_type = _idl_parameter_ranges.HyperparameterScalingType.LOGARITHMIC
elif self.scaling_type == _sdk_sagemaker_types.HyperparameterScalingType.REVERSELOGARITHMIC:
scaling_type = _idl_parameter_ranges.HyperparameterScalingType.REVERSELOGARITHMIC
else:
raise _user_exceptions.FlyteValidationException("Invalid SageMaker HyperparameterScalingType specified")
return _idl_parameter_ranges.IntegerParameterRange(
max_value=self._max_value,
min_value=self._min_value,
scaling_type=scaling_type,
)
def from_flyte_idl(cls, pb2_object):
scaling_type = _sdk_sagemaker_types.HyperparameterScalingType.AUTO
if pb2_object.type == _idl_parameter_ranges.HyperparameterScalingType.LINEAR:
scaling_type = _sdk_sagemaker_types.HyperparameterScalingType.LINEAR
elif pb2_object.type == _idl_parameter_ranges.HyperparameterScalingType.LOGARITHMIC:
scaling_type = _sdk_sagemaker_types.HyperparameterScalingType.LOGARITHMIC
elif pb2_object.type == _idl_parameter_ranges.HyperparameterScalingType.REVERSELOGARITHMIC:
scaling_type = _sdk_sagemaker_types.HyperparameterScalingType.REVERSELOGARITHMIC
return cls(
max_value=pb2_object.max_value,
min_value=pb2_object.min_value,
scaling_type=scaling_type,
)
def to_flyte_idl(self):
"""
:return: _idl_parameter_ranges.ContinuousParameterRange
"""
if self.scaling_type == _sdk_sagemaker_types.HyperparameterScalingType.AUTO:
scaling_type = _idl_parameter_ranges.HyperparameterScalingType.AUTO
elif self.scaling_type == _sdk_sagemaker_types.HyperparameterScalingType.LINEAR:
scaling_type = _idl_parameter_ranges.HyperparameterScalingType.LINEAR
elif self.scaling_type == _sdk_sagemaker_types.HyperparameterScalingType.LOGARITHMIC:
scaling_type = _idl_parameter_ranges.HyperparameterScalingType.LOGARITHMIC
elif self.scaling_type == _sdk_sagemaker_types.HyperparameterScalingType.REVERSELOGARITHMIC:
scaling_type = _idl_parameter_ranges.HyperparameterScalingType.REVERSELOGARITHMIC
else:
raise _user_exceptions.FlyteValidationException("Invalid SageMaker HyperparameterScalingType specified")
return _idl_parameter_ranges.ContinuousParameterRange(
max_value=self._max_value,
min_value=self._min_value,
scaling_type=scaling_type,
)
def to_flyte_idl(self):
"""
:return: _idl_parameter_ranges.IntegerParameterRange
"""
if self.scaling_type == _sdk_sagemaker_types.HyperparameterScalingType.AUTO:
scaling_type = _idl_parameter_ranges.HyperparameterScalingType.AUTO
elif self.scaling_type == _sdk_sagemaker_types.HyperparameterScalingType.LINEAR:
scaling_type = _idl_parameter_ranges.HyperparameterScalingType.LINEAR
elif self.scaling_type == _sdk_sagemaker_types.HyperparameterScalingType.LOGARITHMIC:
scaling_type = _idl_parameter_ranges.HyperparameterScalingType.LOGARITHMIC
elif self.scaling_type == _sdk_sagemaker_types.HyperparameterScalingType.REVERSELOGARITHMIC:
scaling_type = _idl_parameter_ranges.HyperparameterScalingType.REVERSELOGARITHMIC
else:
raise _user_exceptions.FlyteValidationException("Invalid SageMaker HyperparameterScalingType specified")
return _idl_parameter_ranges.IntegerParameterRange(
max_value=self._max_value,
min_value=self._min_value,
scaling_type=scaling_type,
)