Skip to content

Commit

Permalink
Move log task usage in init function (classy_vision/tasks/classy_task…
Browse files Browse the repository at this point in the history
….py) (facebookresearch#671)

Summary:
Pull Request resolved: facebookresearch#671

Moved log_class_usage from `classy_vision/tasks/__init__.py` to `classy_vision/tasks/classy_task.py`

Reviewed By: kazhang

Differential Revision: D25618822

fbshipit-source-id: 4c64f87a4c51c66e23a1e0f31de653fc6fd2dc3d
  • Loading branch information
Charles Pueschel authored and facebook-github-bot committed Dec 17, 2020
1 parent 1cea86f commit d5ddf0b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 0 additions & 2 deletions classy_vision/tasks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from pathlib import Path

from classy_vision.generic.registry_utils import import_all_modules
from classy_vision.generic.util import log_class_usage

from .classy_task import ClassyTask

Expand All @@ -28,7 +27,6 @@ def build_task(config):
(see :func:`register_task`) and call .from_config on it."""

task = TASK_REGISTRY[config["name"]].from_config(config)
log_class_usage("Task", task.__class__)

return task

Expand Down
3 changes: 3 additions & 0 deletions classy_vision/tasks/classy_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from abc import ABC, abstractmethod
from typing import Any, Dict

from classy_vision.generic.util import log_class_usage


class ClassyTask(ABC):
"""
Expand All @@ -22,6 +24,7 @@ def __init__(self) -> "ClassyTask":
Constructs a ClassyTask.
"""
self.hooks = []
log_class_usage("Task", self.__class__)

@classmethod
@abstractmethod
Expand Down

0 comments on commit d5ddf0b

Please sign in to comment.