Skip to main content

core.is_transformed

core.is_transformed(t, /)

Whether t is wrapped by a torch.func transform (a vmap, grad or jvp level).

A wrapped tensor’s values can’t be read, so a check on its data (bool(t.any())) must be skipped. This reads the private torch._C._functorch.is_functorch_wrapped_tensor (guarded by test_is_transformed_reads_functorch_wrappers).

Parameters

Name Type Description Default
t Tensor The tensor. One created outside the transform and only closed over is not wrapped. required

Returns

Name Type Description
bool True when t is wrapped.