| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f0d1ee8 commit 112247f
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,11 +1,27 @@ | |||
| 1 | 1 | using System; | |
| 2 | 2 | using System.Collections.Generic; | |
| 3 | + using System.Linq; | ||
| 3 | 4 | using System.Text; | |
| 4 | 5 | ||
| 5 | 6 | namespace Tensorflow | |
| 6 | 7 | { | |
| 7 | 8 | public static partial class tf | |
| 8 | 9 | { | |
| 10 | + /// <summary> | ||
| 11 | + /// Concatenates tensors along one dimension. | ||
| 12 | + /// </summary> | ||
| 13 | + /// <param name="values">A list of `Tensor` objects or a single `Tensor`.</param> | ||
| 14 | + /// <param name="axis"></param> | ||
| 15 | + /// <param name="name"></param> | ||
| 16 | + /// <returns>A `Tensor` resulting from concatenation of the input tensors.</returns> | ||
| 17 | + public static Tensor concat(IList<Tensor> values, int axis, string name = "concat") | ||
| 18 | + { | ||
| 19 | + if (values.Count == 1) | ||
| 20 | + throw new NotImplementedException("tf.concat length is 1"); | ||
| 21 | + | ||
| 22 | + return gen_array_ops.concat_v2(values.ToArray(), axis, name: name); | ||
| 23 | + } | ||
| 24 | + | ||
| 9 | 25 | /// <summary> | |
| 10 | 26 | /// Inserts a dimension of 1 into a tensor's shape. | |
| 11 | 27 | /// </summary> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -195,7 +195,14 @@ public Graph BuildGraph() | |||
| 195 | 195 | pooled_outputs.Add(pool); | |
| 196 | 196 | } | |
| 197 | 197 | ||
| 198 | - // var h_pool = tf.concat(pooled_outputs, 3); | ||
| 198 | + var h_pool = tf.concat(pooled_outputs, 3); | ||
| 199 | + var h_pool_flat = tf.reshape(h_pool, new TensorShape(-1, num_filters * filter_sizes.Rank)); | ||
| 200 | + | ||
| 201 | + with(tf.name_scope("dropout"), delegate | ||
| 202 | + { | ||
| 203 | + // var h_drop = tf.nn.dropout(h_pool_flat, self.keep_prob); | ||
| 204 | + }); | ||
| 205 | + | ||
| 199 | 206 | return graph; | |
| 200 | 207 | } | |
| 201 | 208 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments