Exemple #1
0
    def new_method(self, *args, **kwargs):
        [net_name, is_sync_mode], _ = parse_user_args(method, *args, **kwargs)

        type_check(net_name, (str, ), "net_name")
        type_check(is_sync_mode, (bool, ), "is_sync_mode")

        return method(self, *args, **kwargs)
Exemple #2
0
    def new_method(self, *args, **kwargs):
        [id_value, watch_condition, check_node_list,
         parameter_list], _ = parse_user_args(method, *args, **kwargs)

        check_uint32(id_value, "id")
        check_uint32(watch_condition, "watch_condition")
        type_check(check_node_list, (dict, ), "check_node_list")
        for node_name, node_info in check_node_list.items():
            type_check(node_name, (str, ), "node_name")
            type_check(node_info, (dict, ), "node_info")
            for info_name, info_param in node_info.items():
                type_check(info_name, (str, ), "node parameter name")
                if info_name in ["device_id"]:
                    for param in info_param:
                        check_uint32(param, "device_id")
                elif info_name in ["root_graph_id"]:
                    for param in info_param:
                        check_uint32(param, "root_graph_id")
                elif info_name in ["is_parameter"]:
                    type_check(info_param, (bool, ), "is_parameter")
                else:
                    raise ValueError(
                        "Node parameter {} is not defined.".format(info_name))
        param_names = [
            "param_{0}".format(i) for i in range(len(parameter_list))
        ]
        type_check_list(parameter_list, (cds.Parameter, ), param_names)

        return method(self, *args, **kwargs)
Exemple #3
0
    def new_method(self, *args, **kwargs):
        [info_list], _ = parse_user_args(method, *args, **kwargs)

        info_names = ["info_{0}".format(i) for i in range(len(info_list))]
        type_check_list(info_list, (cds.TensorInfo, ), info_names)

        return method(self, *args, **kwargs)
Exemple #4
0
    def new_method(self, *args, **kwargs):
        [dump_file_path, verbose], _ = parse_user_args(method, *args, **kwargs)

        type_check(dump_file_path, (str, ), "dump_file_path")
        type_check(verbose, (bool, ), "verbose")
        check_dir(dump_file_path)

        return method(self, *args, **kwargs)
Exemple #5
0
    def new_method(self, *args, **kwargs):
        [name, disabled, value, hit,
         actual_value], _ = parse_user_args(method, *args, **kwargs)

        type_check(name, (str, ), "name")
        type_check(disabled, (bool, ), "disabled")
        type_check(value, (float, ), "value")
        type_check(hit, (bool, ), "hit")
        type_check(actual_value, (float, ), "actual_value")

        return method(self, *args, **kwargs)
Exemple #6
0
    def new_method(self, *args, **kwargs):
        [node_name, slot, iteration, device_id, root_graph_id,
         is_parameter], _ = parse_user_args(method, *args, **kwargs)

        type_check(node_name, (str, ), "node_name")
        check_uint32(slot, "slot")
        check_uint32(iteration, "iteration")
        check_uint32(device_id, "device_id")
        check_uint32(root_graph_id, "root_graph_id")
        type_check(is_parameter, (bool, ), "is_parameter")

        return method(self, *args, **kwargs)
Exemple #7
0
    def new_method(self, *args, **kwargs):
        [data_ptr, data_size, dtype,
         shape], _ = parse_user_args(method, *args, **kwargs)

        type_check(data_ptr, (bytes, ), "data_ptr")
        check_uint64(data_size, "data_size")
        type_check(dtype, (int, ), "dtype")
        shape_names = ["shape_{0}".format(i) for i in range(len(shape))]
        type_check_list(shape, (int, ), shape_names)

        if len(data_ptr) != data_size:
            raise ValueError(
                "data_ptr length ({0}) is not equal to data_size ({1}).".
                format(len(data_ptr), data_size))

        return method(self, *args, **kwargs)
Exemple #8
0
    def new_method(self, *args, **kwargs):
        [
            name, slot, condition, watchpoint_id, parameters, error_code,
            device_id, root_graph_id
        ], _ = parse_user_args(method, *args, **kwargs)

        type_check(name, (str, ), "name")
        check_uint32(slot, "slot")
        type_check(condition, (int, ), "condition")
        check_uint32(watchpoint_id, "watchpoint_id")
        param_names = ["param_{0}".format(i) for i in range(len(parameters))]
        type_check_list(parameters, (cds.Parameter, ), param_names)
        type_check(error_code, (int, ), "error_code")
        check_uint32(device_id, "device_id")
        check_uint32(root_graph_id, "root_graph_id")

        return method(self, *args, **kwargs)
Exemple #9
0
    def new_method(self, *args, **kwargs):
        [id_value], _ = parse_user_args(method, *args, **kwargs)

        check_uint32(id_value, "id")

        return method(self, *args, **kwargs)
Exemple #10
0
    def new_method(self, *args, **kwargs):
        [iteration], _ = parse_user_args(method, *args, **kwargs)

        check_uint32(iteration, "iteration")

        return method(self, *args, **kwargs)