Caffe2 - Python API
A deep learning, cross platform ML framework
Public Member Functions | Public Attributes | List of all members
test_nn.TestNN Class Reference
Inheritance diagram for test_nn.TestNN:
common_nn.NNTestCase common_utils.TestCase expecttest.TestCase

Public Member Functions

def test_module_backcompat (self)
 
def test_share_memory (self)
 
def test_hooks (self)
 
def test_hook_cpp (self)
 
def test_hook_fail (self)
 
def test_hook_writeable (self)
 
def test_to (self)
 
def test_zero_grad (self)
 
def test_no_grad (self)
 
def test_invalid_conv1d (self)
 
def test_invalid_conv2d (self)
 
def test_invalid_conv3d (self)
 
def test_parameters_and_named_parameters (self)
 
def test_buffers_and_named_buffers (self)
 
def test_call_supports_python_dict_output (self)
 
def test_children (self)
 
def test_dir (self)
 
def test_repr (self)
 
def test_dir_digit (self)
 
def test_named_children (self)
 
def test_modules (self)
 
def test_named_modules (self)
 
def test_register_buffer_raises_error_if_name_is_not_string (self)
 
def test_register_buffer_raises_error_if_attr_exists (self)
 
def test_register_buffer_raises_error_if_not_tensor (self)
 
def test_register_buffer_allows_overwriting_with_same_name (self)
 
def test_register_parameter_raises_error_if_name_is_not_string (self)
 
def test_register_parameter_raises_error_if_attr_exists (self)
 
def test_register_parameter_allows_overwriting_with_same_name (self)
 
def test_add_module_raises_error_if_attr_exists (self)
 
def test_Sequential_getitem (self)
 
def test_Sequential_setitem (self)
 
def test_Sequential_setitem_named (self)
 
def test_Sequential_delitem (self)
 
def test_ModuleList (self)
 
def test_ModuleDict (self)
 
def test_ParameterList (self)
 
def test_ParameterDict (self)
 
def test_add_module (self)
 
def test_module_to_argparse (self)
 
def test_type (self)
 
def test_non_leaf_parameters (self)
 
def test_clip_grad_norm (self)
 
def test_clip_grad_value (self)
 
def test_parameters_to_vector (self)
 
def test_vector_to_parameters (self)
 
def test_nonlinearity_propagate_nan (self)
 
def test_nonlinearity_propagate_nan_cuda (self)
 
def test_weight_norm (self)
 
def test_weight_norm_pickle (self)
 
def test_spectral_norm (self)
 
def test_spectral_norm_load_state_dict (self)
 
def test_spectral_norm_dim (self)
 
def test_spectral_norm_forward (self)
 
def test_spectral_norm_pickle (self)
 
def test_threshold_int (self)
 
def test_embedding_sparse_basic (self)
 
def test_embedding_sparse_empty_tensor (self)
 
def test_embedding_padding_idx (self)
 
def test_embedding_max_norm (self)
 
def test_embedding_max_norm_cuda (self, dtype=torch.float)
 
def test_embedding_from_pretrained (self)
 
def test_embedding_from_pretrained_options (self)
 
def test_embedding_functional (self)
 
def test_softmax_dtype (self, dtype=torch.float)
 
def test_softmax_backward (self)
 
def test_softmax_backward_cuda (self)
 
def test_gumbel_softmax (self, dtype=torch.float)
 
def test_gumbel_softmax_cuda (self, dtype=torch.float)
 
def test_embeddingbag_from_pretrained (self)
 
def test_embeddingbag_from_pretrained_options (self)
 
def test_pool3d_size_one_feature_dim (self)
 
def test_AvgPool3d_backward_after_cat_dim1_cuda (self)
 
def test_contig_wrong_stride_cudnn (self)
 
def test_embedding_bag (self)
 
def test_embedding_bag_cuda (self, dtype=torch.float)
 
def test_fractional_max_pool2d (self)
 
def test_Dropout (self)
 
def test_Dropout2d (self)
 
def test_Dropout3d (self)
 
def test_Dropout_cuda (self)
 
def test_Dropout2d_cuda (self)
 
def test_Dropout3d_cuda (self)
 
def test_AlphaDropout (self)
 
def test_FeatureAlphaDropout (self)
 
def test_InstanceNorm1d_general (self)
 
def test_InstanceNorm1d_general_cuda (self)
 
def test_InstanceNorm2d_general (self)
 
def test_InstanceNorm2d_general_cuda (self)
 
def test_InstanceNorm3d_general (self)
 
def test_InstanceNorm3d_general_cuda (self)
 
def test_LayerNorm_general (self)
 
def test_LayerNorm_general_cuda (self)
 
def test_GroupNorm_general (self)
 
def test_GroupNorm_general_cuda (self)
 
def test_pad (self)
 
def test_one_hot (self)
 
def test_one_hot_cuda (self)
 
def test_pad_scalar_error (self)
 
def test_nn_scalars (self)
 
def test_nn_scalars_reductions (self)
 
def test_normalize (self)
 
def test_adaptive_pooling_input_size (self)
 
def test_adaptive_pooling_size_none (self)
 
def test_Conv2d_naive_groups (self)
 
def test_Conv2d_naive_groups_cuda (self, dtype=torch.float)
 
def test_batchnorm_grad (self)
 
def test_batchnorm_grad_cuda (self)
 
def test_batchnorm_eval (self)
 
def test_batchnorm_eval_cuda (self, dtype=torch.float)
 
def test_batchnorm_simple_average (self)
 
def test_batchnorm_simple_average_cuda (self)
 
def test_MaxPool1d_indices (self)
 
def test_MaxPool1d_indices_cuda (self, dtype=torch.float)
 
def test_MaxPool2d_indices (self)
 
def test_MaxPool2d_indices_cuda (self, dtype=torch.float)
 
def test_MaxPool3d_indices (self)
 
def test_MaxPool3d_indices_cuda (self, dtype=torch.float)
 
def test_AdaptiveMaxPool1d_indices (self)
 
def test_AdaptiveMaxPool1d_indices_cuda (self, dtype=torch.float)
 
def test_AdaptiveMaxPool2d_indices (self)
 
def test_AdaptiveMaxPool2d_indices_cuda (self, dtype=torch.float)
 
def test_AdaptiveMaxPool3d_indices (self)
 
def test_AdaptiveMaxPool3d_indices_cuda (self, dtype=torch.float)
 
def test_max_pool_nan_cuda (self, dtype=torch.float)
 
def test_max_pool_nan (self, dtype=torch.float)
 
def test_pool_large_size_cuda (self, dtype=torch.float)
 
def test_pool_large_size (self, dtype=torch.float)
 
def test_scatter_cpu (self)
 
def test_scatter_gpu (self)
 
def test_gather_cpu (self)
 
def test_gather_gpu (self)
 
def test_gather_different_len_dicts (self)
 
def test_broadcast_double_backwards_gpu (self)
 
def test_broadcast_not_requiring_grad (self)
 
def test_broadcast_no_grad (self)
 
def test_replicate (self)
 
def test_replicate_buffers (self)
 
def test_data_parallel_buffers_requiring_grad (self)
 
def test_parallel_apply (self)
 
def test_data_parallel_multiple_input (self)
 
def test_data_parallel_small_back (self)
 
def test_data_parallel_model_device (self)
 
def test_data_parallel_model_no_refcycles (self)
 
def test_data_parallel_no_grad (self)
 
def test_data_parallel (self)
 
def test_data_parallel_sparse (self)
 
def test_data_parallel_nested_output (self)
 
def test_data_parallel_nested_input (self)
 
def test_data_parallel_module (self, dtype=torch.float)
 
def test_data_parallel_module_kwargs_only (self, dtype=torch.float)
 
def test_data_parallel_module_kwargs_only_empty_list (self, dtype=torch.float)
 
def test_data_parallel_module_kwargs_only_empty_dict (self, dtype=torch.float)
 
def test_data_parallel_module_kwargs_only_empty_tuple (self, dtype=torch.float)
 
def test_data_parallel_device_args (self)
 
def test_state_dict (self)
 
def test_load_state_dict (self)
 
def test_load_state_dict_BC (self)
 
def test_parameter_assignment (self)
 
def test_assignment (self)
 
def test_Conv2d_inconsistent_types (self)
 
def test_Conv2d_inconsistent_types_on_GPU_without_cudnn (self)
 
def test_Conv2d_inconsistent_types_on_GPU_with_cudnn (self)
 
def test_cudnn_multiple_threads_same_device (self)
 
def test_Conv2d_deterministic_cudnn (self, dtype=torch.float)
 
def test_Conv2d_missing_argument (self)
 
def test_Conv2d_backward_twice (self)
 
def test_Conv2d_large_workspace (self, dtype=torch.float)
 
def test_conv_modules_raise_error_on_incorrect_input_size (self)
 
def test_conv_shapecheck (self)
 
def test_ConvTranspose2d_output_size (self)
 
def test_ConvTranspose3d_correct_output_size (self)
 
def test_Conv2d_groups_nobias (self)
 
def test_Conv2d_depthwise_naive_groups_cuda (self, dtype=torch.float)
 
def test_MaxUnpool2d_output_size (self)
 
def test_container_copy (self)
 
def test_RNN_cell (self)
 
def test_loss_equal_input_target_shape (self)
 
def test_nll_loss_mismatched_batch (self)
 
def test_nll_loss_out_of_bounds_ignore_index (self)
 
def test_poisson_nll_loss_reduction_modes (self)
 
def test_KLDivLoss_batch_mean (self)
 
def test_CTCLoss_cudnn (self)
 
def test_CTCLoss_typechecks (self)
 
def test_CTCLoss_lengthchecks_cuda (self)
 
def test_CTCLoss_lengthchecks_cpu (self)
 
def test_CTCLoss_zero_infinity (self)
 
def test_RNN_cell_no_broadcasting (self)
 
def test_invalid_dropout_p (self)
 
def test_pad_sequence (self)
 
def test_pack_sequence (self)
 
def test_pack_padded_sequence (self)
 
def test_variable_sequence (self)
 
def test_variable_sequence_cuda (self, dtype=torch.float)
 
def test_LSTM_cell (self)
 
def test_cudnn_rnn_dropout_states_device (self)
 
def test_cudnn_weight_format (self)
 
def test_cudnn_weight_tying (self)
 
def test_cuda_rnn_fused (self, dtype=torch.float)
 
def test_rnn_args_check (self)
 
def test_rnn_check_device (self)
 
def test_rnn_initial_hidden_state (self)
 
def test_rnn_retain_variables (self)
 
def test_rnn_retain_variables_cuda (self, dtype=torch.float)
 
def test_RNN_cpu_vs_cudnn_no_dropout (self)
 
def test_RNN_cudnn_weight_norm (self)
 
def test_RNN_cpu_vs_cudnn_with_dropout (self)
 
def test_RNN_dropout (self)
 
def test_RNN_dropout_state (self)
 
def test_RNN_change_dropout (self)
 
def test_inplace_thnn (self)
 
def test_noncontig_conv_grad_cuda (self, dtype=torch.float)
 
def test_pixel_shuffle (self)
 
def test_elu_inplace_view (self)
 
def test_relu_inplace_view (self)
 
def test_PReLU_backward_requires_grad_false (self)
 
def test_bce_loss_always_nonnegative (self)
 
def test_bce_with_logits_raises_if_target_and_input_are_different_size (self)
 
def test_bce_with_logits_gives_same_result_as_sigmoid_and_bce_loss (self)
 
def test_bce_with_logits_has_correct_grad_at_zero (self)
 
def test_bce_with_logits_broadcasts_weights (self)
 
def test_bce_with_logits_ones_in_pos_weights_are_the_same_as_none (self)
 
def test_bce_with_logits_broadcasts_pos_weights (self)
 
def test_bce_with_logits_with_pos_weight_has_correct_grad_at_zero (self)
 
def test_bce_with_logits_stability (self)
 
def test_bce_loss_broadcasts_weights (self)
 
def test_elu_inplace_gradgrad (self)
 
def test_hardtanh_inplace_gradgrad (self)
 
def test_batchnorm_cudnn_half (self)
 
def test_batchnorm_large_batch (self, dtype=torch.float)
 
def test_batchnorm_update_stats (self)
 
def test_batchnorm_update_stats_cuda (self)
 
def test_batchnorm_raises_error_if_running_mean_is_not_same_size_as_input (self)
 
def test_batchnorm_raises_error_if_running_var_is_not_same_size_as_input (self)
 
def test_batchnorm_raises_error_if_weight_is_not_same_size_as_input (self)
 
def test_batchnorm_raises_error_if_bias_is_not_same_size_as_input (self)
 
def test_pairwise_distance (self)
 
def test_pdist (self)
 
def test_pdist_zeros (self)
 
def test_pdist_empty_row (self)
 
def test_pdist_empty_col (self)
 
def test_pdist_cpu_gradgrad_unimplemented (self)
 
def test_pdist_cuda_gradgrad_unimplemented (self)
 
def test_cosine_embedding_loss_no_reduce (self)
 
def test_cosine_embedding_loss_margin_no_reduce (self)
 
def test_margin_ranking_loss_no_reduce (self)
 
def test_margin_ranking_loss_margin_no_reduce (self)
 
def test_triplet_margin_loss (self)
 
def test_triplet_margin_loss_swap (self)
 
def test_triplet_margin_loss_no_reduce (self)
 
def test_triplet_margin_loss_swap_no_reduce (self)
 
def test_pointwise_loss_target_grad_none_reduction (self)
 
def test_pointwise_loss_broadcast (self)
 
def test_cosine_similarity (self)
 
def test_grid_sample_error_checking (self)
 
def test_grid_sample (self)
 
def test_grid_sample_3d (self)
 
def test_affine_grid (self)
 
def test_affine_2d_rotate0 (self)
 
def test_affine_2d_rotate90 (self)
 
def test_affine_2d_rotate45 (self)
 
def test_affine_2d_rotateRandom (self)
 
def test_affine_3d_rotateRandom (self)
 
def test_upsamplingNearest1d (self)
 
def test_upsamplingLinear1d (self)
 
def test_upsamplingLinear1d_spatial_invariance (self)
 
def test_upsamplingNearest2d (self)
 
def test_upsamplingBilinear2d (self)
 
def test_upsamplingBicubic2d (self)
 
def test_upsamplingBilinear2d_spatial_invariance (self)
 
def test_upsamplingNearest3d (self)
 
def test_upsamplingTrilinear3d (self)
 
def test_upsamplingTrilinear3d_spatial_invariance (self)
 
def test_interpolate (self)
 
def test_linear_broadcasting (self)
 
def test_bilinear (self)
 
def test_bilinear_no_bias (self)
 
def test_bilinear_broadcasting (self)
 
def test_conv_tbc (self)
 
def test_conv_noncontig_weights (self)
 
def test_conv_noncontig_weights_cuda (self)
 
def test_conv_noncontig_weights_and_bias (self)
 
def test_conv_noncontig_weights_and_bias_cuda (self)
 
def run_conv_double_back_test (self, kern, stride, padding, chan_in, chan_out, batch_size, inp_size, dilation, no_weight, groups=1, use_cuda=False, use_bias=True, dtype=torch.double)
 
def test_conv_double_backward (self)
 
def test_conv_double_backward_no_bias (self)
 
def test_conv_double_backward_groups (self)
 
def test_conv_double_backward_stride (self)
 
def test_cudnn_noncontiguous_weight (self)
 
def test_conv_double_backward_cuda (self, dtype=torch.double)
 
def run_grad_conv_test (self, func_forward, func_backward, dim=1, gradient='input')
 
def test_grad_conv1d_input (self)
 
def test_grad_conv1d_weight (self)
 
def test_grad_conv2d_input (self)
 
def test_grad_conv2d_weight (self)
 
def test_grad_conv3d_input (self)
 
def test_grad_conv3d_weight (self)
 
def test_nnpack_conv (self)
 
def test_fold_invalid_arg (self)
 
def test_unfold_invalid_arg (self)
 
def test_softmin (self)
 
def test_adaptive_log_softmax (self)
 
- Public Member Functions inherited from common_nn.NNTestCase
def check_jacobian (self, module, input, jacobian_input=True)
 
def check_criterion_jacobian (self, criterion, input, target)
 
- Public Member Functions inherited from common_utils.TestCase
def __init__ (self, method_name='runTest')
 
def assertLeaksNoCudaTensors (self, name=None)
 
def wrap_with_cuda_memory_check (self, method)
 
def setUp (self)
 
def assertTensorsSlowEqual (self, x, y, prec=None, message='')
 
def genSparseTensor (self, size, sparse_dim, nnz, is_uncoalesced, device='cpu')
 
def safeToDense (self, t)
 
def safeCoalesce (self, t)
 
def assertEqual (self, x, y, prec=None, message='', allow_inf=False)
 
def assertAlmostEqual (self, x, y, places=None, msg=None, delta=None, allow_inf=None)
 
def assertNotEqual (self, x, y, prec=None, message='')
 
def assertObjectIn (self, obj, iterable)
 
def assertExpectedRaises (self, exc_type, callable, args, kwargs)
 
def assertWarns (self, callable, msg='')
 
def assertWarnsRegex (self, callable, regex, msg='')
 
def assertExpected (self, s, subname=None)
 
- Public Member Functions inherited from expecttest.TestCase
def assertExpectedInline (self, actual, expect, skip=0)
 

Public Attributes

 layer_dummy_param
 
 l1
 
 dummy_param
 
 p
 
 par
 
 check_backward_hook_flag
 
 l2
 
 param
 
 block
 
 linear
 
 l
 

Additional Inherited Members

- Static Public Attributes inherited from common_utils.TestCase
int precision = 1
 
 maxDiff = None
 
 assertRegex = unittest.TestCase.assertRegexpMatches
 
 assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
 
- Static Public Attributes inherited from expecttest.TestCase
bool longMessage = True
 

Detailed Description

Definition at line 499 of file test_nn.py.

Member Function Documentation

def test_nn.TestNN.test_gumbel_softmax (   self,
  dtype = torch.float 
)
NO_HALF_TENSORTYPES because many half-ops doesnt work on cpu.

Definition at line 2254 of file test_nn.py.

def test_nn.TestNN.test_pdist_zeros (   self)
Test that grad is still valid when dist is 0

Definition at line 5820 of file test_nn.py.


The documentation for this class was generated from the following file: