def test_simple_recurrent_node_serialization(): nodes.check_serialization( nodes.recurrent.SimpleRecurrentNode("a", nodes.IdentityNode("b"))) nodes.check_serialization( nodes.recurrent.SimpleRecurrentNode("a", nodes.IdentityNode("b"), num_units=32, batch_size=2**7))
def test_add_bias_node_serialization(): tn.check_serialization(tn.AddBiasNode("a")) tn.check_serialization(tn.AddBiasNode( "a", inits=[], # need to make broadcastable a list because json (de)serialization # converts tuples to lists broadcastable=[True, False, True]))
def test_add_bias_node_serialization(): tn.check_serialization(tn.AddBiasNode("a")) tn.check_serialization( tn.AddBiasNode( "a", inits=[], # need to make broadcastable a list because json (de)serialization # converts tuples to lists broadcastable=[True, False, True]))
def test_hyperparameter_node_serialization(): tn.check_serialization( tn.HyperparameterNode("a", tn.ReferenceNode("b")))
def test_graph_node_serialization(): tn.check_serialization(tn.GraphNode("a", [[tn.IdentityNode("b")], [{"from": "b", "to": "a"}]]))
def test_aggregator_node_serialization(): tn.check_serialization(tn.AggregatorNode("a"))
def test_inverse_node_serialization(): tn.check_serialization(inverse.InverseNode("a"))
def test_dense_combine_node_serialization(): tn.check_serialization(tn.DenseCombineNode("a", [])) tn.check_serialization(tn.DenseCombineNode("a", [], num_units=100))
def test_elementwise_cost_node_serialization(): tn.check_serialization( tn.ElementwiseCostNode("foo", { "pred": tn.IdentityNode("foo"), "target": tn.IdentityNode("bar") }))
def test_elementwise_contraction_penalty_node_serialization(): tn.check_serialization(cp.ElementwiseContractionPenaltyNode("a"))
def test_to_one_hot_node_serialization(): tn.check_serialization(tn.ToOneHotNode("a"))
def test_softmax_node_serialization(): tn.check_serialization(tn.SoftmaxNode("a"))
def test_resqrt_node_serialization(): tn.check_serialization(tn.ReSQRTNode("a"))
def test_relu_node_serialization(): tn.check_serialization(tn.ReLUNode("a"))
def test_split_probabilities_to_leaf_probabilities_node_serialization(): for node in [dNDF.TheanoSplitProbabilitiesToLeafProbabilitiesNode, dNDF.NumpySplitProbabilitiesToLeafProbabilitiesNode]: tn.check_serialization(node("a"))
def test_sequential_node_serialization(): tn.check_serialization(tn.SequentialNode("a", [])) tn.check_serialization(tn.SequentialNode( "a", [tn.SequentialNode("b", []), tn.SequentialNode("c", [])]))
def test_variable_hyperparameter_node_serialization(): tn.check_serialization(tn.VariableHyperparameterNode("a", tn.IdentityNode("b")))
def test_auxiliary_contraction_penalty_node_serialization(): tn.check_serialization(cp.AuxiliaryContractionPenaltyNode( "a", tn.IdentityNode("b")))
def test_paired_conv_2d_with_bias_node_serialization(): tn.check_serialization(paired_conv.PairedConvNode("a", {}))
def test_spatial_pyramid_pooling_node_serialization(): tn.check_serialization(spp_net.SpatialPyramidPoolingNode("a"))
def test_dropout_max_pool_2d_node_serialization(): tn.check_serialization(dmp.DropoutMaxPool2DNode("a"))
def test_add_axis_node_serialization(): tn.check_serialization(bf.AddAxisNode("a"))
def test_stochastic_pool_2d_node_serialization(): tn.check_serialization(stochastic_pooling.StochasticPool2DNode("a"))
def test_remove_axis_node_serialization(): tn.check_serialization(bf.RemoveAxisNode("b"))
def test_auxilliary_cost_node_serialization(): tn.check_serialization( tn.AuxiliaryCostNode("foo", {"target": tn.IdentityNode("bar")}))
def test_mixed_pool_node_serialization(): tn.check_serialization(mixed_pooling.MixedPoolNode("a"))
def test_total_cost_node_serialization(): tn.check_serialization(tn.TotalCostNode( "foo", {"pred": tn.IdentityNode("foo"), "target": tn.IdentityNode("bar")}))
def test_linear_mapping_node_serialization(): tn.check_serialization(tn.LinearMappingNode("a")) tn.check_serialization(tn.LinearMappingNode("a", output_dim=3))
def test_send_to_node_serialization(): tn.check_serialization(tn.SendToNode("a")) tn.check_serialization(tn.SendToNode("a", reference="bar"))
def test_gaussian_dropout_node_serialization(): tn.check_serialization(tn.GaussianDropoutNode("a")) tn.check_serialization(tn.GaussianDropoutNode("a", p=0))
def test_gated_pool_2d_node_serialization(): tn.check_serialization(mixed_pooling.GatedPool2DNode("a"))
def test_auxiliary_node_serialization(): tn.check_serialization(tn.AuxiliaryNode("a", tn.IdentityNode("b")))
def test_apply_node_serialization(): tn.check_serialization(tn.ApplyNode("a"))
def test_smorms3_node_serialization(): tn.check_serialization(smorms3.SMORMS3Node("a"))
def test_spatial_dropout_node_serialization(): tn.check_serialization(tn.SpatialDropoutNode("a")) tn.check_serialization(tn.SpatialDropoutNode("a", p=0.5))
def test_wta_sparsity_node_serialization(): tn.check_serialization(wta.WTASparsityNode("a"))
def test_output_hyperparameter_node_serialization(): tn.check_serialization(tn.OutputHyperparameterNode("a"))
def test_print_node_serialization(): tn.check_serialization(tn.PrintNode("a"))
def test_tile_node_serialization(): tn.check_serialization(tn.TileNode("a")) tn.check_serialization(tn.TileNode("a", reps=[1, 2, 3]))
def test_partition_axis_node_serialization(): tn.check_serialization(partition_axis.PartitionAxisNode("a"))
def test_auxiliary_dense_softmax_cce_node_serialization(): tn.check_serialization( auxiliary_costs.AuxiliaryDenseSoftmaxCCENode("a", {})) tn.check_serialization( auxiliary_costs.AuxiliaryDenseSoftmaxCCENode("a", {}, num_units=100))
def test_prelu_node_serialization(): tn.check_serialization(prelu.PReLUNode("a"))
def test_dense_node_serialization(): tn.check_serialization(tn.DenseNode("a")) tn.check_serialization(tn.DenseNode("a", num_units=100))
def test_auxiliary_dense_softmax_cce_node_serialization(): tn.check_serialization(tn.AuxiliaryDenseSoftmaxCCENode("a", {})) tn.check_serialization(tn.AuxiliaryDenseSoftmaxCCENode( "a", {}, num_units=100))
def test_equilibrated_sgd_node_serialization(): tn.check_serialization(equilibrated_sgd.EquilibratedSGDNode("a"))
def test_total_cost_node_serialization(): tn.check_serialization( tn.TotalCostNode("foo", { "pred": tn.IdentityNode("foo"), "target": tn.IdentityNode("bar") }))
def test_default_recurrent_conv_2d_node_serialization(): tn.check_serialization(rcl.DefaultRecurrentConv2DNode("a"))
def test_interval_relu_node_serialization(): tn.check_serialization(irelu.IntervalReLUNode("a"))
def test_elementwise_cost_node_serialization(): tn.check_serialization(tn.ElementwiseCostNode( "foo", {"pred": tn.IdentityNode("foo"), "target": tn.IdentityNode("bar")}))
def test_clip_scaling_node_serialization(): tn.check_serialization(input_scaling.ClipScalingNode("a"))
def test_auxilliary_cost_node_serialization(): tn.check_serialization(tn.AuxiliaryCostNode( "foo", {"target": tn.IdentityNode("bar")}))
def test_reference_node_serialization(): tn.check_serialization(tn.ReferenceNode("a")) tn.check_serialization(tn.ReferenceNode("a", reference="bar"))