File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11using NumSharp ;
22using System ;
3- using System . Collections . Generic ;
43using System . Linq ;
5- using System . Text ;
4+ using Tensorflow . Util ;
65using static Tensorflow . Binding ;
76
87namespace Tensorflow . Eager
98{
109 public partial class EagerTensor : Tensor
1110 {
12- public override string Device => c_api . StringPiece ( c_api . TFE_TensorHandleDeviceName ( EagerTensorHandle , tf . status . Handle ) ) ;
11+ public override string Device
12+ {
13+ get
14+ {
15+ using var _ = EagerTensorHandle . Lease ( ) ;
16+ return c_api . StringPiece ( c_api . TFE_TensorHandleDeviceName ( EagerTensorHandle , tf . status . Handle ) ) ;
17+ }
18+ }
1319
1420 public override int rank => c_api . TFE_TensorHandleNumDims ( EagerTensorHandle , tf . status . Handle ) ;
1521
Original file line number Diff line number Diff line change 11using NumSharp ;
22using System ;
3- using System . Collections . Generic ;
43using System . Linq ;
5- using System . Reflection ;
6- using System . Runtime . InteropServices ;
7- using System . Text ;
84using Tensorflow . Eager ;
5+ using Tensorflow . Util ;
96using static Tensorflow . Binding ;
107
118namespace Tensorflow
129{
1310 public class EagerTensorV2 : DisposableObject , ITensor
1411 {
1512 SafeTensorHandleHandle EagerTensorHandle ;
16- public string Device => c_api . StringPiece ( c_api . TFE_TensorHandleDeviceName ( EagerTensorHandle , tf . status . Handle ) ) ;
13+ public string Device
14+ {
15+ get
16+ {
17+ using var _ = EagerTensorHandle . Lease ( ) ;
18+ return c_api . StringPiece ( c_api . TFE_TensorHandleDeviceName ( EagerTensorHandle , tf . status . Handle ) ) ;
19+ }
20+ }
1721
1822 public EagerTensorV2 ( IntPtr handle )
1923 {
You can’t perform that action at this time.
0 commit comments