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
@@ -936,7 +937,7 @@ impl<T: TensorType> Deref for Tensor<T> {
936
937
937
938
impl < T : TensorType > DerefMut for Tensor < T > {
938
939
#[ inline]
939
- fn deref_mut < ' a > ( & ' a mut self ) -> & ' a mut [ T ] {
940
+ fn deref_mut ( & mut self ) -> & mut [ T ] {
940
941
& mut self . data
941
942
}
942
943
}
@@ -1010,7 +1011,7 @@ trait OperationTrait {
1010
1011
////////////////////////
1011
1012
1012
1013
/// Returns a string describing version information of the
1013
- /// TensorFlow library. TensorFlow using semantic versioning.
1014
+ /// ` TensorFlow` library. ` TensorFlow` is using semantic versioning.
1014
1015
pub fn version ( ) -> std:: result:: Result < String , Utf8Error > {
1015
1016
unsafe { CStr :: from_ptr ( tf:: TF_Version ( ) ) . to_str ( ) . map ( |s| s. to_string ( ) ) }
1016
1017
}
@@ -1028,9 +1029,9 @@ pub struct Shape(Option<Vec<Option<i64>>>);
1028
1029
impl Shape {
1029
1030
/// Returns the number of dimensions if known, or None if unknown.
1030
1031
pub fn dims ( & self ) -> Option < usize > {
1031
- match self {
1032
- & Shape ( None ) => None ,
1033
- & Shape ( Some ( ref v) ) => Some ( v. len ( ) ) ,
1032
+ match * self {
1033
+ Shape ( None ) => None ,
1034
+ Shape ( Some ( ref v) ) => Some ( v. len ( ) ) ,
1034
1035
}
1035
1036
}
1036
1037
}
@@ -1053,9 +1054,9 @@ impl Index<usize> for Shape {
1053
1054
type Output = Option < i64 > ;
1054
1055
1055
1056
fn index ( & self , index : usize ) -> & Option < i64 > {
1056
- match & self . 0 {
1057
- & None => & UNKNOWN_DIMENSION ,
1058
- & Some ( ref v) => {
1057
+ match self . 0 {
1058
+ None => & UNKNOWN_DIMENSION ,
1059
+ Some ( ref v) => {
1059
1060
if index < v. len ( ) {
1060
1061
& v[ index]
1061
1062
} else {
0 commit comments