| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent ca99be3 commit 20b348c
34 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,7 +17,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TensorFlowBenchmark", "src\ | |||
| 17 | 17 | EndProject | |
| 18 | 18 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TensorFlowHub", "src\TensorFlowHub\TensorFlowHub.csproj", "{8FD59A5A-97EB-457E-B9F1-D88B0C822C6E}" | |
| 19 | 19 | EndProject | |
| 20 | - Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TensorFlowText", "src\TensorFlowText\TensorFlowText.csproj", "{B598E5D5-BD2D-4191-8532-F2FBAC31AB81}" | ||
| 20 | + Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TensorFlowText", "src\TensorFlowText\TensorFlowText.csproj", "{B598E5D5-BD2D-4191-8532-F2FBAC31AB81}" | ||
| 21 | + EndProject | ||
| 22 | + Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NumSharp.Core", "..\NumSharp\src\NumSharp.Core\NumSharp.Core.csproj", "{F219B9B9-B873-4342-BF85-7E89E7F5D64F}" | ||
| 21 | 23 | EndProject | |
| 22 | 24 | Global | |
| 23 | 25 | GlobalSection(SolutionConfigurationPlatforms) = preSolution | |
@@ -57,6 +59,10 @@ Global | |||
| 57 | 59 | {B598E5D5-BD2D-4191-8532-F2FBAC31AB81}.Debug|Any CPU.Build.0 = Debug|Any CPU | |
| 58 | 60 | {B598E5D5-BD2D-4191-8532-F2FBAC31AB81}.Release|Any CPU.ActiveCfg = Release|Any CPU | |
| 59 | 61 | {B598E5D5-BD2D-4191-8532-F2FBAC31AB81}.Release|Any CPU.Build.0 = Release|Any CPU | |
| 62 | + {F219B9B9-B873-4342-BF85-7E89E7F5D64F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| 63 | + {F219B9B9-B873-4342-BF85-7E89E7F5D64F}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| 64 | + {F219B9B9-B873-4342-BF85-7E89E7F5D64F}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| 65 | + {F219B9B9-B873-4342-BF85-7E89E7F5D64F}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| 60 | 66 | EndGlobalSection | |
| 61 | 67 | GlobalSection(SolutionProperties) = preSolution | |
| 62 | 68 | HideSolutionNode = FALSE | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -41,7 +41,7 @@ public ILayer __build__(TensorShape input_shape, int seed = 1, float stddev = -1 | |||
| 41 | 41 | Console.WriteLine("Building Layer \"" + name + "\" ..."); | |
| 42 | 42 | if (stddev == -1) | |
| 43 | 43 | stddev = (float)(1 / Math.Sqrt(2)); | |
| 44 | - var dim = input_shape.Dimensions; | ||
| 44 | + var dim = input_shape.dims; | ||
| 45 | 45 | var input_dim = dim[dim.Length - 1]; | |
| 46 | 46 | W = tf.Variable(create_tensor(new int[] { input_dim, units }, seed: seed, stddev: (float)stddev)); | |
| 47 | 47 | WShape = new TensorShape(W.shape); | |
@@ -52,7 +52,7 @@ public Tensor __call__(Tensor x) | |||
| 52 | 52 | var dot = tf.matmul(x, W); | |
| 53 | 53 | if (this.activation != null) | |
| 54 | 54 | dot = activation.Activate(dot); | |
| 55 | - Console.WriteLine("Calling Layer \"" + name + "(" + np.array(dot.TensorShape.Dimensions).ToString() + ")\" ..."); | ||
| 55 | + Console.WriteLine("Calling Layer \"" + name + "(" + np.array(dot.TensorShape.dims).ToString() + ")\" ..."); | ||
| 56 | 56 | return dot; | |
| 57 | 57 | } | |
| 58 | 58 | public TensorShape __shape__() | |
@@ -61,7 +61,7 @@ public TensorShape __shape__() | |||
| 61 | 61 | } | |
| 62 | 62 | public TensorShape output_shape(TensorShape input_shape) | |
| 63 | 63 | { | |
| 64 | - var output_shape = input_shape.Dimensions; | ||
| 64 | + var output_shape = input_shape.dims; | ||
| 65 | 65 | output_shape[output_shape.Length - 1] = units; | |
| 66 | 66 | return new TensorShape(output_shape); | |
| 67 | 67 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,13 +11,13 @@ public static bool is_compatible_with(this Tensor self, Tensor other) | |||
| 11 | 11 | bool _shape_is_compatible_0dim(Shape _this, Shape _other) | |
| 12 | 12 | { | |
| 13 | 13 | var __other = tensor_shape.as_shape(_other); | |
| 14 | - if (_this.Dimensions == null || __other.Dimensions == null) | ||
| 14 | + if (_this.Dimensions == null || __other.dims == null) | ||
| 15 | 15 | return true; | |
| 16 | 16 | ||
| 17 | - if (_this.NDim != __other.NDim) | ||
| 17 | + if (_this.NDim != __other.ndim) | ||
| 18 | 18 | return false; | |
| 19 | 19 | ||
| 20 | - foreach (var (x_dim, y_dim) in _this.Dimensions.Zip(__other.Dimensions, (x_dim, y_dim) => (x_dim, y_dim))) | ||
| 20 | + foreach (var (x_dim, y_dim) in _this.Dimensions.Zip(__other.dims, (x_dim, y_dim) => (x_dim, y_dim))) | ||
| 21 | 21 | { | |
| 22 | 22 | if (x_dim != y_dim) | |
| 23 | 23 | return false; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,10 +25,6 @@ public static void assert_is_compatible_with(this Tensor self, Tensor other) | |||
| 25 | 25 | } | |
| 26 | 26 | ||
| 27 | 27 | public static TensorShape as_shape(this Shape shape) | |
| 28 | - { | ||
| 29 | - if (shape is TensorShape tshape) | ||
| 30 | - return tshape; | ||
| 31 | - return new TensorShape(shape); | ||
| 32 | - } | ||
| 28 | + => new TensorShape(shape.Dimensions); | ||
| 33 | 29 | } | |
| 34 | 30 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -81,7 +81,7 @@ public BatchNormalization(int axis = -1, | |||
| 81 | 81 | ||
| 82 | 82 | protected override void build(TensorShape input_shape) | |
| 83 | 83 | { | |
| 84 | - var ndims = input_shape.NDim; | ||
| 84 | + var ndims = input_shape.ndim; | ||
| 85 | 85 | foreach (var (idx, x) in Python.enumerate(axis)) | |
| 86 | 86 | if (x < 0) | |
| 87 | 87 | axis[idx] = ndims + x; | |
@@ -91,7 +91,7 @@ protected override void build(TensorShape input_shape) | |||
| 91 | 91 | _data_format = "NHWC"; | |
| 92 | 92 | ||
| 93 | 93 | var param_dtype = _dtype == TF_DataType.DtInvalid ? TF_DataType.TF_FLOAT : _dtype; | |
| 94 | - var param_shape = new int[] { input_shape.Dimensions[axis[0]] }; | ||
| 94 | + var param_shape = new int[] { input_shape.dims[axis[0]] }; | ||
| 95 | 95 | ||
| 96 | 96 | if (scale) | |
| 97 | 97 | gamma = add_weight("gamma", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -72,8 +72,8 @@ protected override void build(TensorShape input_shape) | |||
| 72 | 72 | { | |
| 73 | 73 | int channel_axis = data_format == "channels_first" ? 1 : -1; | |
| 74 | 74 | int input_dim = channel_axis < 0 ? | |
| 75 | - input_shape.Dimensions[input_shape.NDim + channel_axis] : | ||
| 76 | - input_shape.Dimensions[channel_axis]; | ||
| 75 | + input_shape.dims[input_shape.ndim + channel_axis] : | ||
| 76 | + input_shape.dims[channel_axis]; | ||
| 77 | 77 | var kernel_shape = new int[] { kernel_size[0], kernel_size[1], input_dim, filters }; | |
| 78 | 78 | kernel = add_weight(name: "kernel", | |
| 79 | 79 | shape: kernel_shape, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -51,7 +51,7 @@ public Dense(int units, | |||
| 51 | 51 | ||
| 52 | 52 | protected override void build(TensorShape input_shape) | |
| 53 | 53 | { | |
| 54 | - var last_dim = input_shape.Dimensions.Last(); | ||
| 54 | + var last_dim = input_shape.dims.Last(); | ||
| 55 | 55 | var axes = new Dictionary<int, int>(); | |
| 56 | 56 | axes[-1] = last_dim; | |
| 57 | 57 | input_spec = new InputSpec(min_ndim: 2, axes: axes); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,7 +30,7 @@ public Tensor call(TensorShape shape, TF_DataType dtype = TF_DataType.DtInvalid) | |||
| 30 | 30 | if (dtype == TF_DataType.DtInvalid) | |
| 31 | 31 | dtype = this.dtype; | |
| 32 | 32 | ||
| 33 | - return array_ops.ones(shape.Dimensions, dtype); | ||
| 33 | + return array_ops.ones(shape.dims, dtype); | ||
| 34 | 34 | } | |
| 35 | 35 | ||
| 36 | 36 | public object get_config() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -132,9 +132,9 @@ public Tensor sparse_softmax_cross_entropy(Tensor labels, | |||
| 132 | 132 | if(weights > 0) | |
| 133 | 133 | { | |
| 134 | 134 | var weights_tensor = ops.convert_to_tensor(weights); | |
| 135 | - var labels_rank = labels.TensorShape.NDim; | ||
| 135 | + var labels_rank = labels.TensorShape.ndim; | ||
| 136 | 136 | var weights_shape = weights_tensor.TensorShape; | |
| 137 | - var weights_rank = weights_shape.NDim; | ||
| 137 | + var weights_rank = weights_shape.ndim; | ||
| 138 | 138 | ||
| 139 | 139 | if (labels_rank > -1 && weights_rank > -1) | |
| 140 | 140 | { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -35,18 +35,18 @@ public Convolution(TensorShape input_shape, | |||
| 35 | 35 | string name = null, | |
| 36 | 36 | string data_format = null) | |
| 37 | 37 | { | |
| 38 | - var num_total_dims = filter_shape.NDim; | ||
| 38 | + var num_total_dims = filter_shape.ndim; | ||
| 39 | 39 | var num_spatial_dims = num_total_dims - 2; | |
| 40 | 40 | int input_channels_dim; | |
| 41 | 41 | int[] spatial_dims; | |
| 42 | 42 | if (string.IsNullOrEmpty(data_format) || !data_format.StartsWith("NC")) | |
| 43 | 43 | { | |
| 44 | - input_channels_dim = input_shape.Dimensions[num_spatial_dims + 1]; | ||
| 44 | + input_channels_dim = input_shape.dims[num_spatial_dims + 1]; | ||
| 45 | 45 | spatial_dims = Enumerable.Range(1, num_spatial_dims).ToArray(); | |
| 46 | 46 | } | |
| 47 | 47 | else | |
| 48 | 48 | { | |
| 49 | - input_channels_dim = input_shape.Dimensions[1]; | ||
| 49 | + input_channels_dim = input_shape.dims[1]; | ||
| 50 | 50 | spatial_dims = Enumerable.Range(2, num_spatial_dims).ToArray(); | |
| 51 | 51 | } | |
| 52 | 52 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments