| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 41df785 commit 9d08a31
86 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,5 @@ | |||
| 1 | 1 | using System; | |
| 2 | - using System.Collections.Generic; | ||
| 3 | 2 | using System.Diagnostics; | |
| 4 | - using System.Text; | ||
| 5 | 3 | using static Tensorflow.Binding; | |
| 6 | 4 | ||
| 7 | 5 | namespace Tensorflow | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,5 @@ | |||
| 1 | - using System; | ||
| 2 | - using System.Collections.Generic; | ||
| 3 | - using System.Text; | ||
| 4 | - using NumSharp; | ||
| 1 | + using NumSharp; | ||
| 2 | + using System; | ||
| 5 | 3 | using static Tensorflow.Binding; | |
| 6 | 4 | ||
| 7 | 5 | namespace Tensorflow | |
@@ -59,7 +57,7 @@ public Action<int> MathAdd | |||
| 59 | 57 | public Action<int> Gradient | |
| 60 | 58 | => (iterate) => | |
| 61 | 59 | { | |
| 62 | - for(int i = 0; i< iterate; i++) | ||
| 60 | + for (int i = 0; i < iterate; i++) | ||
| 63 | 61 | { | |
| 64 | 62 | var w = tf.constant(3112.0f); | |
| 65 | 63 | using var tape = tf.GradientTape(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,4 @@ | |||
| 1 | - using Tensorflow.Keras.Engine; | ||
| 2 | - | ||
| 3 | - namespace Tensorflow.Keras.ArgsDefinition | ||
| 1 | + namespace Tensorflow.Keras.ArgsDefinition | ||
| 4 | 2 | { | |
| 5 | 3 | public class NodeArgs | |
| 6 | 4 | { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,4 @@ | |||
| 1 | 1 | using System.Collections.Generic; | |
| 2 | - using Tensorflow.Keras.Engine; | ||
| 3 | 2 | ||
| 4 | 3 | namespace Tensorflow.Keras.ArgsDefinition | |
| 5 | 4 | { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,8 +1,4 @@ | |||
| 1 | - using System; | ||
| 2 | - using System.Collections.Generic; | ||
| 3 | - using System.Text; | ||
| 4 | - | ||
| 5 | - namespace Tensorflow.Keras.Engine | ||
| 1 | + namespace Tensorflow.Keras.Engine | ||
| 6 | 2 | { | |
| 7 | 3 | public interface IModel | |
| 8 | 4 | { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,4 @@ | |||
| 1 | - using System; | ||
| 2 | - using System.Collections.Generic; | ||
| 3 | - using System.Text; | ||
| 1 | + using System.Collections.Generic; | ||
| 4 | 2 | ||
| 5 | 3 | namespace Tensorflow.Keras.Engine | |
| 6 | 4 | { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,4 @@ | |||
| 1 | - using System; | ||
| 2 | - using System.Collections.Generic; | ||
| 3 | - using System.Text; | ||
| 1 | + using System.Collections.Generic; | ||
| 4 | 2 | using Tensorflow.Keras.Engine; | |
| 5 | 3 | ||
| 6 | 4 | namespace Tensorflow.Keras | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -57,8 +57,8 @@ public Normal(Tensor loc, Tensor scale, bool validate_args = false, bool allow_n | |||
| 57 | 57 | this._loc = array_ops.identity(loc, name); | |
| 58 | 58 | this._scale = array_ops.identity(scale, name); | |
| 59 | 59 | base._dtype = this._scale.dtype; | |
| 60 | - // base._reparameterization_type = new ReparameterizationType("FULLY_REPARAMETERIZED"); | ||
| 61 | - base._validate_args = validate_args; | ||
| 60 | + // base._reparameterization_type = new ReparameterizationType("FULLY_REPARAMETERIZED"); | ||
| 61 | + base._validate_args = validate_args; | ||
| 62 | 62 | base._allow_nan_stats = allow_nan_stats; | |
| 63 | 63 | base._parameters = parameters; | |
| 64 | 64 | base._graph_parents = new List<Tensor>(new Tensor[] { this._loc, this._scale }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,9 +13,9 @@ You may obtain a copy of the License at | |||
| 13 | 13 | See the License for the specific language governing permissions and | |
| 14 | 14 | limitations under the License. | |
| 15 | 15 | ******************************************************************************/ | |
| 16 | - using static Tensorflow.Binding; | ||
| 17 | - using Tensorflow.Keras.Engine; | ||
| 18 | 16 | using System; | |
| 17 | + using Tensorflow.Keras.Engine; | ||
| 18 | + using static Tensorflow.Binding; | ||
| 19 | 19 | ||
| 20 | 20 | namespace Tensorflow | |
| 21 | 21 | { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -242,9 +242,9 @@ public static Tensor rot90(Tensor image, int k = 1, string name = null) | |||
| 242 | 242 | image = ops.convert_to_tensor(image, name: "image"); | |
| 243 | 243 | image = _AssertAtLeast3DImage(image); | |
| 244 | 244 | ||
| 245 | - // can't get k to convert to tensor without throwing error about it being an int--- | ||
| 246 | - // might rework later. for now, k2 == k as Tensor | ||
| 247 | - Tensor k2 = ops.convert_to_tensor(k, dtype: dtypes.int32, name: "k"); | ||
| 245 | + // can't get k to convert to tensor without throwing error about it being an int--- | ||
| 246 | + // might rework later. for now, k2 == k as Tensor | ||
| 247 | + Tensor k2 = ops.convert_to_tensor(k, dtype: dtypes.int32, name: "k"); | ||
| 248 | 248 | k2.TensorShape.assert_has_rank(0); | |
| 249 | 249 | k2 = gen_ops.mod(k2, tf.constant(4)); | |
| 250 | 250 | ||
@@ -465,8 +465,8 @@ public static Tensor pad_to_bounding_box(Tensor image, int offset_height, int of | |||
| 465 | 465 | ||
| 466 | 466 | var assert_ops = _CheckAtLeast3DImage(image, require_static: false); | |
| 467 | 467 | ||
| 468 | - // batch: [0], height: [1], width: [2], depth: [3] | ||
| 469 | - int[] bhwd = _ImageDimensions(image, rank: 4); | ||
| 468 | + // batch: [0], height: [1], width: [2], depth: [3] | ||
| 469 | + int[] bhwd = _ImageDimensions(image, rank: 4); | ||
| 470 | 470 | ||
| 471 | 471 | var after_padding_width = target_width - offset_width - bhwd[2]; | |
| 472 | 472 | ||
@@ -544,8 +544,8 @@ public static Tensor crop_to_bounding_box(Tensor image, int offset_height, int o | |||
| 544 | 544 | ||
| 545 | 545 | var assert_ops = _CheckAtLeast3DImage(image, require_static: false); | |
| 546 | 546 | ||
| 547 | - // batch: [0], height: [1], width: [2], depth: [3] | ||
| 548 | - int[] bhwd = _ImageDimensions(image, rank: 4); | ||
| 547 | + // batch: [0], height: [1], width: [2], depth: [3] | ||
| 548 | + int[] bhwd = _ImageDimensions(image, rank: 4); | ||
| 549 | 549 | ||
| 550 | 550 | assert_ops[assert_ops.Length] = _assert(check_ops.assert_greater_equal(tf.constant(offset_height), | |
| 551 | 551 | tf.constant(0)), typeof(ValueError), | |
@@ -976,7 +976,7 @@ public static Tensor per_image_standardization(Tensor image) | |||
| 976 | 976 | ||
| 977 | 977 | image = image - image_mean; | |
| 978 | 978 | image = tf.div(image, adjusted_stddev, name: scope); // name: scope in python version | |
| 979 | - return convert_image_dtype(image, orig_dtype, saturate: true); | ||
| 979 | + return convert_image_dtype(image, orig_dtype, saturate: true); | ||
| 980 | 980 | }); | |
| 981 | 981 | } | |
| 982 | 982 | ||
@@ -1177,9 +1177,9 @@ public static Tensor adjust_jpeg_quality(Tensor image, Tensor jpeg_quality, stri | |||
| 1177 | 1177 | image = ops.convert_to_tensor(image, name: "image"); | |
| 1178 | 1178 | var channels = image.TensorShape.as_list()[image.TensorShape.dims.Length - 1]; | |
| 1179 | 1179 | var orig_dtype = image.dtype; | |
| 1180 | - // python code checks to ensure jpeq_quality is a tensor; unnecessary here since | ||
| 1181 | - // it is passed as a tensor | ||
| 1182 | - image = gen_ops.encode_jpeg_variable_quality(image, quality: jpeg_quality); | ||
| 1180 | + // python code checks to ensure jpeq_quality is a tensor; unnecessary here since | ||
| 1181 | + // it is passed as a tensor | ||
| 1182 | + image = gen_ops.encode_jpeg_variable_quality(image, quality: jpeg_quality); | ||
| 1183 | 1183 | ||
| 1184 | 1184 | image = gen_ops.decode_jpeg(image, channels: channels); | |
| 1185 | 1185 | return convert_image_dtype(image, orig_dtype, saturate: true); | |
@@ -1587,8 +1587,8 @@ Tensor[] do_pad(Tensor[] images, Tensor remainder) | |||
| 1587 | 1587 | { | |
| 1588 | 1588 | if (k > 0) | |
| 1589 | 1589 | { | |
| 1590 | - // handle flat_imgs | ||
| 1591 | - Tensor[] flat_imgs = new Tensor[] { }; | ||
| 1590 | + // handle flat_imgs | ||
| 1591 | + Tensor[] flat_imgs = new Tensor[] { }; | ||
| 1592 | 1592 | foreach ((Tensor x, Tensor t) in imgs.Zip(tails, Tuple.Create)) | |
| 1593 | 1593 | { | |
| 1594 | 1594 | flat_imgs[flat_imgs.Length] = array_ops.reshape(x, array_ops.concat(new Tensor[] { constant_op.constant(-1), t }, 0)); | |
@@ -1602,42 +1602,42 @@ Tensor[] do_pad(Tensor[] images, Tensor remainder) | |||
| 1602 | 1602 | true_fn: () => padded_func_pass(), | |
| 1603 | 1603 | false_fn: () => flat_imgs); | |
| 1604 | 1604 | ||
| 1605 | - // handle downscaled | ||
| 1606 | - Tensor[] downscaled = new Tensor[] { }; | ||
| 1605 | + // handle downscaled | ||
| 1606 | + Tensor[] downscaled = new Tensor[] { }; | ||
| 1607 | 1607 | foreach (Tensor x in padded) | |
| 1608 | 1608 | { | |
| 1609 | 1609 | downscaled[downscaled.Length] = gen_ops.avg_pool(x, ksize: divisor, strides: divisor, padding: "VALID"); | |
| 1610 | 1610 | } | |
| 1611 | 1611 | ||
| 1612 | - // handle tails | ||
| 1613 | - tails = new Tensor[] { }; | ||
| 1612 | + // handle tails | ||
| 1613 | + tails = new Tensor[] { }; | ||
| 1614 | 1614 | foreach (Tensor x in gen_array_ops.shape_n(downscaled)) | |
| 1615 | 1615 | { | |
| 1616 | 1616 | tails[tails.Length] = new Tensor(x.dims.Skip(1).Take(tails.Length - 1).ToArray()); | |
| 1617 | 1617 | } | |
| 1618 | 1618 | ||
| 1619 | 1619 | imgs = new Tensor[] { }; | |
| 1620 | - // tuples weren't working; this is hacky, but should work similarly. | ||
| 1621 | - // zip loads the values into a tuple (Tensor, Tensor, Tensor) for each | ||
| 1622 | - // zip entry; this just gets the length of the longest array, and loops | ||
| 1623 | - // that many times, getting values (like zip) and using them similarly. | ||
| 1624 | - for (int x = 0; x < Math.Max(Math.Max(downscaled.Length, heads.Length), tails.Length); x++) | ||
| 1620 | + // tuples weren't working; this is hacky, but should work similarly. | ||
| 1621 | + // zip loads the values into a tuple (Tensor, Tensor, Tensor) for each | ||
| 1622 | + // zip entry; this just gets the length of the longest array, and loops | ||
| 1623 | + // that many times, getting values (like zip) and using them similarly. | ||
| 1624 | + for (int x = 0; x < Math.Max(Math.Max(downscaled.Length, heads.Length), tails.Length); x++) | ||
| 1625 | 1625 | { | |
| 1626 | 1626 | imgs[imgs.Length] = array_ops.reshape(downscaled[x], array_ops.concat(new Tensor[] { heads[x], tails[x] }, 0)); | |
| 1627 | 1627 | } | |
| 1628 | 1628 | } | |
| 1629 | 1629 | } | |
| 1630 | 1630 | ||
| 1631 | - // python code uses * to unpack imgs; how to replicate that here? | ||
| 1632 | - // don't think that this is doing the same thing as the python code. | ||
| 1633 | - (ssim_per_channel, cs) = _ssim_per_channel( | ||
| 1634 | - img1: imgs[0], | ||
| 1635 | - img2: imgs[1], | ||
| 1636 | - max_val: max_val, | ||
| 1637 | - filter_size: filter_size, | ||
| 1638 | - filter_sigma: filter_sigma, | ||
| 1639 | - k1: k1, | ||
| 1640 | - k2: k2); | ||
| 1631 | + // python code uses * to unpack imgs; how to replicate that here? | ||
| 1632 | + // don't think that this is doing the same thing as the python code. | ||
| 1633 | + (ssim_per_channel, cs) = _ssim_per_channel( | ||
| 1634 | + img1: imgs[0], | ||
| 1635 | + img2: imgs[1], | ||
| 1636 | + max_val: max_val, | ||
| 1637 | + filter_size: filter_size, | ||
| 1638 | + filter_sigma: filter_sigma, | ||
| 1639 | + k1: k1, | ||
| 1640 | + k2: k2); | ||
| 1641 | 1641 | mcs.append(gen_nn_ops.relu(cs)); | |
| 1642 | 1642 | } | |
| 1643 | 1643 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments