internal static NDArrayOrSymbol[] GetBeginState(RecurrentCell cell, NDArrayOrSymbol[] begin_state, NDArrayOrSymbol inputs, int batch_size) { if (begin_state != null) { if (inputs.IsNDArray) { var ctx = inputs.NdX.Context; var args = new FuncArgs(); args.Add("ctx", ctx); begin_state = cell.BeginState(batch_size, "nd.Zeros", args); } else { begin_state = cell.BeginState(batch_size, "sym.Zeros"); } } return(begin_state); }
public override KerasSymbol[] Invoke(KerasSymbol[] inputs, FuncArgs kwargs = null) { List <KerasSymbol> result = new List <KerasSymbol>(); bool training = kwargs.Get <bool>("training"); foreach (var input in inputs) { Func <KerasSymbol> dropped_inputs = () => { return(K.Dropout(input, this.rate, noise_shape, seed: this.seed)); }; if ((0 < this.rate) && (this.rate < 1.0)) { var noise_shape = this.GetNoiseShape(input); result.Add(K.InTrainPhase(dropped_inputs, input, training: training)); } } return(result.ToArray()); }
public StateInfo(FuncArgs args) { foreach (var arg in args) { if (arg.Value == null) { continue; } switch (arg.Key.ToLower()) { case "shape": Shape = (Shape)arg.Value; break; case "layout": Layout = arg.Value.ToString(); break; case "in_layout": Layout = arg.Value.ToString(); break; case "mean": Mean = Convert.ToSingle(arg.Value); break; case "std": Mean = Convert.ToSingle(arg.Value); break; case "dtype": DataType = (DType)arg.Value; break; case "ctx": Ctx = (Context)arg.Value; break; } } }
public override KerasSymbol[] Invoke(KerasSymbol[] inputs, FuncArgs kwargs = null) { List <KerasSymbol> result = new List <KerasSymbol>(); foreach (var input in inputs) { var output = K.Dot(input, this.kernel); if (this.use_bias) { output = K.BiasAdd(output, this.bias, data_format: "channels_last"); } result.Add(output); } if (this.activation != null) { return(this.activation.Invoke(result.ToArray())); } return(result.ToArray()); }
public FastSEResNet(string architecture, string norm_layer = "BatchNorm", FuncArgs kwargs = null, string prefix = "", ParameterDict @params = null) : base(prefix, @params) { throw new NotImplementedException(); }
public DarknetV3(int[] layers, int[] channels, int classes = 1000, string norm_layer = "BatchNorm", FuncArgs norm_kwargs = null, string prefix = null, ParameterDict @params = null) : base(prefix, @params) { Debug.Assert(layers.Length == channels.Length - 1, $"len(channels) should equal to len(layers) + 1, given {channels.Length} vs {layers.Length}"); this.features = new HybridSequential(); // first 3x3 conv this.features.Add(Conv2d(channels[0], 3, 1, 1, norm_layer: norm_layer, norm_kwargs: norm_kwargs)); for (int i = 0; i < layers.Length; i++) { int nlayer = layers[i]; int channel = channels[i]; Debug.Assert(channel % 2 == 0, $"channel {channel} cannot be divided by 2"); // add downsample conv with stride=2 this.features.Add(Conv2d(channel, 3, 1, 2, norm_layer: norm_layer, norm_kwargs: norm_kwargs)); // add nlayer basic blocks foreach (var _ in Enumerable.Range(0, nlayer)) { this.features.Add(new DarknetBasicBlockV3(channel / 2, norm_layer: norm_layer, norm_kwargs: norm_kwargs)); } } // output this.output = new Dense(classes); RegisterChild(features); RegisterChild(output); }
public IDAUp(int out_channels, int in_channels, float[] up_f, bool use_dcnv2 = false, string norm_layer = "BatchNorm", FuncArgs norm_kwargs = null, string prefix = "", ParameterDict @params = null) : base(prefix, @params) { throw new NotImplementedException(); }
private HybridSequential MakeBasicConv(int in_channels, int channels, string norm_layer = "BatchNorm", FuncArgs norm_kwargs = null) { throw new NotImplementedException(); }
public override NDArrayOrSymbol[] BeginState(int batch_size = 0, string func = null, FuncArgs args = null) { BaseCell._modified = false; var begin = BaseCell.BeginState(batch_size, func, args); BaseCell._modified = true; return(begin); }
public static CIFARResNetV2 Cifar_ResNet110_V2(bool pretrained = false, Context ctx = null, string root = "~/mxnet", string norm_layer = "BatchNorm", FuncArgs norm_kwargs = null) { throw new NotImplementedException(); }
public static HybridSequential MakeLayerSlow(int inplanes, int planes, int num_blocks, int?num_block_temp_kernel_slow = null, string block = "Bottleneck", int strides = 1, int head_conv = 1, string norm_layer = "BatchNorm", FuncArgs norm_kwargs = null, string layer_name = "") { throw new NotImplementedException(); }
public NASNetALarge(int repeat = 6, int penultimate_filters = 4032, int stem_filters = 96, int filters_multiplier = 2, int classes = 1000, bool use_aux = true, string norm_layer = "BatchNorm", FuncArgs norm_kwargs = null, string prefix = "", ParameterDict @params = null) : base(prefix, @params) { throw new NotImplementedException(); }
public ResidualBlock(int channels, int?in_channels = null, int stride = 1, string norm_layer = "BatchNorm", FuncArgs norm_kwargs = null, string prefix = null, ParameterDict @params = null) : base(prefix, @params) { throw new NotImplementedException(); }
public BasicBlock(int inplanes, int planes, int spatial_stride = 1, int temporal_stride = 1, int dilation = 1, bool downsample = false, bool if_inflate = true, string inflate_style = "", string norm_layer = "BatchNorm", FuncArgs norm_kwargs = null, string layer_name = "", string prefix = "", ParameterDict @params = null) : base(prefix, @params) { throw new NotImplementedException(); }
public Bottleneck(int inplanes, int planes, int spatial_stride = 1, int temporal_stride = 1, int dilation = 1, bool downsample = false, bool if_inflate = true, string inflate_style = "3x1x1", string norm_layer = "BatchNorm", FuncArgs norm_kwargs = null, string layer_name = "", string prefix = "", ParameterDict @params = null) : base(prefix, @params) { }
public CIFARResNetV2(HybridBlock block, int[] layers, int[] channels, int classes = 10, string norm_layer = "BatchNorm", FuncArgs norm_kwargs = null, string prefix = "", ParameterDict @params = null) : base(prefix, @params) { throw new NotImplementedException(); }
private HybridSequential MakeLayer(HybridBlock block, int[] layers, int[] channels, int stride, int stage_index, int in_channels = 0, string norm_layer = "BatchNorm", FuncArgs norm_kwargs = null) { throw new NotImplementedException(); }
public Bottleneck(int inplanes, int planes, int strides = 1, bool downsample = false, int head_conv = 1, string norm_layer = "BatchNorm", FuncArgs norm_kwargs = null, string layer_name = "", string prefix = null, ParameterDict @params = null) : base(prefix, @params) { throw new NotImplementedException(); }
public Tree(int levels, HybridBlock block, int in_channels, int out_channels, int stride = 1, bool level_root = false, int root_dim = 0, int root_kernel_size = 1, int dilation = 1, bool root_residual = false, string norm_layer = "BatchNorm", FuncArgs norm_kwargs = null, string prefix = null, ParameterDict @params = null) : base(prefix, @params) { throw new NotImplementedException(); }
public SE_BasicBlockV2(int channels, int stride, bool downsample = false, int in_channels = 0, string norm_layer = "BatchNorm", FuncArgs norm_kwargs = null, string prefix = "", ParameterDict @params = null) : base(prefix, @params) { }
public GoogLeNet(int classes = 1000, string norm_layer = "BatchNorm", float dropout_ratio = 0.4f, bool aux_logits = false, FuncArgs norm_kwargs = null, bool partial_bn = false, bool pretrained_base = true, Context ctx = null, string prefix = null, ParameterDict @params = null) : base(prefix, @params) { throw new NotImplementedException(); }
public override KerasSymbol[] Invoke(KerasSymbol[] inputs, FuncArgs kwargs = null) { throw new NotImplementedException(); }
private HybridSequential MakeBranch(bool use_pool, string norm_layer = "BatchNorm", FuncArgs norm_kwargs = null, int?channels = null, (int, int)?kernel_size = null, (int, int)?strides = null, (int, int)?padding = null)
public NormalCell(int out_channels_left, int out_channels_right, string norm_layer, FuncArgs norm_kwargs, string prefix = null, ParameterDict @params = null) : base(prefix, @params) { throw new NotImplementedException(); }
public MaskRCNN(HybridBlock features, HybridBlock top_features, string[] classes, int mask_channels = 256, int rcnn_max_dets = 1000, int rpn_test_pre_nms = 6000, int rpn_test_post_nms = 1000, int target_roi_scale = 1, int num_fcn_convs = 0, string norm_layer = "", FuncArgs norm_kwargs = null, string prefix = null, ParameterDict @params = null) : base(features: features, top_features: top_features, classes: classes, rpn_test_pre_nms: rpn_test_pre_nms, rpn_test_post_nms: rpn_test_post_nms, additional_output: true, prefix: prefix, @params: @params) { throw new NotImplementedException(); }
private HybridSequential ASPPConv(int in_channels, int out_channels, float atrous_rate, string norm_layer, FuncArgs norm_kwargs) { throw new NotImplementedException(); }
internal static HybridSequential Conv2d(int channel, int kernel, int padding, int stride, string norm_layer = "BatchNorm", FuncArgs norm_kwargs = null) { var cell = new HybridSequential(prefix: ""); cell.Add(new Conv2D(channel, kernel_size: (kernel, kernel), strides: (stride, stride), padding: (padding, stride), use_bias: false)); cell.Add(LayerUtils.NormLayer(norm_layer, norm_kwargs)); cell.Add(new LeakyReLU(0.1f)); return(cell); }
public _DeepLabHead(int nclass, int c1_channels = 128, string norm_layer = "BatchNorm", FuncArgs norm_kwargs = null, int height = 240, int width = 240, string prefix = "", ParameterDict @params = null) : base(prefix, @params) { throw new NotImplementedException(); }
public Node(Layer outbound_layer, Layer[] inbound_layers, int[] node_indices, int[] tensor_indices, KerasSymbol[] input_tensors, KerasSymbol[] output_tensors, KerasSymbol[] input_masks, KerasSymbol[] output_masks, Shape[] input_shapes, Shape[] output_shapes, FuncArgs arguments = null) { throw new NotImplementedException(); }
public _ASPP(int in_channels, int out_channels, string norm_layer, FuncArgs norm_kwargs, int height = 60, int width = 60, string prefix = "", ParameterDict @params = null) : base(prefix, @params) { throw new NotImplementedException(); }