Class: Toy::LLM::Archs::LlamaArchForwardOut

Inherits:
Object
  • Object
show all
Defined in:
lib/toy/llm/archs/llama_arch.rb,
lib/toy/llm/archs/llama_arch_cuda.rb,
lib/toy/llm/archs/llama_arch_metal.rb

Overview

Carries the three per-graph OUTPUT handles back to the cache caller, which spreads them onto its OWN ivars so every existing downstream reader (@t_seq_logits accessor, build_training_step CE-loss consumer, examples/06 fcache.t_seq_logits) is untouched.

Hand-written plain class with a positional ctor — NEVER Struct.new (landmine #16 / matz/spinel#1043): a Struct’s synthesized accessors would unify across modules and mis-compile unrelated callers. The member names reuse the cache’s ‘t_seq_*` prefixes (type-isolated, no collision, same rationale as TransformerBlockCtx). Carries values, no behavior.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(t_seq_x_embed, t_seq_x_final, t_seq_logits) ⇒ LlamaArchForwardOut

Returns a new instance of LlamaArchForwardOut.



55
56
57
58
59
# File 'lib/toy/llm/archs/llama_arch.rb', line 55

def initialize(t_seq_x_embed, t_seq_x_final, t_seq_logits)
  @t_seq_x_embed = t_seq_x_embed
  @t_seq_x_final = t_seq_x_final
  @t_seq_logits  = t_seq_logits
end

Instance Attribute Details

#t_seq_logitsObject

Returns the value of attribute t_seq_logits.



53
54
55
# File 'lib/toy/llm/archs/llama_arch.rb', line 53

def t_seq_logits
  @t_seq_logits
end

#t_seq_x_embedObject

Returns the value of attribute t_seq_x_embed.



53
54
55
# File 'lib/toy/llm/archs/llama_arch.rb', line 53

def t_seq_x_embed
  @t_seq_x_embed
end

#t_seq_x_finalObject

Returns the value of attribute t_seq_x_final.



53
54
55
# File 'lib/toy/llm/archs/llama_arch.rb', line 53

def t_seq_x_final
  @t_seq_x_final
end