Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
acf30e98
Unverified
Commit
acf30e98
authored
Aug 23, 2022
by
Philip Meier
Committed by
GitHub
Aug 23, 2022
Browse files
add some feature attributes to repr (#6468)
parent
857c0303
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
0 deletions
+12
-0
torchvision/prototype/features/_bounding_box.py
torchvision/prototype/features/_bounding_box.py
+3
-0
torchvision/prototype/features/_feature.py
torchvision/prototype/features/_feature.py
+6
-0
torchvision/prototype/features/_image.py
torchvision/prototype/features/_image.py
+3
-0
No files found.
torchvision/prototype/features/_bounding_box.py
View file @
acf30e98
...
...
@@ -41,6 +41,9 @@ class BoundingBox(_Feature):
return
bounding_box
def
__repr__
(
self
,
*
,
tensor_contents
:
Any
=
None
)
->
str
:
# type: ignore[override]
return
self
.
_make_repr
(
format
=
self
.
format
,
image_size
=
self
.
image_size
)
@
classmethod
def
new_like
(
cls
,
...
...
torchvision/prototype/features/_feature.py
View file @
acf30e98
...
...
@@ -86,6 +86,12 @@ class _Feature(torch.Tensor):
else
:
return
output
def
_make_repr
(
self
,
**
kwargs
:
Any
)
->
str
:
# This is a poor man's implementation of the proposal in https://github.com/pytorch/pytorch/issues/76532.
# If that ever gets implemented, remove this in favor of the solution on the `torch.Tensor` class.
extra_repr
=
", "
.
join
(
f
"
{
key
}
=
{
value
}
"
for
key
,
value
in
kwargs
.
items
())
return
f
"
{
super
().
__repr__
()[:
-
1
]
}
,
{
extra_repr
}
)"
def
horizontal_flip
(
self
)
->
_Feature
:
return
self
...
...
torchvision/prototype/features/_image.py
View file @
acf30e98
...
...
@@ -64,6 +64,9 @@ class Image(_Feature):
return
image
def
__repr__
(
self
,
*
,
tensor_contents
:
Any
=
None
)
->
str
:
# type: ignore[override]
return
self
.
_make_repr
(
color_space
=
self
.
color_space
)
@
classmethod
def
new_like
(
cls
,
other
:
Image
,
data
:
Any
,
*
,
color_space
:
Optional
[
Union
[
ColorSpace
,
str
]]
=
None
,
**
kwargs
:
Any
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment