|
|
|
@@ -32,7 +32,6 @@ namespace Tensorflow |
|
|
|
|
|
|
|
public Tensor() |
|
|
|
{ |
|
|
|
_isCreatedInGraphMode = !tf.executing_eagerly(); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
@@ -44,8 +43,6 @@ namespace Tensorflow |
|
|
|
_handle = handle; |
|
|
|
if (clone && handle != null) |
|
|
|
_handle = TF_NewTensor(shape, dtype, data: TensorDataPointer.ToPointer()); |
|
|
|
|
|
|
|
_isCreatedInGraphMode = !tf.executing_eagerly(); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
@@ -59,13 +56,11 @@ namespace Tensorflow |
|
|
|
public unsafe Tensor(IntPtr data_ptr, Shape shape, TF_DataType dtype) |
|
|
|
{ |
|
|
|
_handle = TF_NewTensor(shape, dtype, data: data_ptr.ToPointer()); |
|
|
|
_isCreatedInGraphMode = !tf.executing_eagerly(); |
|
|
|
} |
|
|
|
|
|
|
|
public unsafe Tensor(NDArray nd) |
|
|
|
{ |
|
|
|
_handle = TF_NewTensor(nd.shape, nd.dtype, nd.data.ToPointer()); |
|
|
|
_isCreatedInGraphMode = !tf.executing_eagerly(); |
|
|
|
} |
|
|
|
|
|
|
|
#region scala |
|
|
|
@@ -107,13 +102,11 @@ namespace Tensorflow |
|
|
|
_value_index = value_index; |
|
|
|
_override_dtype = dtype; |
|
|
|
_id = ops.uid(); |
|
|
|
_isCreatedInGraphMode = !tf.executing_eagerly(); |
|
|
|
} |
|
|
|
|
|
|
|
protected unsafe void InitTensor(Shape shape, TF_DataType dtype) |
|
|
|
{ |
|
|
|
_handle = TF_NewTensor(shape, dtype, null); |
|
|
|
_isCreatedInGraphMode = !tf.executing_eagerly(); |
|
|
|
} |
|
|
|
|
|
|
|
protected unsafe void InitTensor(Shape shape, byte[] bytes, TF_DataType dtype) |
|
|
|
@@ -122,13 +115,10 @@ namespace Tensorflow |
|
|
|
_handle = StringTensor(new byte[][] { bytes }, Shape.Scalar); |
|
|
|
else |
|
|
|
_handle = TF_NewTensor(bytes, shape, dtype); |
|
|
|
_isCreatedInGraphMode = !tf.executing_eagerly(); |
|
|
|
} |
|
|
|
|
|
|
|
protected unsafe void InitTensor(Array array, Shape? shape = null) |
|
|
|
{ |
|
|
|
_isCreatedInGraphMode = !tf.executing_eagerly(); |
|
|
|
|
|
|
|
shape = shape ?? array.GetShape(); |
|
|
|
var dtype = array.GetDataType(); |
|
|
|
|
|
|
|
|