| @@ -37,7 +37,7 @@ namespace Tensorflow.NumPy | |||||
| => new NDArray(value); | => new NDArray(value); | ||||
| public static implicit operator Tensor(NDArray nd) | public static implicit operator Tensor(NDArray nd) | ||||
| => constant_op.constant(nd); | |||||
| => nd._tensor; | |||||
| public static implicit operator NDArray(Tensor tensor) | public static implicit operator NDArray(Tensor tensor) | ||||
| => new NDArray(tensor); | => new NDArray(tensor); | ||||
| @@ -49,8 +49,12 @@ namespace Tensorflow | |||||
| protected NDArray GetNDArray(TF_DataType dtype) | protected NDArray GetNDArray(TF_DataType dtype) | ||||
| { | { | ||||
| /*if (dtype == TF_DataType.TF_STRING) | |||||
| return np.array(StringData());*/ | |||||
| if (dtype == TF_DataType.TF_STRING) | |||||
| { | |||||
| var str= StringData(); | |||||
| return new NDArray(str, new Shape(str.Length)); | |||||
| } | |||||
| return new NDArray(this); | return new NDArray(this); | ||||
| } | } | ||||
| @@ -171,6 +171,9 @@ namespace Tensorflow | |||||
| _ => constant_op.constant(value, dtype: dtype, name: name) | _ => constant_op.constant(value, dtype: dtype, name: name) | ||||
| }; | }; | ||||
| if (dtype == TF_DataType.TF_STRING) | |||||
| return ret; | |||||
| var original_dtype = value.GetDataType(); | var original_dtype = value.GetDataType(); | ||||
| if (dtype != TF_DataType.DtInvalid && dtype != original_dtype) | if (dtype != TF_DataType.DtInvalid && dtype != original_dtype) | ||||
| ret = gen_math_ops.cast(ret, dtype.as_base_dtype(), name: name); | ret = gen_math_ops.cast(ret, dtype.as_base_dtype(), name: name); | ||||