Class: Torch::NN::InstanceNorm

Inherits:
BatchNorm show all
Defined in:
lib/torch/nn/instance_norm.rb

Direct Known Subclasses

InstanceNorm1d, InstanceNorm2d, InstanceNorm3d

Instance Attribute Summary

Attributes inherited from Module

#training

Instance Method Summary collapse

Methods inherited from BatchNorm

#extra_inspect, #reset_parameters, #reset_running_stats

Methods inherited from Module

#_apply, #add_module, #apply, #buffers, #call, #children, #cpu, #cuda, #deep_dup, #double, #eval, #float, #half, #inspect, #load_state_dict, #method_missing, #modules, #named_buffers, #named_children, #named_modules, #named_parameters, #parameters, #register_buffer, #register_parameter, #requires_grad!, #respond_to?, #share_memory, #state_dict, #to, #train, #type, #zero_grad

Methods included from Utils

#_activation_fn, #_clones, #_ntuple, #_pair, #_quadrupal, #_single, #_triple

Constructor Details

#initialize(num_features, eps: 1e-5, momentum: 0.1, affine: false, track_running_stats: false) ⇒ InstanceNorm

Returns a new instance of InstanceNorm.



4
5
6
# File 'lib/torch/nn/instance_norm.rb', line 4

def initialize(num_features, eps: 1e-5, momentum: 0.1, affine: false, track_running_stats: false)
  super(num_features, eps: eps, momentum: momentum, affine: affine, track_running_stats: track_running_stats)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Torch::NN::Module

Instance Method Details

#forward(input) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/torch/nn/instance_norm.rb', line 8

def forward(input)
  _check_input_dim(input)

  F.instance_norm(
    input, running_mean: @running_mean, running_var: @running_var,
    weight: @weight, bias: @bias,
    use_input_stats: @training || !@track_running_stats,
    momentum: @momentum, eps: @eps
  )
end