예제 #1
0
        public CrossEntropyLoss(SyftController controller)
        {
            init("crossentropyloss");

                        #pragma warning disable 420
            id = System.Threading.Interlocked.Increment(ref nCreated);
            controller.addModel(this);
        }
예제 #2
0
        public Sigmoid(SyftController controller)
        {
            init("sigmoid");

#pragma warning disable 420
            id = System.Threading.Interlocked.Increment(ref nCreated);
            controller.addModel(this);
        }
예제 #3
0
        public ReLU(SyftController controller, GraphProto graph)
        {
            init(this.name);

            #pragma warning disable 420
            id = System.Threading.Interlocked.Increment(ref nCreated);
            controller.addModel(this);
        }
예제 #4
0
        public Softmax(SyftController controller, GraphProto graph)
        {
            init(this.name);

            this.dim = (int)graph.Node[0].Attribute[0].I;

            #pragma warning disable 420
            id = System.Threading.Interlocked.Increment(ref nCreated);
            controller.addModel(this);
        }
예제 #5
0
        public Softmax(SyftController controller, int dim)
        {
            init(this.name);

            this.dim = dim;

            #pragma warning disable 420
            id = System.Threading.Interlocked.Increment(ref nCreated);
            controller.addModel(this);
        }
예제 #6
0
        public Policy(SyftController _controller, Layer _model)
        {
            init("policy");
            controller = _controller;

            model = _model;

            #pragma warning disable 420
            id = System.Threading.Interlocked.Increment(ref nCreated);
            controller.addModel(this);
        }
예제 #7
0
        public Embedding(SyftController controller, int numEmbeddings, int embeddingDim)
        {
            init("embedding");

            this.controller = controller;

            _numEmbeddings = numEmbeddings;
            _embeddingDim  = embeddingDim;

            int[] weightShape = { _numEmbeddings, _embeddingDim };
            var   weights     = controller.RandomWeights(_numEmbeddings * _embeddingDim);

            _weights = controller.floatTensorFactory.Create(_shape: weightShape, _data: weights, _autograd: true, _keepgrads: true);

            parameters.Add(_weights.Id);

            #pragma warning disable 420
            id = System.Threading.Interlocked.Increment(ref nCreated);
            controller.addModel(this);
        }