1
1
//! This crate provides Rust bindings for the
2
- //! [TensorFlow](https://www.tensorflow.org) machine learning library.
2
+ //! [` TensorFlow` ](https://www.tensorflow.org) machine learning library.
3
3
4
4
#![ warn( missing_copy_implementations,
5
5
missing_debug_implementations,
@@ -343,6 +343,7 @@ c_enum!("Type of a single tensor element.", TF_DataType, DataType {
343
343
/// 16-bit floating point.
344
344
value Half = 19 ,
345
345
346
+ /// Tensorflow Resource (name, container, device,...)
346
347
value Resource = 20 ,
347
348
} ) ;
348
349
@@ -929,7 +930,7 @@ impl<T: TensorType> Deref for Tensor<T> {
929
930
930
931
impl < T : TensorType > DerefMut for Tensor < T > {
931
932
#[ inline]
932
- fn deref_mut < ' a > ( & ' a mut self ) -> & ' a mut [ T ] {
933
+ fn deref_mut ( & mut self ) -> & mut [ T ] {
933
934
& mut self . data
934
935
}
935
936
}
@@ -1003,16 +1004,13 @@ trait OperationTrait {
1003
1004
////////////////////////
1004
1005
1005
1006
/// Returns a string describing version information of the
1006
- /// TensorFlow library. TensorFlow using semantic versioning.
1007
+ /// ` TensorFlow` library. ` TensorFlow` is using semantic versioning.
1007
1008
pub fn version ( ) -> std:: result:: Result < String , Utf8Error > {
1008
1009
unsafe { CStr :: from_ptr ( tf:: TF_Version ( ) ) . to_str ( ) . map ( |s| s. to_string ( ) ) }
1009
1010
}
1010
1011
1011
1012
////////////////////////
1012
1013
1013
- #[ deprecated( note="Use Shape instead." ) ]
1014
- type TensorShape = Shape ;
1015
-
1016
1014
/// A Shape is the shape of a tensor. A Shape may be an unknown rank, or it may
1017
1015
/// have a known rank with each dimension being known or unknown.
1018
1016
#[ derive( Debug , Eq , Ord , PartialEq , PartialOrd , Hash , Clone ) ]
@@ -1021,9 +1019,9 @@ pub struct Shape(Option<Vec<Option<i64>>>);
1021
1019
impl Shape {
1022
1020
/// Returns the number of dimensions if known, or None if unknown.
1023
1021
pub fn dims ( & self ) -> Option < usize > {
1024
- match self {
1025
- & Shape ( None ) => None ,
1026
- & Shape ( Some ( ref v) ) => Some ( v. len ( ) ) ,
1022
+ match * self {
1023
+ Shape ( None ) => None ,
1024
+ Shape ( Some ( ref v) ) => Some ( v. len ( ) ) ,
1027
1025
}
1028
1026
}
1029
1027
}
@@ -1046,9 +1044,9 @@ impl Index<usize> for Shape {
1046
1044
type Output = Option < i64 > ;
1047
1045
1048
1046
fn index ( & self , index : usize ) -> & Option < i64 > {
1049
- match & self . 0 {
1050
- & None => & UNKNOWN_DIMENSION ,
1051
- & Some ( ref v) => {
1047
+ match self . 0 {
1048
+ None => & UNKNOWN_DIMENSION ,
1049
+ Some ( ref v) => {
1052
1050
if index < v. len ( ) {
1053
1051
& v[ index]
1054
1052
} else {
0 commit comments