mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 00:21:07 +01:00
Summary: Closes https://github.com/caffe2/caffe2/pull/1260 Differential Revision: D5906739 Pulled By: Yangqing fbshipit-source-id: e482ba9ba60b5337d9165f28f7ec68d4518a0902
38 lines
1.4 KiB
Python
38 lines
1.4 KiB
Python
# Copyright (c) 2016-present, Facebook, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
##############################################################################
|
|
|
|
import unittest
|
|
from caffe2.python import convnet_benchmarks as cb
|
|
from caffe2.python import test_util, workspace
|
|
|
|
|
|
@unittest.skipIf(not workspace.has_gpu_support, "no gpu")
|
|
class TestConvnetBenchmarks(test_util.TestCase):
|
|
def testConvnetBenchmarks(self):
|
|
all_args = [
|
|
'--batch_size 16 --order NCHW --iterations 1 '
|
|
'--warmup_iterations 1',
|
|
'--batch_size 16 --order NCHW --iterations 1 '
|
|
'--warmup_iterations 1 --forward_only',
|
|
]
|
|
for model in [cb.AlexNet, cb.OverFeat, cb.VGGA, cb.Inception]:
|
|
for arg_str in all_args:
|
|
args = cb.GetArgumentParser().parse_args(arg_str.split(' '))
|
|
cb.Benchmark(model, args)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|