MXNet/Types.pm untested

filter: Statementstmt 0.0% 0 / 90 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 0.0% 0 / 5 Podpod n/a totaltotal 0.0% 0 / 107 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 # Licensed to the Apache Software Foundation (ASF) under one
2 # or more contributor license agreements. See the NOTICE file
3 # distributed with this work for additional information
4 # regarding copyright ownership. The ASF licenses this file
5 # to you under the Apache License, Version 2.0 (the
6 # "License"); you may not use this file except in compliance
7 # with the License. You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing,
12 # software distributed under the License is distributed on an
13 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 # KIND, either express or implied. See the License for the
15 # specific language governing permissions and limitations
16 # under the License.
17  
18 package AI::MXNet::Types;
19 use strict;
20 use warnings;
21 use Mouse::Util::TypeConstraints;
22 use Exporter;
23 use base qw(Exporter);
24 @AI::MXNet::Types::EXPORT = qw(find_type_constraint enum);
25  
26 class_type 'PDL';
27 class_type 'PDL::Matrix';
28 class_type 'PDL::CCS::Nd';
29 class_type 'AI::MXNet::NDArray';
30 class_type 'AI::MXNet::Symbol';
31 class_type 'AI::MXNet::NDArray::Slice';
32 class_type 'AI::MXNet::Executor';
33 class_type 'AI::MXNet::DataDesc';
34 class_type 'AI::MXNet::Callback';
35 class_type 'AI::MXNet::EvalMetric';
36 class_type 'AI::MXNet::DataParallelExecutorGroup';
37 class_type 'AI::MXNet::Optimizer';
38 class_type 'AI::MXNet::Initializer';
39 class_type 'AI::MXNet::KVStore';
40 class_type 'AI::MXNet::InitDesc';
41 class_type 'AI::MXNet::IRHeader';
42 class_type 'AI::MXNet::Updater';
43 class_type 'AI::MXNet::KVStore';
44 class_type 'AI::MXNet::Gluon::Block';
45 class_type 'AI::MXNet::Gluon::Data::Set';
46 class_type 'AI::MXNet::Gluon::RNN::HybridRecurrentCell';
47 class_type 'AI::MXNet::Symbol::NameManager';
48 class_type 'AI::MXNet::NDarray::CSR';
49 class_type 'AI::MXNet::NDArray::RowSparse';
50 class_type 'PDL::CCS::Nd';
51 subtype "AcceptableInput" => as "Num|PDL|PDL::Matrix|PDL::CCS::Nd|AI::MXNet::NDArray|AI::MXNet::NDArray::Slice|ArrayRef|AI::MXNet::NDarray::CSR|AI::MXNet::NDArray::RowSparse";
52 subtype "Index" => as "Int";
53 subtype "DimSize" => as "Int" => where { $_ >= 0 };
54 subtype "Dropout" => as "Num" => where { $_ >= 0 and $_ <= 1 };
55 subtype "Shape" => as "ArrayRef[DimSize]";
56 subtype "CudaKernelShape" => as "Shape" => where { @$_ == 3 };
57 subtype "WholeDim" => as "Str" => where { $_ eq 'X' };
58 subtype "Slice" => as "ArrayRef[Index]|WholeDim|Index" => where { ref $_ ? @$_ > 0 : 1 };
59 subtype "Dtype" => as enum([qw[float32 float64 float16 uint8 int8 int32 int64]]);
60 subtype "GluonClass" => as enum([qw[AI::MXNet::NDArray AI::MXNet::Symbol]]);
61 subtype "GluonInput" => as "AI::MXNet::NDArray|AI::MXNet::Symbol|ArrayRef[AI::MXNet::NDArray|AI::MXNet::Symbol]";
62 subtype "GradReq" => as enum([qw[add write null]]);
63 subtype "KVStoreStr" => as enum([qw[local device dist dist_sync dist_async]]);
64 subtype "PoolType" => as enum([qw[max avg sum]]);
65 subtype "NameShape" => as "ArrayRef" => where {
66 find_type_constraint("Str")->check($_->[0])
67 and
68 find_type_constraint("Shape")->check($_->[1])
69 };
70 subtype "Callback" => as "CodeRef|ArrayRef[Coderef]|AI::MXNet::Callback|ArrayRef[AI::MXNet::Callback]";
71 subtype "EvalMetric" => as "AI::MXNet::EvalMetric|Str|CodeRef";
72 subtype "Metric" => as "Maybe[EvalMetric]";
73 subtype "Optimizer" => as "AI::MXNet::Optimizer|Str";
74 subtype "Initializer" => as "AI::MXNet::Initializer|Str";
75 subtype "Updater" => as "AI::MXNet::Updater|CodeRef";
76 subtype "KVStore" => as "AI::MXNet::KVStore|KVStoreStr";
77 subtype "Activation" => as "AI::MXNet::Symbol|Str|CodeRef";
78 subtype "SymbolOrArrayOfSymbols" => as "AI::MXNet::Symbol|ArrayRef[AI::MXNet::Symbol]";
79 subtype "NameShapeOrDataDesc" => as "NameShape|AI::MXNet::DataDesc";
80 subtype "AdvancedSlice" => as "ArrayRef[ArrayRef|PDL|PDL::Matrix|AI::MXNet::NDArray]";
81 subtype "InternalSlice" => as enum([qw[begin end step]]);
82 subtype "Stype" => as enum([qw[default csr row_sparse]]);
83 subtype "AuxTypes" => as "ArrayRef[Dtype]";
84  
85 1;