Home / Function/ clone_inputs() — pytorch Function Reference

clone_inputs() — pytorch Function Reference

Architecture documentation for the clone_inputs() function in utils.py from the pytorch codebase.

Entity Profile

Dependency Diagram

graph TD
  d4938e53_a1f5_c58c_a1e1_efc656eb80f1["clone_inputs()"]
  cf57d9a8_fc49_42e9_c1eb_53ac4b8190b5["check_accuracy()"]
  cf57d9a8_fc49_42e9_c1eb_53ac4b8190b5 -->|calls| d4938e53_a1f5_c58c_a1e1_efc656eb80f1
  bf14c1d3_0a90_a5c6_58ff_3e6211ae65ce["check_accuracy()"]
  bf14c1d3_0a90_a5c6_58ff_3e6211ae65ce -->|calls| d4938e53_a1f5_c58c_a1e1_efc656eb80f1
  3d4e92c5_a13f_fad7_1514_52cd7fc93a06["benchmark_single_shape_for_backend()"]
  3d4e92c5_a13f_fad7_1514_52cd7fc93a06 -->|calls| d4938e53_a1f5_c58c_a1e1_efc656eb80f1
  style d4938e53_a1f5_c58c_a1e1_efc656eb80f1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

benchmarks/dynamo/genai_layers/utils.py lines 86–104

    def clone_inputs(self, args, kwargs) -> Any:
        args_ref = [
            arg.clone().detach().requires_grad_(arg.requires_grad) for arg in args
        ]

        kwargs_ref = (
            {
                k: (
                    v.clone().detach().requires_grad_(v.requires_grad)
                    if isinstance(v, torch.Tensor)
                    else v
                )
                for k, v in kwargs.items()
            }
            if kwargs
            else kwargs
        )

        return args_ref, kwargs_ref

Subdomains

Frequently Asked Questions

What does clone_inputs() do?
clone_inputs() is a function in the pytorch codebase.
What calls clone_inputs()?
clone_inputs() is called by 3 function(s): benchmark_single_shape_for_backend, check_accuracy, check_accuracy.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free