def test_randomize_weights_pass():
        """
        Test the WeightRandomizer graph pass

                     const
                       |
                       v
        input -----> matmul -----> out

        const needs to large enough that should_use_weight_file==True

        """

        @mb.program(input_specs=[mb.TensorSpec(shape=(2, 10))])
        def prog(x):
            weights_val = np.random.rand(2, 10).T.astype(np.float32)
            weights = mb.const(val=weights_val)

            return mb.matmul(x=x, y=weights)

        prev_prog, prev_block, block = apply_pass_and_basic_check(prog, "common::WeightRandomizer")
        # check ops haven't changed
        assert get_op_types_in_program(prog) == ["matmul"]

        # check the weights have changed
        TestRandomizeWeights.assert_weights_changed(prev_prog, prog)

        Test the WeightRandomizer graph pass

                     const
                       |
                       v
        input -----> matmul -----> out

        const needs to large enough that should_use_weight_file==True

        
coremltools/converters/mil/mil/passes/tests/test_passes.py