Skip to content

Commit 5b1004b

Browse files
authored
Merge pull request #101 from adamcrume/master
Remove unused and deprecated code
2 parents 222c94c + 69881b5 commit 5b1004b

File tree

2 files changed

+1
-48
lines changed

2 files changed

+1
-48
lines changed

src/buffer.rs

-18
Original file line numberDiff line numberDiff line change
@@ -91,24 +91,6 @@ impl<T: TensorType> Buffer<T> {
9191
}
9292
}
9393

94-
/// Consumes the buffer and returns the data.
95-
///
96-
/// The caller is responsible for freeing the data.
97-
pub unsafe fn into_ptr(mut self) -> (*mut T, usize) {
98-
// TODO: remove
99-
(*self.inner).data_deallocator = None;
100-
(self.data_mut(), self.length())
101-
}
102-
103-
/// Returns a buffer with a null pointer.
104-
pub unsafe fn null() -> Self {
105-
Buffer {
106-
inner: ptr::null::<tf::TF_Buffer>() as *mut _,
107-
owned: false,
108-
phantom: PhantomData,
109-
}
110-
}
111-
11294
#[inline]
11395
fn data(&self) -> *const T {
11496
unsafe { (*self.inner).data as *const T }

src/lib.rs

+1-30
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ extern crate libc;
1414
extern crate num_complex;
1515
extern crate tensorflow_sys as tf;
1616

17-
use libc::{c_int, c_uint, size_t};
17+
use libc::{c_int, c_uint};
1818
use num_complex::Complex;
1919
use std::cmp::Ordering;
2020
use std::error::Error;
@@ -30,7 +30,6 @@ use std::ops::Deref;
3030
use std::ops::DerefMut;
3131
use std::ops::Drop;
3232
use std::ops::Index;
33-
use std::os::raw::c_void as std_c_void;
3433
use std::str::Utf8Error;
3534

3635
////////////////////////
@@ -661,12 +660,6 @@ pub struct Tensor<T: TensorType> {
661660
owned: bool,
662661
}
663662

664-
unsafe extern "C" fn noop_deallocator(_: *mut std_c_void, _: size_t, _: *mut std_c_void) -> () {}
665-
666-
unsafe extern "C" fn deallocator(_: *mut std_c_void, _: size_t, buffer: *mut std_c_void) -> () {
667-
tf::TF_DeleteBuffer(buffer as *mut tf::TF_Buffer);
668-
}
669-
670663
#[inline]
671664
fn product(values: &[u64]) -> u64 {
672665
values.iter().product()
@@ -692,18 +685,6 @@ impl<T: TensorType> Tensor<T> {
692685
}
693686
}
694687

695-
/// Returns the tensor's data.
696-
#[deprecated(note="Deref the tensor as a slice instead.")]
697-
pub fn data(&self) -> &Buffer<T> {
698-
&self.data
699-
}
700-
701-
/// Returns the tensor's data.
702-
#[deprecated(note="Deref the tensor as a slice instead.")]
703-
pub fn data_mut(&mut self) -> &mut Buffer<T> {
704-
&mut self.data
705-
}
706-
707688
/// Returns the tensor's dimensions.
708689
pub fn dims(&self) -> &[u64] {
709690
&self.dims
@@ -726,13 +707,6 @@ impl<T: TensorType> Tensor<T> {
726707
owned: true,
727708
})
728709
}
729-
730-
/// The caller is responsible for deleting the tensor.
731-
unsafe fn into_ptr(mut self) -> *mut tf::TF_Tensor {
732-
// This flag is used by drop.
733-
self.owned = false;
734-
self.inner
735-
}
736710
}
737711

738712
impl<T: TensorType> Drop for Tensor<T> {
@@ -837,9 +811,6 @@ pub fn version() -> std::result::Result<String, Utf8Error> {
837811

838812
////////////////////////
839813

840-
#[deprecated(note="Use Shape instead.")]
841-
pub type TensorShape = Shape;
842-
843814
/// A Shape is the shape of a tensor. A Shape may be an unknown rank, or it may
844815
/// have a known rank with each dimension being known or unknown.
845816
#[derive(Debug,Eq,Ord,PartialEq,PartialOrd,Hash,Clone)]

0 commit comments

Comments
 (0)