Class: Cadenya::Types::ModelSpec_Capability_TopK

Inherits:
Object
  • Object
show all
Defined in:
lib/cadenya/types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type: nil, top_k: nil) ⇒ ModelSpec_Capability_TopK

Returns a new instance of ModelSpec_Capability_TopK.



9417
9418
9419
9420
# File 'lib/cadenya/types.rb', line 9417

def initialize(type: nil, top_k: nil)
  @type = type
  @top_k = top_k
end

Instance Attribute Details

#top_kObject (readonly)

Returns the value of attribute top_k.



9415
9416
9417
# File 'lib/cadenya/types.rb', line 9415

def top_k
  @top_k
end

#typeObject (readonly)

Returns the value of attribute type.



9415
9416
9417
# File 'lib/cadenya/types.rb', line 9415

def type
  @type
end

Class Method Details

.from_json(data) ⇒ Object



9422
9423
9424
9425
9426
9427
# File 'lib/cadenya/types.rb', line 9422

def self.from_json(data)
  new(
    type: data["type"],
    top_k: data["topK"].nil? ? nil : Types::Capability_TopK.from_json(data["topK"]),
  )
end

Instance Method Details

#to_hObject



9429
9430
9431
9432
9433
9434
# File 'lib/cadenya/types.rb', line 9429

def to_h
  {
    type: Util.plain(@type),
    top_k: Util.plain(@top_k),
  }.reject { |_k, v| v.nil? }
end