AI-MXNet-Gluon-ModelZoo

 view release on metacpan or  search on metacpan

lib/AI/MXNet/Gluon/ModelZoo/Vision/MobileNet.pm  view on Meta::CPAN

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

use strict;
use warnings;
use AI::MXNet::Function::Parameters;
package AI::MXNet::Gluon::ModelZoo::Vision::MobileNet::RELU6;
use AI::MXNet::Gluon::Mouse;
extends 'AI::MXNet::Gluon::HybridBlock';

method hybrid_forward(GluonClass $F, GluonInput $x)
{
    return $F->clip($x, a_min => 0, a_max => 6, name=>"relu6");
}

package AI::MXNet::Gluon::ModelZoo::Vision::MobileNet::LinearBottleneck;
use AI::MXNet::Gluon::Mouse;
extends 'AI::MXNet::Gluon::HybridBlock';
has [qw/in_channels channels t stride/] => (is => 'ro', isa => 'Int', required => 1);
method python_constructor_arguments(){ [qw/in_channels channels t stride/] }

=head1 NAME

    AI::MXNet::Gluon::ModelZoo::Vision::MobileNet::LinearBottleneck - LinearBottleneck used in MobileNetV2 model
=cut

=head1 DESCRIPTION

    LinearBottleneck used in MobileNetV2 model from the
    "Inverted Residuals and Linear Bottlenecks:
      Mobile Networks for Classification, Detection and Segmentation"
    <https://arxiv.org/abs/1801.04381> paper.

    Parameters
    ----------
    in_channels : Int
        Number of input channels.
    channels : Int
        Number of output channels.
    t : Int
        Layer expansion ratio.
    stride : Int
        stride
=cut

func _add_conv(
    $out, $channels, :$kernel=1, :$stride=1, :$pad=0,
    :$num_group=1, :$active=1, :$relu6=0
)
{



( run in 0.555 second using v1.01-cache-2.11-cpan-acf6aa7dc9e )