MCPcopy Create free account
hub / github.com/NVIDIA/FasterTransformer / allocateBuffer

Method allocateBuffer

src/fastertransformer/models/decoder/Decoder.cc:53–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51
52template<typename T>
53void Decoder<T>::allocateBuffer()
54{
55 if (is_allocate_buffer_ == false) {
56 decoder_normed_input_ = reinterpret_cast<T*>(
57 allocator_->reMalloc(decoder_normed_input_, sizeof(T) * max_batch_size_ * hidden_units_, false));
58 self_attn_output_ = reinterpret_cast<T*>(
59 allocator_->reMalloc(self_attn_output_, sizeof(T) * max_batch_size_ * hidden_units_, false));
60 normed_self_attn_output_ = reinterpret_cast<T*>(
61 allocator_->reMalloc(normed_self_attn_output_, sizeof(T) * max_batch_size_ * hidden_units_, false));
62 cross_attn_output_ = reinterpret_cast<T*>(
63 allocator_->reMalloc(cross_attn_output_, sizeof(T) * max_batch_size_ * hidden_units_, false));
64 normed_cross_attn_output_ = reinterpret_cast<T*>(
65 allocator_->reMalloc(normed_cross_attn_output_, sizeof(T) * max_batch_size_ * hidden_units_, false));
66 decoder_layer_output_ = reinterpret_cast<T*>(
67 allocator_->reMalloc(decoder_layer_output_, sizeof(T) * max_batch_size_ * hidden_units_, false));
68 is_allocate_buffer_ = true;
69 }
70}
71
72template<typename T>
73void Decoder<T>::allocateBuffer(size_t batch_size)

Callers

nothing calls this directly

Calls 1

reMallocMethod · 0.80

Tested by

no test coverage detected