टेंसरफ़्लो:: टेन्सर
#include <tensor.h>
मूल्यों की एक एन-आयामी सरणी का प्रतिनिधित्व करता है।
सारांश
निर्माता और विनाशक | |
---|---|
Tensor () 1-आयामी, 0-तत्व फ्लोट टेंसर बनाता है। | |
Tensor (DataType type, const TensorShape & shape) | |
Tensor (Allocator *a, DataType type, const TensorShape & shape) अंतर्निहित बफर आवंटित करने के लिए आवंटक a उपयोग करके इनपुट type और shape के साथ एक टेंसर बनाता है। | |
Tensor (Allocator *a, DataType type, const TensorShape & shape, const AllocationAttributes & allocation_attr) अंतर्निहित बफर आवंटित करने के लिए आवंटक a और निर्दिष्ट "allocation_attr" का उपयोग करके इनपुट type और shape के साथ एक टेंसर बनाता है। | |
Tensor (DataType type, const TensorShape & shape, TensorBuffer *buf) इनपुट डेटाटाइप, शेप और बफ के साथ एक टेंसर बनाता है। | |
Tensor (DataType type) दिए गए डेटा प्रकार का एक खाली टेंसर बनाता है। | |
Tensor (float scalar_value) | |
Tensor (double scalar_value) | |
Tensor (int32 scalar_value) | |
Tensor (uint32 scalar_value) | |
Tensor (uint16 scalar_value) | |
Tensor (uint8 scalar_value) | |
Tensor (int16 scalar_value) | |
Tensor (int8 scalar_value) | |
Tensor (tstring scalar_value) | |
Tensor (complex64 scalar_value) | |
Tensor (complex128 scalar_value) | |
Tensor (int64 scalar_value) | |
Tensor (uint64 scalar_value) | |
Tensor (bool scalar_value) | |
Tensor (qint8 scalar_value) | |
Tensor (quint8 scalar_value) | |
Tensor (qint16 scalar_value) | |
Tensor (quint16 scalar_value) | |
Tensor (qint32 scalar_value) | |
Tensor (bfloat16 scalar_value) | |
Tensor (Eigen::half scalar_value) | |
Tensor (ResourceHandle scalar_value) | |
Tensor (const char *scalar_value) | |
Tensor (const Tensor & other) कॉपी कंस्ट्रक्टर। | |
Tensor ( Tensor && other) कंस्ट्रक्टर ले जाएँ। | |
~Tensor () |
सार्वजनिक समारोह | |
---|---|
AllocatedBytes () const | size_t |
AsProtoField (TensorProto *proto) const | void *this टेंसर की सामग्री के साथ proto में भरता है। |
AsProtoTensorContent (TensorProto *proto) const | void |
BitcastFrom (const Tensor & other, DataType dtype, const TensorShape & shape) | अन्य टेंसर को इस टेंसर में कॉपी करें, इसे दोबारा बदलें और बफर के डेटाटाइप को दोबारा परिभाषित करें। |
CopyFrom (const Tensor & other, const TensorShape & shape) TF_MUST_USE_RESULT | bool अन्य टेंसर को इस टेंसर में कॉपी करें और इसे फिर से आकार दें। |
DebugString (int num_values) const | string डिबगिंग के लिए उपयुक्त टेंसर का मानव-पठनीय सारांश। |
DebugString () const | string |
DeviceSafeDebugString () const | string |
FillDescription (TensorDescription *description) const | void निगरानी और डिबगिंग के लिए उपयोगी टेंसर के बारे में मेटाडेटा के साथ TensorDescription प्रोटो भरें। |
FromProto (const TensorProto & other) TF_MUST_USE_RESULT | bool other को पार्स करें और टेंसर का निर्माण करें। |
FromProto (Allocator *a, const TensorProto & other) TF_MUST_USE_RESULT | bool |
IsAligned () const | bool यदि यह टेंसर संरेखित है तो सही है। |
IsInitialized () const | bool यदि आवश्यक हो, तो क्या इस Tensor को इनिशियलाइज़ किया गया है? |
IsSameSize (const Tensor & b) const | bool |
NumElements () const | int64 टेंसर आकार के लिए सुविधा एक्सेसर। |
SharesBufferWith (const Tensor & b) const | bool |
Slice (int64 dim0_start, int64 dim0_limit) const | इस टेंसर को पहले आयाम के साथ काटें। |
SubSlice (int64 index) const | इस टेंसर से पहले आयाम के साथ एक उपखंड का चयन करें। |
SummarizeValue (int64 max_entries, bool print_v2) const | string *this में पहले max_entries मानों को एक स्ट्रिंग में प्रस्तुत करें। |
TotalBytes () const | size_t इस टेंसर के अनुमानित मेमोरी उपयोग को लौटाता है। |
UnsafeCopyFromInternal (const Tensor & other, DataType dtype, const TensorShape & shape) | void बिटकास्टफ्रॉम की तरह, लेकिन अगर कोई पूर्व शर्त पूरी नहीं होती है तो जांच विफल हो जाती है। |
bit_casted_shaped (gtl::ArraySlice< int64 > new_sizes) | TTypes< T, NDIMS >:: Tensor टेन्सर डेटा को Eigen::Tensor पर लौटाएं और new_sizes में निर्दिष्ट नए आकार के साथ और एक नए dtype T पर कास्ट करें। |
bit_casted_shaped (gtl::ArraySlice< int64 > new_sizes) const | TTypes< T, NDIMS >::ConstTensor टेन्सर डेटा को Eigen::Tensor पर लौटाएं और new_sizes में निर्दिष्ट नए आकार के साथ और एक नए dtype T पर कास्ट करें। |
bit_casted_tensor () | TTypes< T, NDIMS >:: Tensor एक ही आकार के साथ एक Eigen::Tensor पर टेंसर डेटा लौटाएं, लेकिन निर्दिष्ट dtype T पर थोड़ा सा कास्ट करें। |
bit_casted_tensor () const | TTypes< T, NDIMS >::ConstTensor एक ही आकार के साथ एक Eigen::Tensor पर टेंसर डेटा लौटाएं, लेकिन निर्दिष्ट dtype T पर थोड़ा सा कास्ट करें। |
dim_size (int d) const | int64 टेंसर आकार के लिए सुविधा एक्सेसर। |
dims () const | int टेंसर आकार के लिए सुविधा एक्सेसर। |
dtype () const | DataType डेटा प्रकार लौटाता है। |
flat () | TTypes< T >::Flat टेंसर डेटा को डेटा प्रकार और निर्दिष्ट आकार के Eigen::Tensor के रूप में लौटाएं। |
flat () const | TTypes< T >::ConstFlat |
flat_inner_dims () | TTypes< T, NDIMS >:: Tensor डेटा को एक Eigen::Tensor के रूप में NDIMS आयामों के साथ लौटाता है, परिणाम के पहले आयाम में सभी Tensor आयामों को लेकिन अंतिम NDIMS-1 को संक्षिप्त करता है। |
flat_inner_dims () const | TTypes< T, NDIMS >::ConstTensor |
flat_inner_outer_dims (int64 begin) | TTypes< T, NDIMS >:: Tensor |
flat_inner_outer_dims (int64 begin) const | TTypes< T, NDIMS >::ConstTensor |
flat_outer_dims () | TTypes< T, NDIMS >:: Tensor डेटा को एक Eigen::Tensor के रूप में NDIMS आयामों के साथ लौटाता है, परिणाम के अंतिम आयाम में सभी Tensor आयामों को लेकिन पहले NDIMS-1 को संक्षिप्त करता है। |
flat_outer_dims () const | TTypes< T, NDIMS >::ConstTensor |
matrix () | TTypes< T >::Matrix |
matrix () const | TTypes< T >::ConstMatrix |
operator= (const Tensor & other) | Tensor & ऑपरेटर असाइन करें। यह टेंसर दूसरे के अंतर्निहित भंडारण को साझा करता है। |
operator= ( Tensor && other) | Tensor & ऑपरेटर ले जाएँ। विवरण के लिए मूव कंस्ट्रक्टर देखें। |
reinterpret_last_dimension () | TTypes< T, NDIMS >:: Tensor अंतिम आयाम तत्वों के साथ एक बड़े प्रकार के एकल तत्वों में परिवर्तित होने के साथ एक Eigen::Tensor पर टेंसर डेटा लौटाएं। |
reinterpret_last_dimension () const | TTypes< T, NDIMS >::ConstTensor अंतिम आयाम तत्वों के साथ एक बड़े प्रकार के एकल तत्वों में परिवर्तित होने के साथ एक Eigen::Tensor पर टेंसर डेटा लौटाएं। |
scalar () | TTypes< T >::Scalar |
scalar () const | TTypes< T >::ConstScalar |
shape () const | const TensorShape & टेंसर का आकार लौटाता है। |
shaped (gtl::ArraySlice< int64 > new_sizes) | TTypes< T, NDIMS >:: Tensor |
shaped (gtl::ArraySlice< int64 > new_sizes) const | TTypes< T, NDIMS >::ConstTensor |
tensor () | TTypes< T, NDIMS >:: Tensor |
tensor () const | TTypes< T, NDIMS >::ConstTensor |
tensor_data () const | StringPiece एक StringPiece लौटाता है जो वर्तमान टेंसर के बफर को मैप करता है। |
unaligned_flat () | TTypes< T >::UnalignedFlat |
unaligned_flat () const | TTypes< T >::UnalignedConstFlat |
unaligned_shaped (gtl::ArraySlice< int64 > new_sizes) | TTypes< T, NDIMS >::UnalignedTensor |
unaligned_shaped (gtl::ArraySlice< int64 > new_sizes) const | TTypes< T, NDIMS >::UnalignedConstTensor |
vec () | TTypes< T >::Vec इस टेंसर के प्रकार और आकार के साथ टेंसर डेटा को Eigen::Tensor Tensor रूप में लौटाएं। |
vec () const | TTypes< T >::ConstVec उपरोक्त सभी विधियों के कॉन्स्ट संस्करण। |
सार्वजनिक समारोह
आवंटित बाइट्स
size_t AllocatedBytes() const
असप्रोटोफिल्ड
void AsProtoField( TensorProto *proto ) const
*this
टेंसर की सामग्री के साथ proto
में भरता है।
AsProtoField()
के लिए दोहराए गए फ़ील्ड में भरता है, जबकि AsProtoTensorContent()
proto.dtype()
कॉम्पैक्ट रूप में proto.tensor_content()
में सामग्री को एन्कोड करता है।
AsProtoTensorContent
void AsProtoTensorContent( TensorProto *proto ) const
बिटकास्टफ्रॉम
Status BitcastFrom( const Tensor & other, DataType dtype, const TensorShape & shape )
अन्य टेंसर को इस टेंसर में कॉपी करें, इसे दोबारा बदलें और बफर के डेटाटाइप को दोबारा परिभाषित करें।
यदि Status::OK() लौटाया जाता है, तो दो टेंसर अब समान अंतर्निहित संग्रहण साझा करते हैं।
इस कॉल के लिए आवश्यक है कि other
टेंसर और दिए गए प्रकार और आकार "संगत" हों (यानी वे समान बाइट्स पर कब्जा करते हैं)।
विशेष रूप से:
आकार.num_elements () * डेटा प्रकार आकार (प्रकार)
बराबर होना चाहिए
Other.num_elements () * डेटा टाइपसाइज (अन्य। डी टाइप ())
इसके अलावा, इस फ़ंक्शन की आवश्यकता है:
- DataTypeSize(other.dtype ()) != 0
- डेटा टाइपसाइज (प्रकार)! = 0
यदि कोई भी आवश्यकता पूरी नहीं होती है, तो error::InvalidArgument लौटा दिया जाता है।
से प्रतिलिपि बनाएँ
bool CopyFrom( const Tensor & other, const TensorShape & shape ) TF_MUST_USE_RESULT
अन्य टेंसर को इस टेंसर में कॉपी करें और इसे फिर से आकार दें।
यह टेंसर दूसरे के अंतर्निहित भंडारण को साझा करता है। यदि अन्य। other.shape()
में दिए गए shape
के तत्वों की संख्या समान है, तो true
है।
डीबगस्ट्रिंग
string DebugString( int num_values ) const
डिबगिंग के लिए उपयुक्त टेंसर का मानव-पठनीय सारांश।
डीबगस्ट्रिंग
string DebugString() const
डिवाइससेफडीबगस्ट्रिंग
string DeviceSafeDebugString() const
विवरण भरें
void FillDescription( TensorDescription *description ) const
निगरानी और डिबगिंग के लिए उपयोगी टेंसर के बारे में मेटाडेटा के साथ TensorDescription
प्रोटो भरें।
फ्रॉमप्रोटो
bool FromProto( const TensorProto & other ) TF_MUST_USE_RESULT
other
को पार्स करें और टेंसर का निर्माण करें।
यदि पार्सिंग सफल होती है तो true
लौटाता है। यदि पार्सिंग विफल हो जाती है, तो *this
की स्थिति अपरिवर्तित रहती है।
फ्रॉमप्रोटो
bool FromProto( Allocator *a, const TensorProto & other ) TF_MUST_USE_RESULT
संरेखित है
bool IsAligned() const
यदि यह टेंसर संरेखित है तो सही है।
आरंभिक है
bool IsInitialized() const
यदि आवश्यक हो, तो क्या इस Tensor को इनिशियलाइज़ किया गया है?
ज़ीरो-एलिमेंट टेंसर को हमेशा इनिशियलाइज़ माना जाता है, भले ही उन्हें कभी भी असाइन नहीं किया गया हो और उनके पास कोई मेमोरी आवंटित न हो।
समान आकार
bool IsSameSize( const Tensor & b ) const
संख्या तत्व
int64 NumElements() const
टेंसर आकार के लिए सुविधा एक्सेसर।
शेयरबफरविथ
bool SharesBufferWith( const Tensor & b ) const
टुकड़ा
Tensor Slice( int64 dim0_start, int64 dim0_limit ) const
इस टेंसर को पहले आयाम के साथ काटें।
यानी, लौटा हुआ टेंसर संतुष्ट करता है [i, ...] == यह [dim0_start + i, ...]। लौटा हुआ टेंसर इस टेंसर के साथ अंतर्निहित टेंसर बफर को साझा करता है।
नोट: लौटा हुआ टेंसर आकार के आधार पर इस टेंसर के समान संरेखण आवश्यकता को पूरा नहीं कर सकता है। संरेखण की आवश्यकता वाले कुछ तरीकों को कॉल करने से पहले कॉलर को लौटाए गए टेंसर के संरेखण की जांच करनी चाहिए (उदाहरण के लिए, flat()
, tensor()
)।
नोट: जब एक एन-आयामी टेंसर के साथ खिलाया जाता है, तो यह विधि एन आयामों के साथ एक टेंसर भी लौटाती है। यदि आप एक सब टेन्सर का चयन करना चाहते हैं, तो सबस्लाइस देखें।
आवश्यकताएँ: dims()
>= 1 आवश्यक: 0 <= dim0_start <= dim0_limit <= dim_size(0)
सबस्लाइस
Tensor SubSlice( int64 index ) const
इस टेंसर से पहले आयाम के साथ एक उपखंड का चयन करें।
जब एन-डायमेंशनल टेंसर के साथ फीड किया जाता है, तो यह विधि एन -1 आयामों के साथ एक टेंसर लौटाती है, जहां लौटा हुआ टेंसर पहले आयाम के साथ इनपुट टेंसर का एक सबस्लाइस होता है। लौटे टेंसर के N-1 आयाम इनपुट टेंसर के अंतिम N-1 आयाम हैं।
नोट: लौटा हुआ टेंसर आकार के आधार पर इस टेंसर के समान संरेखण आवश्यकता को पूरा नहीं कर सकता है। संरेखण की आवश्यकता वाले कुछ तरीकों को कॉल करने से पहले कॉलर को लौटाए गए टेंसर के संरेखण की जांच करनी चाहिए (उदाहरण के लिए, flat()
, tensor()
)।
आवश्यकताएँ: dims()
>= 1 आवश्यकताएँ: 0 <= dim0_start < dim_size(0)
सारांश मूल्य
string SummarizeValue( int64 max_entries, bool print_v2 ) const
*this
में पहले max_entries
मानों को एक स्ट्रिंग में प्रस्तुत करें।
टेन्सर
Tensor()
1-आयामी, 0-तत्व फ्लोट टेंसर बनाता है।
लौटा हुआ टेंसर एक अदिश (आकार {}) नहीं है, बल्कि एक खाली एक-आयामी टेंसर (आकार {0}, NumElements() == 0) है। चूंकि इसमें कोई तत्व नहीं है, इसलिए इसे एक मान निर्दिष्ट करने की आवश्यकता नहीं है और डिफ़ॉल्ट रूप से प्रारंभ किया जाता है ( IsInitialized() सत्य है)। यदि यह अवांछनीय है, तो एक-तत्व स्केलर बनाने पर विचार करें, जिसके लिए आरंभीकरण की आवश्यकता होती है:
Tensor(DT_FLOAT, TensorShape({}))
Tensor
Tensor( DataType type, const TensorShape & shape )
दिए गए type
और shape
का एक टेंसर बनाता है।
अगर LogMemory::IsEnabled() आवंटन को अज्ञात कर्नेल और चरण से आने के रूप में लॉग किया गया है। ऑप के भीतर से सीधे टेंसर कंस्ट्रक्टर को कॉल करना बहिष्कृत है: एक नया टेंसर आवंटित करने के लिए OpKernelConstruction/OpKernelContext आवंटित_* विधियों का उपयोग करें, जो कर्नेल और चरण को रिकॉर्ड करते हैं।
अंतर्निहित बफर को CPUAllocator
का उपयोग करके आवंटित किया जाता है।
टेन्सर
Tensor( Allocator *a, DataType type, const TensorShape & shape )
अंतर्निहित बफर आवंटित करने के लिए आवंटक a
उपयोग करके इनपुट type
और shape
के साथ एक टेंसर बनाता है।
अगर LogMemory::IsEnabled() आवंटन को अज्ञात कर्नेल और चरण से आने के रूप में लॉग किया गया है। ऑप के भीतर से सीधे टेंसर कंस्ट्रक्टर को कॉल करना बहिष्कृत है: एक नया टेंसर आवंटित करने के लिए OpKernelConstruction/OpKernelContext आवंटित_* विधियों का उपयोग करें, जो कर्नेल और चरण को रिकॉर्ड करते हैं।
a
को इस Tensor के जीवनकाल से बाहर निकलना चाहिए।
टेन्सर
Tensor( Allocator *a, DataType type, const TensorShape & shape, const AllocationAttributes & allocation_attr )
अंतर्निहित बफर आवंटित करने के लिए आवंटक a
और निर्दिष्ट "allocation_attr" का उपयोग करके इनपुट type
और shape
के साथ एक टेंसर बनाता है।
यदि कर्नेल और चरण ज्ञात हैं आबंटन_attr.allocation_will_be_logged को सही पर सेट किया जाना चाहिए और LogMemory::RecordTensorAllocation को टेंसर के निर्माण के बाद कॉल किया जाना चाहिए। ऑप के भीतर से सीधे टेंसर कंस्ट्रक्टर को कॉल करना बहिष्कृत है: एक नया टेंसर आवंटित करने के लिए OpKernelConstruction/OpKernelContext आवंटित_* विधियों का उपयोग करें, जो कर्नेल और चरण को रिकॉर्ड करते हैं।
a
को इस Tensor के जीवनकाल से बाहर निकलना चाहिए।
टेन्सर
Tensor( DataType type, const TensorShape & shape, TensorBuffer *buf )
इनपुट डेटाटाइप, शेप और बफ के साथ एक टेंसर बनाता है।
इस टेंसर से संबंधित buf पर एक रेफरी प्राप्त करता है।
टेन्सर
Tensor( DataType type )
दिए गए डेटा प्रकार का एक खाली टेंसर बनाता है।
Tensor() की तरह, IsInitialized() के साथ एक 1-आयामी, 0-तत्व Tensor लौटाता है जो True लौटाता है। विवरण के लिए Tensor() दस्तावेज़ देखें।
टेन्सर
Tensor( float scalar_value )
टेन्सर
Tensor( double scalar_value )
टेन्सर
Tensor( int32 scalar_value )
टेन्सर
Tensor( uint32 scalar_value )
टेन्सर
Tensor( uint16 scalar_value )
टेन्सर
Tensor( uint8 scalar_value )
टेन्सर
Tensor( int16 scalar_value )
टेन्सर
Tensor( int8 scalar_value )
टेन्सर
Tensor( tstring scalar_value )
टेन्सर
Tensor( complex64 scalar_value )
टेन्सर
Tensor( complex128 scalar_value )
टेन्सर
Tensor( int64 scalar_value )
टेन्सर
Tensor( uint64 scalar_value )
टेन्सर
Tensor( bool scalar_value )
टेन्सर
Tensor( qint8 scalar_value )
टेन्सर
Tensor( quint8 scalar_value )
टेन्सर
Tensor( qint16 scalar_value )
टेन्सर
Tensor( quint16 scalar_value )
टेन्सर
Tensor( qint32 scalar_value )
टेन्सर
Tensor( bfloat16 scalar_value )
टेन्सर
Tensor( Eigen::half scalar_value )
टेन्सर
Tensor( ResourceHandle scalar_value )
टेन्सर
Tensor( const char *scalar_value )
टेन्सर
Tensor( Tensor && other )
कंस्ट्रक्टर ले जाएँ।
इस कॉल के बाद,
टोटलबाइट्स
size_t TotalBytes() const
इस टेंसर के अनुमानित मेमोरी उपयोग को लौटाता है।
UnsafeCopy FromInternal
void UnsafeCopyFromInternal( const Tensor & other, DataType dtype, const TensorShape & shape )
बिटकास्टफ्रॉम की तरह, लेकिन अगर कोई पूर्व शर्त पूरी नहीं होती है तो जांच विफल हो जाती है।
पदावनत। इसके बजाय बिटकास्ट से उपयोग करें और लौटाई गई स्थिति जांचें।
बिट_कास्टेड_शेप्ड
TTypes< T, NDIMS >::Tensor bit_casted_shaped( gtl::ArraySlice< int64 > new_sizes )
टेन्सर डेटा को Eigen::Tensor
पर लौटाएं और new_sizes
में निर्दिष्ट नए आकार के साथ और एक नए dtype T
पर कास्ट करें।
बिटकास्ट का उपयोग करना और प्रतिलिपि संचालन के लिए उपयोगी है। अनुमत बिटकास्ट shaped()
से एकमात्र अंतर है।
बिट_कास्टेड_शेप्ड
TTypes< T, NDIMS >::ConstTensor bit_casted_shaped( gtl::ArraySlice< int64 > new_sizes ) const
टेन्सर डेटा को Eigen::Tensor
पर लौटाएं और new_sizes
में निर्दिष्ट नए आकार के साथ और एक नए dtype T
पर कास्ट करें।
बिटकास्ट का उपयोग करना और प्रतिलिपि संचालन के लिए उपयोगी है। अनुमत बिटकास्ट shaped()
से एकमात्र अंतर है।
bit_casted_tensor
TTypes< T, NDIMS >::Tensor bit_casted_tensor()
एक ही आकार के साथ एक Eigen::Tensor
पर टेंसर डेटा लौटाएं, लेकिन निर्दिष्ट dtype T
पर थोड़ा सा कास्ट करें।
बिटकास्ट का उपयोग करना और प्रतिलिपि संचालन के लिए उपयोगी है। नोट: यह tensor()
जैसा ही है, सिवाय इसके कि बिटकास्ट की अनुमति है।
bit_casted_tensor
TTypes< T, NDIMS >::ConstTensor bit_casted_tensor() const
एक ही आकार के साथ एक Eigen::Tensor
पर टेंसर डेटा लौटाएं, लेकिन निर्दिष्ट dtype T
पर थोड़ा सा कास्ट करें।
बिटकास्ट का उपयोग करना और प्रतिलिपि संचालन के लिए उपयोगी है। नोट: यह tensor()
जैसा ही है, सिवाय इसके कि बिटकास्ट की अनुमति है।
मंद_आकार
int64 dim_size( int d ) const
टेंसर आकार के लिए सुविधा एक्सेसर।
मंद
int dims() const
टेंसर आकार के लिए सुविधा एक्सेसर।
सभी शेप एक्सेसर्स के लिए, tensor_shape.h
के प्रासंगिक तरीकों के लिए TensorShape
में टिप्पणियाँ देखें।
डीटाइप
DataType dtype() const
डेटा प्रकार लौटाता है।
समतल
TTypes< T >::Flat flat()
टेंसर डेटा को डेटा प्रकार और निर्दिष्ट आकार के Eigen::Tensor
के रूप में लौटाएं।
ये विधियां आपको अपनी पसंद के आयामों और आकारों के साथ डेटा तक पहुंचने की अनुमति देती हैं। उन्हें कॉल करने के लिए आपको टेंसर के आयामों की संख्या जानने की आवश्यकता नहीं है। हालांकि, वे CHECK
हैं कि प्रकार से मेल खाता है और अनुरोधित आयाम टेंसर के समान तत्वों के साथ एक Eigen::Tensor
बनाता है।
उदाहरण:
typedef float T; Tensor my_ten(...built with Shape{planes: 4, rows: 3, cols: 5}...); // 1D Eigen::Tensor, size 60: auto flat = my_ten.flat(); // 2D Eigen::Tensor 12 x 5: auto inner = my_ten.flat_inner_dims (); // 2D Eigen::Tensor 4 x 15: auto outer = my_ten.shaped ({4, 15}); // CHECK fails, bad num elements: auto outer = my_ten.shaped ({4, 8}); // 3D Eigen::Tensor 6 x 5 x 2: auto weird = my_ten.shaped ({6, 5, 2}); // CHECK fails, type mismatch: auto bad = my_ten.flat ();
flat
TTypes< T >::ConstFlat flat() const
फ्लैट_इनर_डिम्स
TTypes< T, NDIMS >::Tensor flat_inner_dims()
फ्लैट_इनर_डिम्स
TTypes< T, NDIMS >::ConstTensor flat_inner_dims() const
फ्लैट_इनर_आउटर_डिम्स
TTypes< T, NDIMS >::Tensor flat_inner_outer_dims( int64 begin )
NDIMS आयामों के साथ एक Eigen::Tensor के रूप में डेटा लौटाता है, परिणाम के पहले आयाम में पहले 'शुरुआत' टेंसर आयामों को ढहाता है और अंतिम आयाम के टेंसर आयामों () - 'शुरू' - NDIMS को अंतिम आयाम में बदल देता है नतीजा।
अगर 'शुरू' <0 तो |'शुरू'| आकार 1 के प्रमुख आयाम जोड़े जाएंगे। यदि 'प्रारंभ' + NDIMS > dims() तो 'प्रारंभ' + NDIMS - dims() आकार 1 के अनुगामी आयाम जोड़े जाएंगे।
फ्लैट_इनर_आउटर_डिम्स
TTypes< T, NDIMS >::ConstTensor flat_inner_outer_dims( int64 begin ) const
फ्लैट_आउटर_डिम्स
TTypes< T, NDIMS >::Tensor flat_outer_dims()
फ्लैट_आउटर_डिम्स
TTypes< T, NDIMS >::ConstTensor flat_outer_dims() const
आव्यूह
TTypes< T >::Matrix matrix()
आव्यूह
TTypes< T >::ConstMatrix matrix() const
ऑपरेटर =
Tensor & operator=( const Tensor & other )
ऑपरेटर असाइन करें। यह टेंसर दूसरे के अंतर्निहित भंडारण को साझा करता है।
पुनर्व्याख्या_अंतिम_आयाम
TTypes< T, NDIMS >::Tensor reinterpret_last_dimension()
अंतिम आयाम तत्वों के साथ एक बड़े प्रकार के एकल तत्वों में परिवर्तित होने के साथ एक Eigen::Tensor
पर टेंसर डेटा लौटाएं।
उदाहरण के लिए, यह कर्नेल के लिए उपयोगी है जो NCHW_VECT_C int8 टेंसर को NCHW int32 टेंसर के रूप में मान सकते हैं। sizeof(T) मूल तत्व प्रकार * num तत्वों के मूल अंतिम आयाम के आकार के बराबर होना चाहिए। एनडीआईएमएस आयामों की मूल संख्या से 1 कम होना चाहिए।
पुनर्व्याख्या_अंतिम_आयाम
TTypes< T, NDIMS >::ConstTensor reinterpret_last_dimension() const
अंतिम आयाम तत्वों के साथ एक बड़े प्रकार के एकल तत्वों में परिवर्तित होने के साथ एक Eigen::Tensor
पर टेंसर डेटा लौटाएं।
उदाहरण के लिए, यह कर्नेल के लिए उपयोगी है जो NCHW_VECT_C int8 टेंसर को NCHW int32 टेंसर के रूप में मान सकते हैं। sizeof(T) मूल तत्व प्रकार * num तत्वों के मूल अंतिम आयाम के आकार के बराबर होना चाहिए। एनडीआईएमएस आयामों की मूल संख्या से 1 कम होना चाहिए।
अदिश
TTypes< T >::Scalar scalar()
अदिश
TTypes< T >::ConstScalar scalar() const
आकार
const TensorShape & shape() const
टेंसर का आकार लौटाता है।
आकार का
TTypes< T, NDIMS >::Tensor shaped( gtl::ArraySlice< int64 > new_sizes )
आकार का
TTypes< T, NDIMS >::ConstTensor shaped( gtl::ArraySlice< int64 > new_sizes ) const
टेन्सर
TTypes< T, NDIMS >::Tensor tensor()
टेन्सर
TTypes< T, NDIMS >::ConstTensor tensor() const
टेंसर_डेटा
StringPiece tensor_data() const
एक StringPiece
लौटाता है जो वर्तमान टेंसर के बफर को मैप करता है।
लौटा हुआ स्ट्रिंगपीस उन उपकरणों पर मेमोरी StringPiece
को इंगित कर सकता है जिन्हें सीपीयू सीधे संबोधित नहीं कर सकता है।
नोट: अंतर्निहित टेंसर बफर को फिर से गिना जाता है, इसलिए StringPiece
द्वारा मैप की गई सामग्री का जीवनकाल बफर के जीवनकाल से मेल खाता है; कॉलर्स को यह सुनिश्चित करने की व्यवस्था करनी चाहिए कि StringPiece
अभी भी उपयोग किए जाने पर बफर नष्ट नहीं हो जाता है।
आवश्यकताएँ: DataTypeCanUseMemcpy(dtype())
।
असंरेखित_फ्लैट
TTypes< T >::UnalignedFlat unaligned_flat()
असंरेखित_फ्लैट
TTypes< T >::UnalignedConstFlat unaligned_flat() const
असंरेखित_आकार
TTypes< T, NDIMS >::UnalignedTensor unaligned_shaped( gtl::ArraySlice< int64 > new_sizes )
असंरेखित_आकार
TTypes< T, NDIMS >::UnalignedConstTensor unaligned_shaped( gtl::ArraySlice< int64 > new_sizes ) const
वी.ई.सी
TTypes< T >::Vec vec()
इस टेंसर के प्रकार और आकार के साथ टेंसर डेटा को Eigen::Tensor के रूप में लौटाएं।
इन विधियों का उपयोग तब करें जब आप डेटा प्रकार और Tensor के आयामों की संख्या जानते हों और आप चाहते हैं कि एक Eigen::Tensor स्वचालित रूप से Tensor आकारों के आकार का हो। यदि कोई प्रकार या आकार बेमेल है तो कार्यान्वयन जांच विफल हो जाती है।
उदाहरण:
l10n-प्लेसहोल्डर89
एल10एन-प्लेसहोल्डर90
उपरोक्त सभी विधियों के कॉन्स्ट संस्करण।
~टेन्सर
l10n-प्लेसहोल्डर91जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2022-08-30 (UTC) को अपडेट किया गया.