[iOS] Add nonVarTypeModeGuard to fix the unit test (#39743)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/39743

### Summary

Still need this RAII guard for full JIT

### Test Plan

- CI checks

Test Plan: Imported from OSS

Differential Revision: D21968256

Pulled By: xta0

fbshipit-source-id: 8ea63c699fed4e2a01390232a58f039110391844
This commit is contained in:
Tao Xu
2020-06-09 20:02:57 -07:00
committed by Facebook GitHub Bot
parent 2193fa119e
commit 307920731d

View File

@ -28,6 +28,7 @@
std::vector<c10::IValue> inputs;
inputs.push_back(torch::ones({1, 3, 224, 224}, at::ScalarType::Float));
torch::autograd::AutoGradMode guard(false);
at::AutoNonVariableTypeMode nonVarTypeModeGuard(true);
auto outputTensor = _module.forward(inputs).toTensor();
float* outputBuffer = outputTensor.data_ptr<float>();
XCTAssertTrue(outputBuffer != nullptr, @"");