コード例 #1
0
ファイル: MNIST.cs プロジェクト: cartermp/TorchSharp
            public override TorchTensor forward(TorchTensor input)
            {
                var l11 = conv1.forward(input);
                var l12 = relu2.forward(l11);

                var l21 = conv2.forward(l12);
                var l22 = relu2.forward(l21);
                var l23 = pool1.forward(l22);
                var l24 = dropout1.forward(l23);

                var x = flatten.forward(l24);

                var l31 = fc1.forward(x);
                var l32 = relu3.forward(l31);
                var l33 = dropout2.forward(l32);

                var l41 = fc2.forward(l33);

                return(logsm.forward(l41));
            }
コード例 #2
0
            public override TorchTensor forward(TorchTensor input)
            {
                using (var l11 = conv1.forward(input))
                    using (var l12 = pool1.forward(l11))
                        using (var l13 = relu1.forward(l12))

                            using (var l21 = conv2.forward(l13))
                                using (var l22 = pool2.forward(l21))
                                    using (var l23 = dropout1.forward(l22))
                                        using (var l24 = relu2.forward(l23))

                                            using (var x = flatten.forward(l24))

                                                using (var l31 = fc1.forward(x))
                                                    using (var l32 = relu3.forward(l31))
                                                        using (var l33 = dropout2.forward(l32))

                                                            using (var l41 = fc2.forward(l33))
                                                                return(logsm.forward(l41));
            }