| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d2fef2f commit b1bd05c
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -124,5 +124,15 @@ public Tensor pad(Tensor tensor, Tensor paddings, string mode = "CONSTANT", stri | |||
| 124 | 124 | /// <returns>A `Tensor`. Has the same type as `input`.</returns> | |
| 125 | 125 | public Tensor placeholder_with_default<T>(T input, int[] shape, string name = null) | |
| 126 | 126 | => gen_array_ops.placeholder_with_default(input, shape, name: name); | |
| 127 | + | ||
| 128 | + /// <summary> | ||
| 129 | + /// Returns the shape of a tensor. | ||
| 130 | + /// </summary> | ||
| 131 | + /// <param name="input"></param> | ||
| 132 | + /// <param name="name"></param> | ||
| 133 | + /// <param name="out_type"></param> | ||
| 134 | + /// <returns></returns> | ||
| 135 | + public Tensor shape(Tensor input, string name = null, TF_DataType out_type = TF_DataType.TF_INT32) | ||
| 136 | + => array_ops.shape_internal(input, name, optimize: true, out_type: out_type); | ||
| 127 | 137 | } | |
| 128 | 138 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -338,7 +338,7 @@ public static Tensor shape(Tensor input, string name = null, TF_DataType out_typ | |||
| 338 | 338 | public static Tensor size(Tensor input, string name = null, bool optimize = true, TF_DataType out_type = TF_DataType.TF_INT32) | |
| 339 | 339 | => size_internal(input, name, optimize: optimize, out_type: out_type); | |
| 340 | 340 | ||
| 341 | - private static Tensor shape_internal(Tensor input, string name = null, bool optimize = true, TF_DataType out_type = TF_DataType.TF_INT32) | ||
| 341 | + public static Tensor shape_internal(Tensor input, string name = null, bool optimize = true, TF_DataType out_type = TF_DataType.TF_INT32) | ||
| 342 | 342 | { | |
| 343 | 343 | return tf_with(ops.name_scope(name, "Shape", new { input }), scope => | |
| 344 | 344 | { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,7 +26,7 @@ Docs: https://tensorflownet.readthedocs.io</Description> | |||
| 26 | 26 | 5. Overload session.run(), make syntax simpler. | |
| 27 | 27 | 6. Add Local Response Normalization. | |
| 28 | 28 | 7. Add tf.image related APIs. | |
| 29 | - 8. Add tf.random_normal, tf.constant, tf.pad. | ||
| 29 | + 8. Add tf.random_normal, tf.constant, tf.pad, tf.shape. | ||
| 30 | 30 | 9. MultiThread is safe.</PackageReleaseNotes> | |
| 31 | 31 | <LangVersion>7.3</LangVersion> | |
| 32 | 32 | <FileVersion>0.11.2.0</FileVersion> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -65,11 +65,14 @@ public static Tensor upsample(Tensor input_data, string name, string method = "d | |||
| 65 | 65 | Tensor output = null; | |
| 66 | 66 | if (method == "resize") | |
| 67 | 67 | { | |
| 68 | - | ||
| 68 | + tf_with(tf.variable_scope(name), delegate | ||
| 69 | + { | ||
| 70 | + var input_shape = tf.shape(input_data); | ||
| 71 | + }); | ||
| 69 | 72 | } | |
| 70 | 73 | else if(method == "deconv") | |
| 71 | 74 | { | |
| 72 | - | ||
| 75 | + throw new NotImplementedException("upsample.deconv"); | ||
| 73 | 76 | } | |
| 74 | 77 | ||
| 75 | 78 | return output; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,10 +14,11 @@ namespace TensorFlowNET.UnitTest | |||
| 14 | 14 | [TestClass] | |
| 15 | 15 | public class ImageTest | |
| 16 | 16 | { | |
| 17 | - string imgPath = "../../../../../data/shasta-daisy.jpg"; | ||
| 17 | + string imgPath = "shasta-daisy.jpg"; | ||
| 18 | 18 | Tensor contents; | |
| 19 | 19 | ||
| 20 | - public ImageTest() | ||
| 20 | + [TestInitialize] | ||
| 21 | + public void Initialize() | ||
| 21 | 22 | { | |
| 22 | 23 | imgPath = Path.GetFullPath(imgPath); | |
| 23 | 24 | contents = tf.read_file(imgPath); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments