Files
sdk/model_train_objective.go

193 lines
4.8 KiB
Go

/*
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
API version: v1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package hanzoai
import (
"encoding/json"
)
// checks if the TrainObjective type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &TrainObjective{}
// TrainObjective struct for TrainObjective
type TrainObjective struct {
// Loss is `cross_entropy`.
Loss *string `json:"loss,omitempty"`
// Terms are added to each row's loss.
Terms []TrainTerm `json:"terms,omitempty"`
AdditionalProperties map[string]interface{}
}
type _TrainObjective TrainObjective
// NewTrainObjective instantiates a new TrainObjective object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewTrainObjective() *TrainObjective {
this := TrainObjective{}
return &this
}
// NewTrainObjectiveWithDefaults instantiates a new TrainObjective object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewTrainObjectiveWithDefaults() *TrainObjective {
this := TrainObjective{}
return &this
}
// GetLoss returns the Loss field value if set, zero value otherwise.
func (o *TrainObjective) GetLoss() string {
if o == nil || IsNil(o.Loss) {
var ret string
return ret
}
return *o.Loss
}
// GetLossOk returns a tuple with the Loss field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainObjective) GetLossOk() (*string, bool) {
if o == nil || IsNil(o.Loss) {
return nil, false
}
return o.Loss, true
}
// HasLoss returns a boolean if a field has been set.
func (o *TrainObjective) HasLoss() bool {
if o != nil && !IsNil(o.Loss) {
return true
}
return false
}
// SetLoss gets a reference to the given string and assigns it to the Loss field.
func (o *TrainObjective) SetLoss(v string) {
o.Loss = &v
}
// GetTerms returns the Terms field value if set, zero value otherwise.
func (o *TrainObjective) GetTerms() []TrainTerm {
if o == nil || IsNil(o.Terms) {
var ret []TrainTerm
return ret
}
return o.Terms
}
// GetTermsOk returns a tuple with the Terms field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainObjective) GetTermsOk() ([]TrainTerm, bool) {
if o == nil || IsNil(o.Terms) {
return nil, false
}
return o.Terms, true
}
// HasTerms returns a boolean if a field has been set.
func (o *TrainObjective) HasTerms() bool {
if o != nil && !IsNil(o.Terms) {
return true
}
return false
}
// SetTerms gets a reference to the given []TrainTerm and assigns it to the Terms field.
func (o *TrainObjective) SetTerms(v []TrainTerm) {
o.Terms = v
}
func (o TrainObjective) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o TrainObjective) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Loss) {
toSerialize["loss"] = o.Loss
}
if !IsNil(o.Terms) {
toSerialize["terms"] = o.Terms
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *TrainObjective) UnmarshalJSON(data []byte) (err error) {
varTrainObjective := _TrainObjective{}
err = json.Unmarshal(data, &varTrainObjective)
if err != nil {
return err
}
*o = TrainObjective(varTrainObjective)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "loss")
delete(additionalProperties, "terms")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableTrainObjective struct {
value *TrainObjective
isSet bool
}
func (v NullableTrainObjective) Get() *TrainObjective {
return v.value
}
func (v *NullableTrainObjective) Set(val *TrainObjective) {
v.value = val
v.isSet = true
}
func (v NullableTrainObjective) IsSet() bool {
return v.isSet
}
func (v *NullableTrainObjective) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableTrainObjective(val *TrainObjective) *NullableTrainObjective {
return &NullableTrainObjective{value: val, isSet: true}
}
func (v NullableTrainObjective) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableTrainObjective) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}