Browse Source

fix name issue in internal_convert_to_tensor._autopacking_helper

tags/v0.9
Oceania2018 6 years ago
parent
commit
e3c5bb7755
3 changed files with 10 additions and 5 deletions
  1. +2
    -3
      src/TensorFlowNET.Core/Clustering/KMeans.cs
  2. +7
    -1
      src/TensorFlowNET.Core/Operations/array_ops.py.cs
  3. +1
    -1
      src/TensorFlowNET.Core/ops.py.cs

+ 2
- 3
src/TensorFlowNET.Core/Clustering/KMeans.cs View File

@@ -79,9 +79,8 @@ namespace Tensorflow.Clustering
else
{
var cluster_centers_updated = cluster_centers;
var cluster_counts = _use_mini_batch ?
tf.Variable(array_ops.ones(new Tensor[] { num_clusters }, dtype: TF_DataType.TF_INT64)) :
null;
var ones = array_ops.ones(new Tensor[] { num_clusters }, dtype: TF_DataType.TF_INT64);
var cluster_counts = _use_mini_batch ? tf.Variable(ones) : null;
return new RefVariable[]
{
cluster_centers,


+ 7
- 1
src/TensorFlowNET.Core/Operations/array_ops.py.cs View File

@@ -32,6 +32,11 @@ namespace Tensorflow
});
}
private static Tensor _constant_if_small(int value, Tensor shape)
{
return shape < 1000;
}
private static Tensor _constant_if_small<T>(T value, Shape shape, TF_DataType dtype, string name)
{
Tensor tShape = null;
@@ -167,8 +172,9 @@ namespace Tensorflow
return with(ops.name_scope(name, "ones", new { shape }), scope =>
{
name = scope;
var output = _constant_if_small(1, shape[0]);
var shape1 = ops.convert_to_tensor(shape, dtype: TF_DataType.TF_INT32);
var output = gen_array_ops.fill(shape1, constant_op.constant(1, dtype: dtype), name: name);
output = gen_array_ops.fill(shape1, constant_op.constant(1, dtype: dtype), name: name);
return output;
});
}


+ 1
- 1
src/TensorFlowNET.Core/ops.py.cs View File

@@ -425,7 +425,7 @@ namespace Tensorflow
case Tensor tensor:
return tensor;
case Tensor[] tensors:
return array_ops._autopacking_helper(tensors, dtype, name);
return array_ops._autopacking_helper(tensors, dtype, name == null ? "packed" : name);
case RefVariable varVal:
return varVal._TensorConversionFunction(as_ref: as_ref);
case object[] objects:


Loading…
Cancel
Save