Skip to content

Commit

Permalink
Merge pull request #671 from lanpa/fix-linting-E275
Browse files Browse the repository at this point in the history
fix lint: requires whitespace around keywords
  • Loading branch information
lanpa committed Aug 28, 2022
2 parents 65cc86e + 5103da0 commit 9124a06
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions tensorboardX/caffe2_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def _fill_missing_operator_names(ops):
name = os.path.join(scope, op.type)
else:
name = op.type
assert(name)
assert name
op.name = _make_unique_name(seen, name)


Expand Down Expand Up @@ -449,7 +449,7 @@ def _operator_to_node_simp(op, inter_blobs, seen):
name_list = [name for name in outputs]
scope = os.path.commonprefix(name_list)
name = os.path.join(scope, op.type)
assert(name)
assert name
op.name = _make_unique_name(seen, name)
device = _tf_device(op.device_option)

Expand Down
4 changes: 2 additions & 2 deletions tensorboardX/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def scalar(name, scalar, display_name="", summary_description=""):
"""
name = _clean_tag(name)
scalar = make_np(scalar)
assert(scalar.squeeze().ndim == 0), 'scalar should be 0D'
assert scalar.squeeze().ndim == 0, 'scalar should be 0D'
scalar = float(scalar)
if display_name == "" and summary_description == "":
return Summary(value=[Summary.Value(tag=name, simple_value=scalar)])
Expand Down Expand Up @@ -411,7 +411,7 @@ def audio(tag, tensor, sample_rate=44100):
if tensor.ndim == 1: # old API, which expects single channel audio
tensor = np.expand_dims(tensor, axis=1)

assert(tensor.ndim == 2), 'Input tensor should be 2 dimensional.'
assert tensor.ndim == 2, 'Input tensor should be 2 dimensional.'
length_frames, num_channels = tensor.shape
assert num_channels == 1 or num_channels == 2, 'The second dimension should be 1 or 2.'

Expand Down
10 changes: 5 additions & 5 deletions tensorboardX/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ def make_grid(I, ncols=8):


def convert_to_NTCHW(tensor, input_format):
assert(len(input_format) == 5), "Only 5D tensor is supported."
assert(len(set(input_format)) == len(input_format)), "You can not use the same dimension shordhand twice. \
assert len(input_format) == 5, "Only 5D tensor is supported."
assert len(set(input_format)) == len(input_format), "You can not use the same dimension shorthand twice. \
input_format: {}".format(input_format)
assert(len(tensor.shape) == len(input_format)), "size of input tensor and input format are different. \
assert len(tensor.shape) == len(input_format), "size of input tensor and input format are different. \
tensor shape: {}, input_format: {}".format(tensor.shape, input_format)
input_format = input_format.upper()
index = [input_format.find(c) for c in 'NTCHW']
Expand All @@ -105,9 +105,9 @@ def convert_to_NTCHW(tensor, input_format):

def convert_to_HWC(tensor, input_format): # tensor: numpy array
import numpy as np
assert(len(set(input_format)) == len(input_format)), "You can not use the same dimension shordhand twice. \
assert len(set(input_format)) == len(input_format), "You can not use the same dimension shorthand twice. \
input_format: {}".format(input_format)
assert(len(tensor.shape) == len(input_format)), "size of input tensor and input format are different. \
assert len(tensor.shape) == len(input_format), "size of input tensor and input format are different. \
tensor shape: {}, input_format: {}".format(tensor.shape, input_format)
input_format = input_format.upper()

Expand Down

0 comments on commit 9124a06

Please sign in to comment.