@@ -377,7 +377,7 @@ at::Tensor update_cache_with_indices_aten(
377377 return output;
378378}
379379
380- std::tuple<Tensor&, Tensor&> channelwise_gated_delta_rule_out_no_context (
380+ std::tuple<Tensor&, Tensor&> gated_delta_rule_out_no_context (
381381 const Tensor& query,
382382 const Tensor& key,
383383 const Tensor& value,
@@ -387,15 +387,15 @@ std::tuple<Tensor&, Tensor&> channelwise_gated_delta_rule_out_no_context(
387387 Tensor& out,
388388 Tensor& final_state_out);
389389
390- std::tuple<at::Tensor, at::Tensor> channelwise_gated_delta_rule_aten (
390+ std::tuple<at::Tensor, at::Tensor> gated_delta_rule_aten (
391391 const at::Tensor& query,
392392 const at::Tensor& key,
393393 const at::Tensor& value,
394394 const at::Tensor& decay,
395395 const at::Tensor& beta,
396396 const at::Tensor& initial_state);
397397
398- std::tuple<at::Tensor&, at::Tensor&> channelwise_gated_delta_rule_out_aten (
398+ std::tuple<at::Tensor&, at::Tensor&> gated_delta_rule_out_aten (
399399 const at::Tensor& query,
400400 const at::Tensor& key,
401401 const at::Tensor& value,
@@ -405,7 +405,7 @@ std::tuple<at::Tensor&, at::Tensor&> channelwise_gated_delta_rule_out_aten(
405405 at::Tensor& out,
406406 at::Tensor& final_state_out);
407407
408- std::tuple<Tensor&, Tensor&> channelwise_gated_delta_rule_out_no_context (
408+ std::tuple<Tensor&, Tensor&> gated_delta_rule_out_no_context (
409409 const Tensor& query,
410410 const Tensor& key,
411411 const Tensor& value,
@@ -415,7 +415,7 @@ std::tuple<Tensor&, Tensor&> channelwise_gated_delta_rule_out_no_context(
415415 Tensor& out,
416416 Tensor& final_state_out) {
417417 executorch::aten::RuntimeContext context{};
418- auto result = torch::executor::native::channelwise_gated_delta_rule_out (
418+ auto result = torch::executor::native::gated_delta_rule_out (
419419 context,
420420 query,
421421 key,
@@ -427,11 +427,11 @@ std::tuple<Tensor&, Tensor&> channelwise_gated_delta_rule_out_no_context(
427427 final_state_out);
428428 TORCH_CHECK (
429429 context.failure_state () == executorch::runtime::Error::Ok,
430- " channelwise_gated_delta_rule failed" );
430+ " gated_delta_rule failed" );
431431 return result;
432432}
433433
434- std::tuple<at::Tensor, at::Tensor> channelwise_gated_delta_rule_aten (
434+ std::tuple<at::Tensor, at::Tensor> gated_delta_rule_aten (
435435 const at::Tensor& query,
436436 const at::Tensor& key,
437437 const at::Tensor& value,
@@ -442,12 +442,12 @@ std::tuple<at::Tensor, at::Tensor> channelwise_gated_delta_rule_aten(
442442 {query.size (0 ), query.size (1 ), query.size (2 ), value.size (3 )},
443443 query.options ());
444444 auto final_state = at::empty_like (initial_state);
445- channelwise_gated_delta_rule_out_aten (
445+ gated_delta_rule_out_aten (
446446 query, key, value, decay, beta, initial_state, output, final_state);
447447 return {output, final_state};
448448}
449449
450- std::tuple<at::Tensor&, at::Tensor&> channelwise_gated_delta_rule_out_aten (
450+ std::tuple<at::Tensor&, at::Tensor&> gated_delta_rule_out_aten (
451451 const at::Tensor& query,
452452 const at::Tensor& key,
453453 const at::Tensor& value,
@@ -458,8 +458,8 @@ std::tuple<at::Tensor&, at::Tensor&> channelwise_gated_delta_rule_out_aten(
458458 at::Tensor& final_state_out) {
459459 TORCH_CHECK (
460460 !initial_state.is_alias_of (final_state_out),
461- " channelwise_gated_delta_rule final_state_out must not alias initial_state." );
462- return WRAP_TO_ATEN (channelwise_gated_delta_rule_out_no_context , 6 )(
461+ " gated_delta_rule final_state_out must not alias initial_state." );
462+ return WRAP_TO_ATEN (gated_delta_rule_out_no_context , 6 )(
463463 query, key, value, decay, beta, initial_state, out, final_state_out);
464464}
465465
@@ -508,6 +508,15 @@ TORCH_LIBRARY_FRAGMENT(llama, m) {
508508 " float? scale=None, Tensor? q_zero_points=None, Tensor? q_scales=None, "
509509 " Tensor? k_zero_points=None, Tensor? k_scales=None, Tensor? v_zero_points=None, "
510510 " Tensor? v_scales=None, bool is_seq_at_dim_2=False, *, Tensor(a!) out) -> Tensor(a!)" );
511+ m.def (
512+ " gated_delta_rule(Tensor query, Tensor key, Tensor value, Tensor decay, "
513+ " Tensor beta, Tensor initial_state) -> (Tensor, Tensor)" );
514+ m.def (
515+ " gated_delta_rule.out(Tensor query, Tensor key, Tensor value, Tensor decay, "
516+ " Tensor beta, Tensor initial_state, *, Tensor(a!) out, Tensor(b!) final_state_out) "
517+ " -> (Tensor(a!), Tensor(b!))" );
518+ // Deprecated alias of gated_delta_rule, kept so graphs and .pte files built
519+ // against the pre-scalar-decay name keep working. Remove once re-exported.
511520 m.def (
512521 " channelwise_gated_delta_rule(Tensor query, Tensor key, Tensor value, Tensor decay, "
513522 " Tensor beta, Tensor initial_state) -> (Tensor, Tensor)" );
@@ -548,10 +557,14 @@ TORCH_LIBRARY_IMPL(llama, CompositeExplicitAutograd, m) {
548557 " custom_quantized_sdpa.out" ,
549558 WRAP_TO_ATEN (
550559 torch::executor::native::custom_quantized_sdpa_out_no_context, 15 ));
560+ m.impl (" gated_delta_rule" , torch::executor::native::gated_delta_rule_aten);
561+ m.impl (
562+ " gated_delta_rule.out" ,
563+ torch::executor::native::gated_delta_rule_out_aten);
551564 m.impl (
552565 " channelwise_gated_delta_rule" ,
553- torch::executor::native::channelwise_gated_delta_rule_aten );
566+ torch::executor::native::gated_delta_rule_aten );
554567 m.impl (
555568 " channelwise_gated_delta_rule.out" ,
556- torch::executor::native::channelwise_gated_delta_rule_out_aten );
569+ torch::executor::native::gated_delta_rule_out_aten );
557570}
0 commit comments