Class: Aura::CodeGen
- Inherits:
-
Object
- Object
- Aura::CodeGen
- Defined in:
- lib/aura/codegen.rb
Overview
Generates runnable Ruby from the semantic node list. Torch models become Torch::NN::Module subclasses with a real forward pass (shapes tracked so Linear in-features are computed correctly); LLM models become HTTP client methods; routes become classic-Sinatra handlers.
Constant Summary collapse
- OPTIMIZERS =
{ adam: "Adam", adamw: "AdamW", sgd: "SGD", rmsprop: "RMSprop", adagrad: "Adagrad" }.freeze
- LOSSES =
{ cross_entropy: "CrossEntropyLoss", mse: "MSELoss", bce: "BCELoss", bce_with_logits: "BCEWithLogitsLoss", nll: "NLLLoss" }.freeze
- SCHEDULERS =
{ step_lr: "StepLR", exponential_lr: "ExponentialLR", cosine_annealing_lr: "CosineAnnealingLR" }.freeze
Class Method Summary collapse
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(nodes) ⇒ CodeGen
constructor
A new instance of CodeGen.
Constructor Details
Class Method Details
.generate(nodes) ⇒ Object
17 18 19 |
# File 'lib/aura/codegen.rb', line 17 def self.generate(nodes) new(nodes).generate end |
Instance Method Details
#generate ⇒ Object
27 28 29 30 31 |
# File 'lib/aura/codegen.rb', line 27 def generate header @nodes.each { |node| emit(node) } @e.to_s end |