Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
tensör akışı:: Tensör Tamponu
Bu soyut bir sınıftır. #include <tensor.h>
Özet
Ham ref sayılan veri arabelleğine erişim için arayüz.
Miras
Miras aldığı kaynak: RefCounted
Kamu işlevleri |
---|
FillAllocationDescription (AllocationDescription *proto) const =0 | virtual void Tahsisle ilgili meta verileri protokole doldurur. |
GetAllocatedBytes (size_t *out_bytes) const | virtual bool |
OwnsMemory () const | virtual bool |
base () const | T * Arabelleği bir T dizisi olarak yeniden yorumlamaya yönelik yardımcı yöntem. |
data () const | void * |
root_buffer ()=0 | |
size () const =0 | virtual size_t Tamponun boyutu (bayt cinsinden). |
Kamu işlevleri
Tahsis Açıklamasını Doldur
virtual void FillAllocationDescription(
AllocationDescription *proto
) const =0
Tahsisle ilgili meta verileri protokole doldurur.
GetAllocatedBytes
virtual bool GetAllocatedBytes(
size_t *out_bytes
) const
Sahip olunanBellek
virtual bool OwnsMemory() const
Tensör Tamponu
TensorBuffer(
void *data_ptr
)
temel
T * base() const
Arabelleği bir T
dizisi olarak yeniden yorumlamaya yönelik yardımcı yöntem.
veri
void * data() const
data() , size() baytlık bir bellek bölgesine işaret eder.
NOT(mrry): data()
yöntemi, performans nedenleriyle sanal değildir. Bir Tensor
içeriğine erişildiğinde birden çok kez çağrılabilir ve böylece onu sanal olmayan hale getirmek, gövdenin satır içi olmasına olanak tanır.
boyut
virtual size_t size() const =0
Tamponun boyutu (bayt cinsinden).
~Tensör Tamponu
~TensorBuffer() override
Aksi belirtilmediği sürece bu sayfanın içeriği Creative Commons Atıf 4.0 Lisansı altında ve kod örnekleri Apache 2.0 Lisansı altında lisanslanmıştır. Ayrıntılı bilgi için Google Developers Site Politikaları'na göz atın. Java, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-07-26 UTC.
[null,null,["Son güncelleme tarihi: 2025-07-26 UTC."],[],[],null,["# tensorflow::TensorBuffer Class Reference\n\ntensorflow::TensorBuffer\n========================\n\n**This is an abstract class.** \n\n`#include \u003ctensor.h\u003e`\n\nSummary\n-------\n\nInterface to access the raw ref-counted data buffer.\n\n### Inheritance\n\nInherits from: RefCounted\n\n| ### Constructors and Destructors ||\n|---|---|\n| [TensorBuffer](#classtensorflow_1_1_tensor_buffer_1ade0441d867aabc7d8c4f4a553d1e5fd3)`(void *data_ptr)` ||\n| [~TensorBuffer](#classtensorflow_1_1_tensor_buffer_1a18b48c272459852177bbc653354b5b9a)`()` ||\n\n| ### Public functions ||\n|---------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [FillAllocationDescription](#classtensorflow_1_1_tensor_buffer_1ab705a2c85f480e615dad7e7456fc121a)`(AllocationDescription *proto) const =0` | `virtual void` Fills metadata about the allocation into the proto. |\n| [GetAllocatedBytes](#classtensorflow_1_1_tensor_buffer_1a4a9ed5ee51dc0ab5c1326fba4fb41e41)`(size_t *out_bytes) const ` | `virtual bool` |\n| [OwnsMemory](#classtensorflow_1_1_tensor_buffer_1a3c7bd551682ef698b66f432c32a3419f)`() const ` | `virtual bool` Whether this [TensorBuffer](/versions/r2.3/api_docs/cc/class/tensorflow/tensor-buffer#classtensorflow_1_1_tensor_buffer) owns the underlying memory. |\n| [base](#classtensorflow_1_1_tensor_buffer_1a13f72af307351613523799b8b3944ed5)`() const ` | `T *` Helper method to reinterpret the buffer as an array of `T`. |\n| [data](#classtensorflow_1_1_tensor_buffer_1a7e8cdbb48073e1a8890427acad00a30e)`() const ` | `void *` [data()](/versions/r2.3/api_docs/cc/class/tensorflow/tensor-buffer#classtensorflow_1_1_tensor_buffer_1a7e8cdbb48073e1a8890427acad00a30e) points to a memory region of [size()](/versions/r2.3/api_docs/cc/class/tensorflow/tensor-buffer#classtensorflow_1_1_tensor_buffer_1a36b022bd5ed41ce31242d6f3bbe6757b) bytes. |\n| [root_buffer](#classtensorflow_1_1_tensor_buffer_1a0b406028a1e487cca2eacca453381fc3)`()=0` | `virtual `[TensorBuffer](/versions/r2.3/api_docs/cc/class/tensorflow/tensor-buffer#classtensorflow_1_1_tensor_buffer)` *` If this [TensorBuffer](/versions/r2.3/api_docs/cc/class/tensorflow/tensor-buffer#classtensorflow_1_1_tensor_buffer) is sub-buffer of another [TensorBuffer](/versions/r2.3/api_docs/cc/class/tensorflow/tensor-buffer#classtensorflow_1_1_tensor_buffer), returns that [TensorBuffer](/versions/r2.3/api_docs/cc/class/tensorflow/tensor-buffer#classtensorflow_1_1_tensor_buffer). |\n| [size](#classtensorflow_1_1_tensor_buffer_1a36b022bd5ed41ce31242d6f3bbe6757b)`() const =0` | `virtual size_t` Size (in bytes) of the buffer. |\n\nPublic functions\n----------------\n\n### FillAllocationDescription\n\n```gdscript\nvirtual void FillAllocationDescription(\n AllocationDescription *proto\n) const =0\n``` \nFills metadata about the allocation into the proto. \n\n### GetAllocatedBytes\n\n```gdscript\nvirtual bool GetAllocatedBytes(\n size_t *out_bytes\n) const \n``` \n\n### OwnsMemory\n\n```gdscript\nvirtual bool OwnsMemory() const \n``` \nWhether this [TensorBuffer](/versions/r2.3/api_docs/cc/class/tensorflow/tensor-buffer#classtensorflow_1_1_tensor_buffer) owns the underlying memory. \n\n### TensorBuffer\n\n```scdoc\n TensorBuffer(\n void *data_ptr\n)\n``` \n\n### base\n\n```gdscript\nT * base() const \n``` \nHelper method to reinterpret the buffer as an array of `T`. \n\n### data\n\n```gdscript\nvoid * data() const \n``` \n[data()](/versions/r2.3/api_docs/cc/class/tensorflow/tensor-buffer#classtensorflow_1_1_tensor_buffer_1a7e8cdbb48073e1a8890427acad00a30e) points to a memory region of [size()](/versions/r2.3/api_docs/cc/class/tensorflow/tensor-buffer#classtensorflow_1_1_tensor_buffer_1a36b022bd5ed41ce31242d6f3bbe6757b) bytes.\n\nNOTE(mrry): The [data()](/versions/r2.3/api_docs/cc/class/tensorflow/tensor-buffer#classtensorflow_1_1_tensor_buffer_1a7e8cdbb48073e1a8890427acad00a30e) method is not virtual for performance reasons. It can be called multiple times when the contents of a [Tensor](/versions/r2.3/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor) are accessed, and so making it non-virtual allows the body to be inlined. \n\n### root_buffer\n\n```scdoc\nvirtual TensorBuffer * root_buffer()=0\n``` \nIf this [TensorBuffer](/versions/r2.3/api_docs/cc/class/tensorflow/tensor-buffer#classtensorflow_1_1_tensor_buffer) is sub-buffer of another [TensorBuffer](/versions/r2.3/api_docs/cc/class/tensorflow/tensor-buffer#classtensorflow_1_1_tensor_buffer), returns that [TensorBuffer](/versions/r2.3/api_docs/cc/class/tensorflow/tensor-buffer#classtensorflow_1_1_tensor_buffer).\n\nOtherwise, returns this. \n\n### size\n\n```gdscript\nvirtual size_t size() const =0\n``` \nSize (in bytes) of the buffer. \n\n### \\~TensorBuffer\n\n```text\n ~TensorBuffer() override\n```"]]