public SerializedStandardLayer(double[] bias, double[,] weights, ActivatorType activatorType, IGradientAdjustmentParameters gradientAdjustmentParameters)
 {
     Bias          = bias;
     Weights       = weights;
     ActivatorType = activatorType;
     GradientAdjustmentParameters = gradientAdjustmentParameters;
 }
 public ActivationLayerConfiguration(
     MessageShape inputMessageShape,
     ActivatorType activatorType)
     : base(inputMessageShape)
 {
     ActivatorType = activatorType;
 }
Ejemplo n.º 3
0
 public ActivationForwardLayer(
     ActivatorType type,
     MessageShape inputMessageShape)
     : base(inputMessageShape, inputMessageShape)
 {
     Activator = ActivatorFactory.Produce(type);
 }
Ejemplo n.º 4
0
 public virtual void Init(ActivatorComponentData data)
 {
     m_Cooldown      = data.cooldown;
     m_Radius        = data.radius;
     m_CooldownTimer = cooldown;
     activatorType   = data.activatorType;
     SetInteractable(true);
 }
Ejemplo n.º 5
0
 public ActivationFullLayer(
     ActivatorType type,
     MessageShape inputMessageShape)
     : base(type, inputMessageShape)
 {
     _cache       = inputMessageShape.Depth == 1
         ? _cache = new double[inputMessageShape.Size]
         : _cache = new double[inputMessageShape.Depth,
                               inputMessageShape.Size,
                               inputMessageShape.Size];
 }
Ejemplo n.º 6
0
        public static IActivator Produce(ActivatorType type)
        {
            switch (type)
            {
            case ActivatorType.LogisticActivator: return(new LogisticActivator());

            case ActivatorType.TanhActivator: return(new TanhActivator());

            case ActivatorType.ReluActivator: return(new ReluActivator());

            default: throw new Exception();
            }
        }
Ejemplo n.º 7
0
 public ActivatorComponentData(XElement e)
 {
     cooldown = e.GetFloat("cooldown");
     radius   = e.GetFloat("radius");
     if (e.HasAttribute("activator_type"))
     {
         activatorType = (ActivatorType)System.Enum.Parse(typeof(ActivatorType), e.GetString("activator_type"));
     }
     else
     {
         activatorType = ActivatorType.PirateSpawn;
     }
 }
Ejemplo n.º 8
0
        public static Activator Produce(ActivatorType type)
        {
            switch (type)
            {
            case ActivatorType.Sigmoid: return(new LogisticActivator());

            case ActivatorType.Tanh: return(new TanhActivator());

            case ActivatorType.Relu: return(new ReluActivator());

            default: throw new Exception(Messages.ActivatorTypeIsNotSupported);
            }
        }
Ejemplo n.º 9
0
    private void PlaceActivator(ActivatorType type, Vector3Int bounds, Vector3Int offset)
    {
        if (type == ActivatorType.SingleOnEdge)
        {
            // If this is the first platform, we skip BottomLeft because that's where the player spawns.
            if (FirstPlatform(offset))
            {
                PlaceSingleActivatorOnEdge((EdgeType)Random.Range(1, System.Enum.GetValues(typeof(EdgeType)).Length), bounds, offset);
            }
            else
            {
                PlaceSingleActivatorOnEdge((EdgeType)Random.Range(0, System.Enum.GetValues(typeof(EdgeType)).Length), bounds, offset);
            }
        }

        _activatorIter++;
    }
Ejemplo n.º 10
0
        public void AddFullyConnectedLayer(int numberOfNeurons, ActivatorType activatorType, LearningRateAnnealerType lrat)
        {
            if (!_layers.OfType <FullyConnectedLayer>().Any())
            {
                var last = _layers.OfType <FilterLayer>().Last();
                var fm   = last.GetOutputFilterMeta();
                _layers.Add(new FlattenLayer(fm.Channels, fm.Size, last.LayerIndex + 1));
            }

            _layers.Add(new FullyConnectedLayer(
                            ActivatorFactory.Produce(activatorType),
                            numberOfNeurons,
                            _layers.Last().GetNumberOfOutputValues(),
                            _layers.Last().LayerIndex + 1,
                            _weightInitializer,
                            lrat));
        }
Ejemplo n.º 11
0
 public void AddDetectorLayer(ActivatorType activatorType)
 {
     if (_layers.Any())
     {
         _layers.Add(new DetectorLayer(
                         _layers.Last().LayerIndex + 1,
                         ActivatorFactory.Produce(activatorType),
                         _layers.OfType <FilterLayer>().Last().GetOutputFilterMeta()));
     }
     else
     {
         _layers.Add(new DetectorLayer(
                         1,
                         ActivatorFactory.Produce(activatorType),
                         new FilterMeta(_networkConfig.InputDimenision, _networkConfig.InputChannels)));
     }
 }
        public static IActivator Build(ActivatorType activatorType)
        {
            switch (activatorType)
            {
            case ActivatorType.Sigmoid:
                return(new Sigmoid());

            case ActivatorType.Identity:
                return(new Identity());

            case ActivatorType.LeakyReLU:
                return(new LeakyReLU());

            case ActivatorType.Tanh:
                return(new Tanh());

            case ActivatorType.ReLU:
                return(new ReLU());

            default:
                throw new InvalidOperationException("Unknown activator type: " + activatorType.ToString());
            }
        }
Ejemplo n.º 13
0
        public void AddActivationLayer(ActivatorType activatorType)
        {
            var shape = _layers.Last().GetOutputMessageShape();

            _layers.Add(new ActivationFullLayer(activatorType, shape));
        }