The following issues were found
caffe2/python/operator_test/crf_test.py
12 issues
Line: 8
Column: 1
from caffe2.python import workspace, crf, brew
from caffe2.python.model_helper import ModelHelper
import numpy as np
from scipy.special import logsumexp
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
from hypothesis import given, settings
Reported by Pylint.
Line: 10
Column: 1
import numpy as np
from scipy.special import logsumexp
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
from hypothesis import given, settings
class TestCRFOp(hu.HypothesisTestCase):
Reported by Pylint.
Line: 11
Column: 1
from scipy.special import logsumexp
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
from hypothesis import given, settings
class TestCRFOp(hu.HypothesisTestCase):
@given(num_tags=st.integers(2, 4),
Reported by Pylint.
Line: 84
Column: 14
crf_layer.build_crf_net(
predictions_blob, initial_blob, transitions_blob
)
op = base_model.net._net.op[-1]
workspace.RunNetOnce(base_model.param_init_net)
gradients_to_check = (
index for (index, input_name) in enumerate(op.input)
if input_name != "crf_net/zero_segment_id"
)
Reported by Pylint.
Line: 1
Column: 1
from caffe2.python import workspace, crf, brew
from caffe2.python.model_helper import ModelHelper
import numpy as np
from scipy.special import logsumexp
import caffe2.python.hypothesis_test_util as hu
Reported by Pylint.
Line: 14
Column: 1
from hypothesis import given, settings
class TestCRFOp(hu.HypothesisTestCase):
@given(num_tags=st.integers(2, 4),
num_words=st.integers(2, 15))
@settings(deadline=10000)
def test_crf_with_loss_op(self, num_tags, num_words):
Reported by Pylint.
Line: 19
Column: 5
@given(num_tags=st.integers(2, 4),
num_words=st.integers(2, 15))
@settings(deadline=10000)
def test_crf_with_loss_op(self, num_tags, num_words):
model = ModelHelper(name='external')
embeddings_dim = 200
embeddings = np.random.randn(num_words, embeddings_dim).astype(np.float32)
transitions = np.random.uniform(
low=-1, high=1, size=(num_tags + 2, num_tags + 2)
Reported by Pylint.
Line: 19
Column: 5
@given(num_tags=st.integers(2, 4),
num_words=st.integers(2, 15))
@settings(deadline=10000)
def test_crf_with_loss_op(self, num_tags, num_words):
model = ModelHelper(name='external')
embeddings_dim = 200
embeddings = np.random.randn(num_words, embeddings_dim).astype(np.float32)
transitions = np.random.uniform(
low=-1, high=1, size=(num_tags + 2, num_tags + 2)
Reported by Pylint.
Line: 63
Column: 5
@given(num_tags=st.integers(1, 4),
num_words=st.integers(2, 4))
@settings(deadline=10000)
def test_crf_gradient(self, num_tags, num_words):
base_model = ModelHelper(name='base_model')
transitions = np.random.randn(
num_tags + 2, num_tags + 2
).astype(np.float32)
predictions = np.random.randn(num_words, 1, num_tags + 2).astype(np.float32)
Reported by Pylint.
Line: 84
Column: 9
crf_layer.build_crf_net(
predictions_blob, initial_blob, transitions_blob
)
op = base_model.net._net.op[-1]
workspace.RunNetOnce(base_model.param_init_net)
gradients_to_check = (
index for (index, input_name) in enumerate(op.input)
if input_name != "crf_net/zero_segment_id"
)
Reported by Pylint.
caffe2/python/operator_test/clip_tensor_op_test.py
12 issues
Line: 9
Column: 1
from caffe2.python import core
import caffe2.python.hypothesis_test_util as hu
import caffe2.python.serialized_test.serialized_test_util as serial
import hypothesis.strategies as st
from hypothesis import given, settings
import numpy as np
class TestClipTensorByScalingOp(serial.SerializedTestCase):
Reported by Pylint.
Line: 10
Column: 1
import caffe2.python.hypothesis_test_util as hu
import caffe2.python.serialized_test.serialized_test_util as serial
import hypothesis.strategies as st
from hypothesis import given, settings
import numpy as np
class TestClipTensorByScalingOp(serial.SerializedTestCase):
Reported by Pylint.
Line: 24
Column: 76
**hu.gcs_cpu_only)
@settings(deadline=10000)
def test_clip_tensor_by_scaling(self, n, d, threshold, additional_threshold,
use_additional_threshold, inplace, gc, dc):
tensor = np.random.rand(n, d).astype(np.float32)
val = np.array(np.linalg.norm(tensor))
additional_threshold = np.array([additional_threshold]).astype(np.float32)
Reported by Pylint.
Line: 1
Column: 1
from caffe2.python import core
import caffe2.python.hypothesis_test_util as hu
import caffe2.python.serialized_test.serialized_test_util as serial
import hypothesis.strategies as st
Reported by Pylint.
Line: 14
Column: 1
import numpy as np
class TestClipTensorByScalingOp(serial.SerializedTestCase):
@given(n=st.integers(5, 8), d=st.integers(2, 4),
threshold=st.floats(0.1, 10),
additional_threshold=st.floats(0.1, 10),
use_additional_threshold=st.booleans(),
Reported by Pylint.
Line: 23
Column: 5
inplace=st.booleans(),
**hu.gcs_cpu_only)
@settings(deadline=10000)
def test_clip_tensor_by_scaling(self, n, d, threshold, additional_threshold,
use_additional_threshold, inplace, gc, dc):
tensor = np.random.rand(n, d).astype(np.float32)
val = np.array(np.linalg.norm(tensor))
additional_threshold = np.array([additional_threshold]).astype(np.float32)
Reported by Pylint.
Line: 23
Column: 5
inplace=st.booleans(),
**hu.gcs_cpu_only)
@settings(deadline=10000)
def test_clip_tensor_by_scaling(self, n, d, threshold, additional_threshold,
use_additional_threshold, inplace, gc, dc):
tensor = np.random.rand(n, d).astype(np.float32)
val = np.array(np.linalg.norm(tensor))
additional_threshold = np.array([additional_threshold]).astype(np.float32)
Reported by Pylint.
Line: 23
Column: 5
inplace=st.booleans(),
**hu.gcs_cpu_only)
@settings(deadline=10000)
def test_clip_tensor_by_scaling(self, n, d, threshold, additional_threshold,
use_additional_threshold, inplace, gc, dc):
tensor = np.random.rand(n, d).astype(np.float32)
val = np.array(np.linalg.norm(tensor))
additional_threshold = np.array([additional_threshold]).astype(np.float32)
Reported by Pylint.
Line: 23
Column: 5
inplace=st.booleans(),
**hu.gcs_cpu_only)
@settings(deadline=10000)
def test_clip_tensor_by_scaling(self, n, d, threshold, additional_threshold,
use_additional_threshold, inplace, gc, dc):
tensor = np.random.rand(n, d).astype(np.float32)
val = np.array(np.linalg.norm(tensor))
additional_threshold = np.array([additional_threshold]).astype(np.float32)
Reported by Pylint.
Line: 23
Column: 5
inplace=st.booleans(),
**hu.gcs_cpu_only)
@settings(deadline=10000)
def test_clip_tensor_by_scaling(self, n, d, threshold, additional_threshold,
use_additional_threshold, inplace, gc, dc):
tensor = np.random.rand(n, d).astype(np.float32)
val = np.array(np.linalg.norm(tensor))
additional_threshold = np.array([additional_threshold]).astype(np.float32)
Reported by Pylint.
caffe2/python/operator_test/ceil_op_test.py
12 issues
Line: 8
Column: 1
from caffe2.python import core
import caffe2.python.hypothesis_test_util as hu
from hypothesis import given, settings
import caffe2.python.serialized_test.serialized_test_util as serial
import hypothesis.strategies as st
import numpy as np
import unittest
Reported by Pylint.
Line: 10
Column: 1
import caffe2.python.hypothesis_test_util as hu
from hypothesis import given, settings
import caffe2.python.serialized_test.serialized_test_util as serial
import hypothesis.strategies as st
import numpy as np
import unittest
Reported by Pylint.
Line: 1
Column: 1
from caffe2.python import core
import caffe2.python.hypothesis_test_util as hu
from hypothesis import given, settings
import caffe2.python.serialized_test.serialized_test_util as serial
Reported by Pylint.
Line: 9
Column: 1
from caffe2.python import core
import caffe2.python.hypothesis_test_util as hu
from hypothesis import given, settings
import caffe2.python.serialized_test.serialized_test_util as serial
import hypothesis.strategies as st
import numpy as np
import unittest
Reported by Pylint.
Line: 13
Column: 1
import hypothesis.strategies as st
import numpy as np
import unittest
class TestCeil(serial.SerializedTestCase):
@given(X=hu.tensor(),
Reported by Pylint.
Line: 16
Column: 1
import unittest
class TestCeil(serial.SerializedTestCase):
@given(X=hu.tensor(),
engine=st.sampled_from(["", "CUDNN"]),
**hu.gcs)
@settings(deadline=10000)
Reported by Pylint.
Line: 22
Column: 5
engine=st.sampled_from(["", "CUDNN"]),
**hu.gcs)
@settings(deadline=10000)
def test_ceil(self, X, gc, dc, engine):
op = core.CreateOperator("Ceil", ["X"], ["Y"], engine=engine)
def ceil_ref(X):
return (np.ceil(X),)
Reported by Pylint.
Line: 22
Column: 5
engine=st.sampled_from(["", "CUDNN"]),
**hu.gcs)
@settings(deadline=10000)
def test_ceil(self, X, gc, dc, engine):
op = core.CreateOperator("Ceil", ["X"], ["Y"], engine=engine)
def ceil_ref(X):
return (np.ceil(X),)
Reported by Pylint.
Line: 22
Column: 5
engine=st.sampled_from(["", "CUDNN"]),
**hu.gcs)
@settings(deadline=10000)
def test_ceil(self, X, gc, dc, engine):
op = core.CreateOperator("Ceil", ["X"], ["Y"], engine=engine)
def ceil_ref(X):
return (np.ceil(X),)
Reported by Pylint.
Line: 22
Column: 5
engine=st.sampled_from(["", "CUDNN"]),
**hu.gcs)
@settings(deadline=10000)
def test_ceil(self, X, gc, dc, engine):
op = core.CreateOperator("Ceil", ["X"], ["Y"], engine=engine)
def ceil_ref(X):
return (np.ceil(X),)
Reported by Pylint.
caffe2/python/operator_test/boolean_unmask_test.py
12 issues
Line: 9
Column: 1
from caffe2.python import core
import caffe2.python.hypothesis_test_util as hu
import caffe2.python.serialized_test.serialized_test_util as serial
import hypothesis.strategies as st
import numpy as np
class TestUnmaskOp(serial.SerializedTestCase):
@serial.given(N=st.integers(min_value=2, max_value=20),
Reported by Pylint.
Line: 38
Column: 1
indices = np.random.permutation(N)
pieces = np.split(indices, split)
def ref(*args, **kwargs):
return (all_value,)
inputs = []
inputs_names = []
for i, piece in enumerate(pieces):
Reported by Pylint.
Line: 38
Column: 1
indices = np.random.permutation(N)
pieces = np.split(indices, split)
def ref(*args, **kwargs):
return (all_value,)
inputs = []
inputs_names = []
for i, piece in enumerate(pieces):
Reported by Pylint.
Line: 1
Column: 1
from caffe2.python import core
import caffe2.python.hypothesis_test_util as hu
import caffe2.python.serialized_test.serialized_test_util as serial
import hypothesis.strategies as st
Reported by Pylint.
Line: 13
Column: 1
import numpy as np
class TestUnmaskOp(serial.SerializedTestCase):
@serial.given(N=st.integers(min_value=2, max_value=20),
dtype=st.sampled_from([
np.bool_,
np.int8,
np.int16,
Reported by Pylint.
Line: 27
Column: 5
np.float32,
np.float64]),
**hu.gcs)
def test(self, N, dtype, gc, dc):
if dtype is np.bool_:
all_value = np.random.choice(a=[True, False], size=N)
else:
all_value = (np.random.rand(N) * N).astype(dtype)
Reported by Pylint.
Line: 27
Column: 5
np.float32,
np.float64]),
**hu.gcs)
def test(self, N, dtype, gc, dc):
if dtype is np.bool_:
all_value = np.random.choice(a=[True, False], size=N)
else:
all_value = (np.random.rand(N) * N).astype(dtype)
Reported by Pylint.
Line: 27
Column: 5
np.float32,
np.float64]),
**hu.gcs)
def test(self, N, dtype, gc, dc):
if dtype is np.bool_:
all_value = np.random.choice(a=[True, False], size=N)
else:
all_value = (np.random.rand(N) * N).astype(dtype)
Reported by Pylint.
Line: 27
Column: 5
np.float32,
np.float64]),
**hu.gcs)
def test(self, N, dtype, gc, dc):
if dtype is np.bool_:
all_value = np.random.choice(a=[True, False], size=N)
else:
all_value = (np.random.rand(N) * N).astype(dtype)
Reported by Pylint.
Line: 27
Column: 5
np.float32,
np.float64]),
**hu.gcs)
def test(self, N, dtype, gc, dc):
if dtype is np.bool_:
all_value = np.random.choice(a=[True, False], size=N)
else:
all_value = (np.random.rand(N) * N).astype(dtype)
Reported by Pylint.
test/jit/test_functional_blocks.py
12 issues
Line: 4
Column: 1
import os
import sys
import torch
from torch.testing import FileCheck
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(pytorch_test_dir)
Reported by Pylint.
Line: 5
Column: 1
import sys
import torch
from torch.testing import FileCheck
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(pytorch_test_dir)
from torch.testing._internal.jit_utils import JitTestCase
Reported by Pylint.
Line: 10
Column: 1
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(pytorch_test_dir)
from torch.testing._internal.jit_utils import JitTestCase
if __name__ == '__main__':
raise RuntimeError("This test file is not meant to be run directly, use:\n\n"
"\tpython test/test_jit.py TESTNAME\n\n"
"instead.")
Reported by Pylint.
Line: 1
Column: 1
import os
import sys
import torch
from torch.testing import FileCheck
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(pytorch_test_dir)
Reported by Pylint.
Line: 10
Column: 1
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(pytorch_test_dir)
from torch.testing._internal.jit_utils import JitTestCase
if __name__ == '__main__':
raise RuntimeError("This test file is not meant to be run directly, use:\n\n"
"\tpython test/test_jit.py TESTNAME\n\n"
"instead.")
Reported by Pylint.
Line: 17
Column: 1
"\tpython test/test_jit.py TESTNAME\n\n"
"instead.")
class TestFunctionalBlocks(JitTestCase):
def test_subgraph_creation(self):
def fn(x, y, z):
x = x + 1
y = y + 1
z = z + 1
Reported by Pylint.
Line: 17
Column: 1
"\tpython test/test_jit.py TESTNAME\n\n"
"instead.")
class TestFunctionalBlocks(JitTestCase):
def test_subgraph_creation(self):
def fn(x, y, z):
x = x + 1
y = y + 1
z = z + 1
Reported by Pylint.
Line: 18
Column: 5
"instead.")
class TestFunctionalBlocks(JitTestCase):
def test_subgraph_creation(self):
def fn(x, y, z):
x = x + 1
y = y + 1
z = z + 1
z.add_(2)
Reported by Pylint.
Line: 19
Column: 9
class TestFunctionalBlocks(JitTestCase):
def test_subgraph_creation(self):
def fn(x, y, z):
x = x + 1
y = y + 1
z = z + 1
z.add_(2)
z = z * z
Reported by Pylint.
Line: 19
Column: 9
class TestFunctionalBlocks(JitTestCase):
def test_subgraph_creation(self):
def fn(x, y, z):
x = x + 1
y = y + 1
z = z + 1
z.add_(2)
z = z * z
Reported by Pylint.
caffe2/python/benchmark_generator.py
12 issues
Line: 19
Column: 22
def parse_kwarg(kwarg_str):
key, value = map(string.strip, kwarg_str.split("=", 1))
try:
value = int(value)
except ValueError:
try:
value = float(value)
Reported by Pylint.
Line: 30
Column: 10
return key, value
def main(args):
# User defined keyword arguments
kwargs = {"order": "NCHW"}
kwargs.update(dict(args.kwargs))
model = ModelHelper(name=args.benchmark_name)
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python3
import string
import argparse
Reported by Pylint.
Line: 18
Column: 1
from caffe2.python import core, workspace, brew, utils
def parse_kwarg(kwarg_str):
key, value = map(string.strip, kwarg_str.split("=", 1))
try:
value = int(value)
except ValueError:
try:
Reported by Pylint.
Line: 30
Column: 1
return key, value
def main(args):
# User defined keyword arguments
kwargs = {"order": "NCHW"}
kwargs.update(dict(args.kwargs))
model = ModelHelper(name=args.benchmark_name)
Reported by Pylint.
Line: 30
Column: 1
return key, value
def main(args):
# User defined keyword arguments
kwargs = {"order": "NCHW"}
kwargs.update(dict(args.kwargs))
model = ModelHelper(name=args.benchmark_name)
Reported by Pylint.
Line: 88
Column: 1
# Handle manual rewrite
if args.context.upper() == "OPENGL":
old_ops = [op for op in predict_net.op]
del predict_net.op[:]
for op in old_ops:
op.type = 'OpenGL{}'.format(op.type)
predict_net.op.extend(old_ops)
Reported by Pylint.
Line: 90
Column: 13
if args.context.upper() == "OPENGL":
old_ops = [op for op in predict_net.op]
del predict_net.op[:]
for op in old_ops:
op.type = 'OpenGL{}'.format(op.type)
predict_net.op.extend(old_ops)
if args.debug:
print("init_net:")
Reported by Pylint.
Line: 96
Column: 13
if args.debug:
print("init_net:")
for op in init_net.op:
print(" ", op.type, op.input, "-->", op.output)
print("predict_net:")
for op in predict_net.op:
print(" ", op.type, op.input, "-->", op.output)
Reported by Pylint.
Line: 99
Column: 13
for op in init_net.op:
print(" ", op.type, op.input, "-->", op.output)
print("predict_net:")
for op in predict_net.op:
print(" ", op.type, op.input, "-->", op.output)
with open(args.predict_net, 'wb') as f:
f.write(predict_net.SerializeToString())
with open(args.init_net, 'wb') as f:
Reported by Pylint.
caffe2/python/models/shufflenet_test.py
12 issues
Line: 9
Column: 1
import numpy as np
import caffe2.python.models.shufflenet as shufflenet
import hypothesis.strategies as st
from hypothesis import given, settings
import caffe2.python.hypothesis_test_util as hu
import caffe2.python.models.imagenet_trainer_test_utils as utils
Reported by Pylint.
Line: 10
Column: 1
import caffe2.python.models.shufflenet as shufflenet
import hypothesis.strategies as st
from hypothesis import given, settings
import caffe2.python.hypothesis_test_util as hu
import caffe2.python.models.imagenet_trainer_test_utils as utils
class ShufflenetMemongerTest(hu.HypothesisTestCase):
Reported by Pylint.
Line: 56
Column: 5
import random
random.seed(2006)
# pyre-fixme[10]: Name `workspace` is used but not defined in the current scope
workspace.GlobalInit([
'caffe2',
'--caffe2_log_level=0',
'--caffe2_print_blob_sizes_at_exit=0',
'--caffe2_gpu_memory_tracking=1'])
unittest.main()
Reported by Pylint.
Line: 18
Column: 57
class ShufflenetMemongerTest(hu.HypothesisTestCase):
@given(with_shapes=st.booleans(), **hu.gcs_cpu_only)
@settings(max_examples=2, deadline=None)
def test_shufflenet_shared_grads(self, with_shapes, gc, dc):
results = utils.test_shared_grads(
with_shapes,
shufflenet.create_shufflenet,
'gpu_0/stage1_conv_w',
'gpu_0/last_out_L1000'
Reported by Pylint.
Line: 18
Column: 61
class ShufflenetMemongerTest(hu.HypothesisTestCase):
@given(with_shapes=st.booleans(), **hu.gcs_cpu_only)
@settings(max_examples=2, deadline=None)
def test_shufflenet_shared_grads(self, with_shapes, gc, dc):
results = utils.test_shared_grads(
with_shapes,
shufflenet.create_shufflenet,
'gpu_0/stage1_conv_w',
'gpu_0/last_out_L1000'
Reported by Pylint.
Line: 1
Column: 1
import numpy as np
import caffe2.python.models.shufflenet as shufflenet
import hypothesis.strategies as st
Reported by Pylint.
Line: 11
Column: 1
import caffe2.python.models.shufflenet as shufflenet
import hypothesis.strategies as st
from hypothesis import given, settings
import caffe2.python.hypothesis_test_util as hu
import caffe2.python.models.imagenet_trainer_test_utils as utils
class ShufflenetMemongerTest(hu.HypothesisTestCase):
@given(with_shapes=st.booleans(), **hu.gcs_cpu_only)
Reported by Pylint.
Line: 15
Column: 1
import caffe2.python.models.imagenet_trainer_test_utils as utils
class ShufflenetMemongerTest(hu.HypothesisTestCase):
@given(with_shapes=st.booleans(), **hu.gcs_cpu_only)
@settings(max_examples=2, deadline=None)
def test_shufflenet_shared_grads(self, with_shapes, gc, dc):
results = utils.test_shared_grads(
with_shapes,
Reported by Pylint.
Line: 18
Column: 5
class ShufflenetMemongerTest(hu.HypothesisTestCase):
@given(with_shapes=st.booleans(), **hu.gcs_cpu_only)
@settings(max_examples=2, deadline=None)
def test_shufflenet_shared_grads(self, with_shapes, gc, dc):
results = utils.test_shared_grads(
with_shapes,
shufflenet.create_shufflenet,
'gpu_0/stage1_conv_w',
'gpu_0/last_out_L1000'
Reported by Pylint.
Line: 18
Column: 5
class ShufflenetMemongerTest(hu.HypothesisTestCase):
@given(with_shapes=st.booleans(), **hu.gcs_cpu_only)
@settings(max_examples=2, deadline=None)
def test_shufflenet_shared_grads(self, with_shapes, gc, dc):
results = utils.test_shared_grads(
with_shapes,
shufflenet.create_shufflenet,
'gpu_0/stage1_conv_w',
'gpu_0/last_out_L1000'
Reported by Pylint.
caffe2/python/experiment_util.py
12 issues
Line: 17
Column: 1
from collections import OrderedDict
from future.utils import viewkeys, viewvalues
'''
Utilities for logging experiment run stats, such as accuracy
and loss over time for different runs. Runtime arguments are stored
in the log.
Optionally, ModelTrainerLog calls out to a logger to log to
Reported by Pylint.
Line: 76
Column: 22
else:
self.external_loggers = []
def logstr(self, str):
with open(self.filename, "a") as f:
f.write(str + "\n")
f.close()
logging.getLogger("experiment_logger").info(str)
Reported by Pylint.
Line: 112
Column: 20
for logger in self.external_loggers:
try:
logger.log(logdict)
except Exception as e:
logging.warning(
"Failed to call ExternalLogger: {}".format(e), e)
Reported by Pylint.
Line: 114
Column: 21
logger.log(logdict)
except Exception as e:
logging.warning(
"Failed to call ExternalLogger: {}".format(e), e)
Reported by Pylint.
Line: 1
Column: 1
## @package experiment_util
# Module caffe2.python.experiment_util
import datetime
import time
Reported by Pylint.
Line: 27
Column: 1
'''
class ExternalLogger(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def set_runtime_args(self, runtime_args):
"""
Reported by Pylint.
Line: 27
Column: 1
'''
class ExternalLogger(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def set_runtime_args(self, runtime_args):
"""
Reported by Pylint.
Line: 51
Column: 1
)
class ModelTrainerLog():
def __init__(self, expname, runtime_args, external_loggers=None):
now = datetime.datetime.fromtimestamp(time.time())
self.experiment_id = \
"{}_{}".format(expname, now.strftime('%Y%m%d_%H%M%S'))
Reported by Pylint.
Line: 76
Column: 5
else:
self.external_loggers = []
def logstr(self, str):
with open(self.filename, "a") as f:
f.write(str + "\n")
f.close()
logging.getLogger("experiment_logger").info(str)
Reported by Pylint.
Line: 77
Column: 42
self.external_loggers = []
def logstr(self, str):
with open(self.filename, "a") as f:
f.write(str + "\n")
f.close()
logging.getLogger("experiment_logger").info(str)
def log(self, input_count, batch_count, additional_values):
Reported by Pylint.
caffe2/contrib/playground/resnetdemo/IN1k_resnet_no_test_model.py
12 issues
Line: 40
Column: 34
self.log.info("Model creation completed")
def fun_per_epoch_b4RunNet(self, epoch):
pass
def fun_per_iter_b4RunNet(self, epoch, epoch_iter):
learning_rate = 0.05
Reported by Pylint.
Line: 40
Column: 28
self.log.info("Model creation completed")
def fun_per_epoch_b4RunNet(self, epoch):
pass
def fun_per_iter_b4RunNet(self, epoch, epoch_iter):
learning_rate = 0.05
Reported by Pylint.
Line: 44
Column: 40
pass
def fun_per_iter_b4RunNet(self, epoch, epoch_iter):
learning_rate = 0.05
for idx in range(self.opts['distributed']['first_xpu_id'],
self.opts['distributed']['first_xpu_id'] +
self.opts['distributed']['num_xpus']):
caffe2_pb2_device = caffe2_pb2.CUDA if \
Reported by Pylint.
Line: 44
Column: 33
pass
def fun_per_iter_b4RunNet(self, epoch, epoch_iter):
learning_rate = 0.05
for idx in range(self.opts['distributed']['first_xpu_id'],
self.opts['distributed']['first_xpu_id'] +
self.opts['distributed']['num_xpus']):
caffe2_pb2_device = caffe2_pb2.CUDA if \
Reported by Pylint.
Line: 1
Column: 1
import numpy as np
from caffe2.python import workspace, cnn, core
from caffe2.python import timeout_guard
Reported by Pylint.
Line: 1
Column: 1
import numpy as np
from caffe2.python import workspace, cnn, core
from caffe2.python import timeout_guard
Reported by Pylint.
Line: 13
Column: 1
from caffe2.proto import caffe2_pb2
def init_model(self):
# if cudnn needs to be turned off, several other places
# need to be modified:
# 1. operators need to be constructed with engine option, like below:
# conv_blob = model.Conv(...engine=engine)
# 2. when launch model, opts['model_param']['engine'] = "" instead of "CUDNN"
Reported by Pylint.
Line: 40
Column: 1
self.log.info("Model creation completed")
def fun_per_epoch_b4RunNet(self, epoch):
pass
def fun_per_iter_b4RunNet(self, epoch, epoch_iter):
learning_rate = 0.05
Reported by Pylint.
Line: 40
Column: 1
self.log.info("Model creation completed")
def fun_per_epoch_b4RunNet(self, epoch):
pass
def fun_per_iter_b4RunNet(self, epoch, epoch_iter):
learning_rate = 0.05
Reported by Pylint.
Line: 44
Column: 1
pass
def fun_per_iter_b4RunNet(self, epoch, epoch_iter):
learning_rate = 0.05
for idx in range(self.opts['distributed']['first_xpu_id'],
self.opts['distributed']['first_xpu_id'] +
self.opts['distributed']['num_xpus']):
caffe2_pb2_device = caffe2_pb2.CUDA if \
Reported by Pylint.
caffe2/python/models/resnet_test.py
12 issues
Line: 9
Column: 1
import numpy as np
import caffe2.python.models.resnet as resnet
import hypothesis.strategies as st
from hypothesis import given, settings
import caffe2.python.hypothesis_test_util as hu
import caffe2.python.models.imagenet_trainer_test_utils as utils
class ResnetMemongerTest(hu.HypothesisTestCase):
Reported by Pylint.
Line: 10
Column: 1
import caffe2.python.models.resnet as resnet
import hypothesis.strategies as st
from hypothesis import given, settings
import caffe2.python.hypothesis_test_util as hu
import caffe2.python.models.imagenet_trainer_test_utils as utils
class ResnetMemongerTest(hu.HypothesisTestCase):
Reported by Pylint.
Line: 57
Column: 5
import random
random.seed(2603)
# pyre-fixme[10]: Name `workspace` is used but not defined in the current scope
workspace.GlobalInit([
'caffe2',
'--caffe2_log_level=0',
'--caffe2_print_blob_sizes_at_exit=0',
'--caffe2_gpu_memory_tracking=1'])
unittest.main()
Reported by Pylint.
Line: 18
Column: 53
@given(with_shapes=st.booleans(), **hu.gcs_cpu_only)
@settings(max_examples=2, deadline=None)
def test_resnet_shared_grads(self, with_shapes, gc, dc):
results = utils.test_shared_grads(
with_shapes,
resnet.create_resnet50,
'gpu_0/conv1_w',
'gpu_0/last_out_L1000'
Reported by Pylint.
Line: 18
Column: 57
@given(with_shapes=st.booleans(), **hu.gcs_cpu_only)
@settings(max_examples=2, deadline=None)
def test_resnet_shared_grads(self, with_shapes, gc, dc):
results = utils.test_shared_grads(
with_shapes,
resnet.create_resnet50,
'gpu_0/conv1_w',
'gpu_0/last_out_L1000'
Reported by Pylint.
Line: 1
Column: 1
import numpy as np
import caffe2.python.models.resnet as resnet
import hypothesis.strategies as st
Reported by Pylint.
Line: 11
Column: 1
import caffe2.python.models.resnet as resnet
import hypothesis.strategies as st
from hypothesis import given, settings
import caffe2.python.hypothesis_test_util as hu
import caffe2.python.models.imagenet_trainer_test_utils as utils
class ResnetMemongerTest(hu.HypothesisTestCase):
@given(with_shapes=st.booleans(), **hu.gcs_cpu_only)
Reported by Pylint.
Line: 14
Column: 1
import caffe2.python.hypothesis_test_util as hu
import caffe2.python.models.imagenet_trainer_test_utils as utils
class ResnetMemongerTest(hu.HypothesisTestCase):
@given(with_shapes=st.booleans(), **hu.gcs_cpu_only)
@settings(max_examples=2, deadline=None)
def test_resnet_shared_grads(self, with_shapes, gc, dc):
results = utils.test_shared_grads(
Reported by Pylint.
Line: 18
Column: 5
@given(with_shapes=st.booleans(), **hu.gcs_cpu_only)
@settings(max_examples=2, deadline=None)
def test_resnet_shared_grads(self, with_shapes, gc, dc):
results = utils.test_shared_grads(
with_shapes,
resnet.create_resnet50,
'gpu_0/conv1_w',
'gpu_0/last_out_L1000'
Reported by Pylint.
Line: 18
Column: 5
@given(with_shapes=st.booleans(), **hu.gcs_cpu_only)
@settings(max_examples=2, deadline=None)
def test_resnet_shared_grads(self, with_shapes, gc, dc):
results = utils.test_shared_grads(
with_shapes,
resnet.create_resnet50,
'gpu_0/conv1_w',
'gpu_0/last_out_L1000'
Reported by Pylint.