From 9e1ce2ba265e2de461685f9206fb9f90cdad1d01 Mon Sep 17 00:00:00 2001 From: Arthur Islamov Date: Mon, 11 Sep 2023 23:49:47 +0400 Subject: [PATCH] Everything works --- .../contrib_ops/cpu/bert/attention_cpu_base.h | 6 ------ .../cpu/bert/multihead_attention.cc | 18 ------------------ 2 files changed, 24 deletions(-) diff --git a/onnxruntime/contrib_ops/cpu/bert/attention_cpu_base.h b/onnxruntime/contrib_ops/cpu/bert/attention_cpu_base.h index 040bc7f7bf326..b761b1afd8529 100644 --- a/onnxruntime/contrib_ops/cpu/bert/attention_cpu_base.h +++ b/onnxruntime/contrib_ops/cpu/bert/attention_cpu_base.h @@ -200,12 +200,6 @@ class AttentionCPUBase : public AttentionBase { }); } - std::cout << "Probs before softmax."; - for (size_t i = 0; i < total_sequence_length * sequence_length * batch_size * num_heads_; ++i) { - std::cout << attention_probs[i] << " "; - } - std::cout << std::endl; - // attention_probs(B, N, S, T) = Softmax(attention_probs) { const int N = batch_size * num_heads_ * sequence_length; diff --git a/onnxruntime/contrib_ops/cpu/bert/multihead_attention.cc b/onnxruntime/contrib_ops/cpu/bert/multihead_attention.cc index 87008d011b5c8..0b55cb7804c61 100644 --- a/onnxruntime/contrib_ops/cpu/bert/multihead_attention.cc +++ b/onnxruntime/contrib_ops/cpu/bert/multihead_attention.cc @@ -139,30 +139,12 @@ Status AddBiasTranspose(const Tensor* qkv, // Input: Q/K/V dat }); } - std::cout << "After bias add."; - std::cout << std::endl; - auto tensor = qkv_with_bias.GetMutable(); - auto data = tensor->MutableData(); - for (size_t i = 0; i < batch_size * sequence_length * hidden_size; ++i) { - std::cout << data[i] << " "; - } - std::cout << std::endl; - // Reshape Q from BxSxD to BxSxNxH ORT_RETURN_IF_ERROR(Reshape_BSD_to_BSNH(qkv_with_bias.GetMutable(), batch_size, sequence_length, num_heads, head_size)); // Transpose Q from BxSxNxH to BxNxSxH ORT_RETURN_IF_ERROR(Transpose_BSNH_to_BNSH(qkv_with_bias.GetMutable(), qkv_with_bias_transposed)); - std::cout << "After transpose."; - std::cout << std::endl; - tensor = qkv_with_bias_transposed.GetMutable(); - data = tensor->MutableData(); - for (size_t i = 0; i < batch_size * sequence_length * hidden_size; ++i) { - std::cout << data[i] << " "; - } - std::cout << std::endl; - return Status::OK(); }