diff --git a/aten/src/ATen/core/function_schema_inl.h b/aten/src/ATen/core/function_schema_inl.h index 2185b35bc593..43bf3a37a0fd 100644 --- a/aten/src/ATen/core/function_schema_inl.h +++ b/aten/src/ATen/core/function_schema_inl.h @@ -151,6 +151,10 @@ inline void FunctionSchema::checkArg( const IValue& value, const Argument& argument, optional pos) const { + if (value.isTensor() && argument.type() == TensorType::get()) { + // Fast-path for the common case + return; + } if (!value.type()->isSubtypeOf(argument.type())) { TORCH_CHECK( false,