Advertisement
Guest User

Untitled

a guest
Aug 25th, 2017
3,787
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 111.59 KB | None | 0 0
  1. model.fcn16 __init__:13 :3.9 Mb super().__init__(n_classes)
  2. start maybe_cuda:85 :1370.9 Mb return x.cuda() if torch.cuda.is_available() else x
  3. __main__ run_adaptation:314 :1370.9 Mb shift = -3
  4. __main__ run_adaptation:316 :1370.9 Mb setup, conf, stdout_tee = setup_config.get_setup_conf_log_dump(
  5. __main__ run_adaptation:317 :1370.9 Mb distance_name, path='./logs/'
  6. setup_config get_setup_conf_log_dump:72 :1370.9 Mb if '___' in setup_name:
  7. setup_config get_setup_conf_log_dump:75 :1370.9 Mb load_dict_name, log_fn_format = setup_name, setup_name
  8. setup_config get_setup_conf_log_dump:77 :1370.9 Mb setup_w_dump = get_setup_and_dump(load_dict_name, override)
  9. setup_config get_setup_and_dump:59 :1370.9 Mb override = override or {}
  10. setup_config get_setup_and_dump:60 :1370.9 Mb setup_dict = {'data': {}} # defaults
  11. setup_config get_setup_and_dump:61 :1370.9 Mb setup_dict = deep_dict_update(setup_dict, distance_config_[setup_name])
  12. setup_config deep_dict_update:15 :1370.9 Mb for k, v in u.items():
  13. setup_config deep_dict_update:16 :1370.9 Mb if isinstance(v, collections.Mapping):
  14. setup_config deep_dict_update:20 :1370.9 Mb d[k] = u[k]
  15. setup_config deep_dict_update:15 :1370.9 Mb for k, v in u.items():
  16. setup_config deep_dict_update:16 :1370.9 Mb if isinstance(v, collections.Mapping):
  17. setup_config deep_dict_update:17 :1370.9 Mb r = deep_dict_update(d.get(k, {}), v)
  18. setup_config deep_dict_update:15 :1370.9 Mb for k, v in u.items():
  19. setup_config deep_dict_update:16 :1370.9 Mb if isinstance(v, collections.Mapping):
  20. setup_config deep_dict_update:20 :1370.9 Mb d[k] = u[k]
  21. setup_config deep_dict_update:15 :1370.9 Mb for k, v in u.items():
  22. setup_config deep_dict_update:16 :1370.9 Mb if isinstance(v, collections.Mapping):
  23. setup_config deep_dict_update:20 :1370.9 Mb d[k] = u[k]
  24. setup_config deep_dict_update:15 :1370.9 Mb for k, v in u.items():
  25. setup_config deep_dict_update:16 :1370.9 Mb if isinstance(v, collections.Mapping):
  26. setup_config deep_dict_update:20 :1370.9 Mb d[k] = u[k]
  27. setup_config deep_dict_update:15 :1370.9 Mb for k, v in u.items():
  28. setup_config deep_dict_update:21 :1370.9 Mb return d
  29. setup_config deep_dict_update:18 :1370.9 Mb d[k] = r
  30. setup_config deep_dict_update:15 :1370.9 Mb for k, v in u.items():
  31. setup_config deep_dict_update:16 :1370.9 Mb if isinstance(v, collections.Mapping):
  32. setup_config deep_dict_update:20 :1370.9 Mb d[k] = u[k]
  33. setup_config deep_dict_update:15 :1370.9 Mb for k, v in u.items():
  34. setup_config deep_dict_update:21 :1370.9 Mb return d
  35. setup_config get_setup_and_dump:62 :1370.9 Mb setup_dict = deep_dict_update(setup_dict, override)
  36. setup_config deep_dict_update:15 :1370.9 Mb for k, v in u.items():
  37. setup_config deep_dict_update:21 :1370.9 Mb return d
  38. setup_config get_setup_and_dump:64 :1370.9 Mb 'optimizer': _exec_config(setup_dict.get('optimizer', None)),
  39. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  40. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  41. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  42. setup_config _exec_config:34 :1370.9 Mb packed_object = type(packed_object)(map(_exec_config, packed_object))
  43. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  44. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  45. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  46. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  47. setup_config _exec_config:46 :1370.9 Mb return packed_object
  48. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  49. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  50. setup_config _exec_config:31 :1370.9 Mb packed_object = {k: _exec_config(v) for k, v in packed_object.items()}
  51. setup_config <dictcomp>:31 :1370.9 Mb packed_object = {k: _exec_config(v) for k, v in packed_object.items()}
  52. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  53. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  54. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  55. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  56. setup_config _exec_config:46 :1370.9 Mb return packed_object
  57. setup_config <dictcomp>:31 :1370.9 Mb packed_object = {k: _exec_config(v) for k, v in packed_object.items()}
  58. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  59. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  60. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  61. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  62. setup_config _exec_config:46 :1370.9 Mb return packed_object
  63. setup_config <dictcomp>:31 :1370.9 Mb packed_object = {k: _exec_config(v) for k, v in packed_object.items()}
  64. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  65. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  66. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  67. setup_config _exec_config:34 :1370.9 Mb packed_object = type(packed_object)(map(_exec_config, packed_object))
  68. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  69. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  70. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  71. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  72. setup_config _exec_config:46 :1370.9 Mb return packed_object
  73. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  74. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  75. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  76. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  77. setup_config _exec_config:46 :1370.9 Mb return packed_object
  78. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  79. setup_config _exec_config:37 :1370.9 Mb and len(packed_object) == 2
  80. setup_config _exec_config:38 :1370.9 Mb and callable(packed_object[0])
  81. setup_config _exec_config:46 :1370.9 Mb return packed_object
  82. setup_config <dictcomp>:31 :1370.9 Mb packed_object = {k: _exec_config(v) for k, v in packed_object.items()}
  83. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  84. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  85. setup_config _exec_config:46 :1370.9 Mb return packed_object
  86. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  87. setup_config _exec_config:37 :1370.9 Mb and len(packed_object) == 2
  88. setup_config _exec_config:38 :1370.9 Mb and callable(packed_object[0])
  89. setup_config _exec_config:39 :1370.9 Mb and type(packed_object[1]) is dict):
  90. setup_config _exec_config:40 :1370.9 Mb repacked_object = partial(packed_object[0], **packed_object[1])
  91. setup_config _exec_config:41 :1370.9 Mb if isinstance(packed_object[0], types.FunctionType):
  92. setup_config _exec_config:44 :1370.9 Mb return repacked_object
  93. setup_config get_setup_and_dump:65 :1370.9 Mb 'distance': _exec_config(setup_dict.get('distance', None)),
  94. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  95. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  96. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  97. setup_config _exec_config:34 :1370.9 Mb packed_object = type(packed_object)(map(_exec_config, packed_object))
  98. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  99. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  100. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  101. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  102. setup_config _exec_config:46 :1370.9 Mb return packed_object
  103. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  104. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  105. setup_config _exec_config:31 :1370.9 Mb packed_object = {k: _exec_config(v) for k, v in packed_object.items()}
  106. setup_config <dictcomp>:31 :1370.9 Mb packed_object = {k: _exec_config(v) for k, v in packed_object.items()}
  107. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  108. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  109. setup_config _exec_config:31 :1370.9 Mb packed_object = {k: _exec_config(v) for k, v in packed_object.items()}
  110. setup_config <dictcomp>:31 :1370.9 Mb packed_object = {k: _exec_config(v) for k, v in packed_object.items()}
  111. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  112. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  113. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  114. setup_config _exec_config:34 :1370.9 Mb packed_object = type(packed_object)(map(_exec_config, packed_object))
  115. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  116. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  117. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  118. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  119. setup_config _exec_config:46 :1370.9 Mb return packed_object
  120. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  121. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  122. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  123. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  124. setup_config _exec_config:46 :1370.9 Mb return packed_object
  125. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  126. setup_config _exec_config:46 :1370.9 Mb return packed_object
  127. setup_config <dictcomp>:31 :1370.9 Mb packed_object = {k: _exec_config(v) for k, v in packed_object.items()}
  128. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  129. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  130. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  131. setup_config _exec_config:34 :1370.9 Mb packed_object = type(packed_object)(map(_exec_config, packed_object))
  132. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  133. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  134. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  135. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  136. setup_config _exec_config:46 :1370.9 Mb return packed_object
  137. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  138. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  139. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  140. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  141. setup_config _exec_config:46 :1370.9 Mb return packed_object
  142. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  143. setup_config _exec_config:46 :1370.9 Mb return packed_object
  144. setup_config <dictcomp>:31 :1370.9 Mb packed_object = {k: _exec_config(v) for k, v in packed_object.items()}
  145. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  146. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  147. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  148. setup_config _exec_config:34 :1370.9 Mb packed_object = type(packed_object)(map(_exec_config, packed_object))
  149. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  150. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  151. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  152. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  153. setup_config _exec_config:46 :1370.9 Mb return packed_object
  154. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  155. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  156. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  157. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  158. setup_config _exec_config:46 :1370.9 Mb return packed_object
  159. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  160. setup_config _exec_config:46 :1370.9 Mb return packed_object
  161. setup_config <dictcomp>:31 :1370.9 Mb packed_object = {k: _exec_config(v) for k, v in packed_object.items()}
  162. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  163. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  164. setup_config _exec_config:46 :1370.9 Mb return packed_object
  165. setup_config <dictcomp>:31 :1370.9 Mb packed_object = {k: _exec_config(v) for k, v in packed_object.items()}
  166. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  167. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  168. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  169. setup_config _exec_config:34 :1370.9 Mb packed_object = type(packed_object)(map(_exec_config, packed_object))
  170. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  171. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  172. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  173. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  174. setup_config _exec_config:46 :1370.9 Mb return packed_object
  175. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  176. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  177. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  178. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  179. setup_config _exec_config:46 :1370.9 Mb return packed_object
  180. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  181. setup_config _exec_config:37 :1370.9 Mb and len(packed_object) == 2
  182. setup_config _exec_config:38 :1370.9 Mb and callable(packed_object[0])
  183. setup_config _exec_config:46 :1370.9 Mb return packed_object
  184. setup_config <dictcomp>:31 :1370.9 Mb packed_object = {k: _exec_config(v) for k, v in packed_object.items()}
  185. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  186. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  187. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  188. setup_config _exec_config:34 :1370.9 Mb packed_object = type(packed_object)(map(_exec_config, packed_object))
  189. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  190. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  191. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  192. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  193. setup_config _exec_config:46 :1370.9 Mb return packed_object
  194. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  195. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  196. setup_config _exec_config:31 :1370.9 Mb packed_object = {k: _exec_config(v) for k, v in packed_object.items()}
  197. setup_config <dictcomp>:31 :1370.9 Mb packed_object = {k: _exec_config(v) for k, v in packed_object.items()}
  198. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  199. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  200. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  201. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  202. setup_config _exec_config:46 :1370.9 Mb return packed_object
  203. setup_config <dictcomp>:31 :1370.9 Mb packed_object = {k: _exec_config(v) for k, v in packed_object.items()}
  204. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  205. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  206. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  207. setup_config _exec_config:34 :1370.9 Mb packed_object = type(packed_object)(map(_exec_config, packed_object))
  208. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  209. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  210. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  211. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  212. setup_config _exec_config:46 :1370.9 Mb return packed_object
  213. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  214. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  215. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  216. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  217. setup_config _exec_config:46 :1370.9 Mb return packed_object
  218. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  219. setup_config _exec_config:37 :1370.9 Mb and len(packed_object) == 2
  220. setup_config _exec_config:38 :1370.9 Mb and callable(packed_object[0])
  221. setup_config _exec_config:46 :1370.9 Mb return packed_object
  222. setup_config <dictcomp>:31 :1370.9 Mb packed_object = {k: _exec_config(v) for k, v in packed_object.items()}
  223. setup_config _exec_config:25 :1370.9 Mb if packed_object is None:
  224. setup_config _exec_config:30 :1370.9 Mb if type(packed_object) is dict:
  225. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  226. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  227. setup_config _exec_config:46 :1370.9 Mb return packed_object
  228. setup_config <dictcomp>:31 :1370.9 Mb packed_object = {k: _exec_config(v) for k, v in packed_object.items()}
  229. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  230. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  231. setup_config _exec_config:46 :1370.9 Mb return packed_object
  232. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  233. setup_config _exec_config:37 :1370.9 Mb and len(packed_object) == 2
  234. setup_config _exec_config:38 :1370.9 Mb and callable(packed_object[0])
  235. setup_config _exec_config:39 :1370.9 Mb and type(packed_object[1]) is dict):
  236. setup_config _exec_config:40 :1370.9 Mb repacked_object = partial(packed_object[0], **packed_object[1])
  237. setup_config _exec_config:41 :1370.9 Mb if isinstance(packed_object[0], types.FunctionType):
  238. setup_config _exec_config:44 :1370.9 Mb return repacked_object
  239. setup_config <dictcomp>:31 :1370.9 Mb packed_object = {k: _exec_config(v) for k, v in packed_object.items()}
  240. setup_config _exec_config:33 :1370.9 Mb if isinstance(packed_object, (list, tuple)):
  241. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  242. setup_config _exec_config:46 :1370.9 Mb return packed_object
  243. setup_config _exec_config:36 :1370.9 Mb if (type(packed_object) is tuple
  244. setup_config _exec_config:37 :1370.9 Mb and len(packed_object) == 2
  245. setup_config _exec_config:38 :1370.9 Mb and callable(packed_object[0])
  246. setup_config _exec_config:39 :1370.9 Mb and type(packed_object[1]) is dict):
  247. setup_config _exec_config:40 :1370.9 Mb repacked_object = partial(packed_object[0], **packed_object[1])
  248. setup_config _exec_config:41 :1370.9 Mb if isinstance(packed_object[0], types.FunctionType):
  249. setup_config _exec_config:44 :1370.9 Mb return repacked_object
  250. setup_config get_setup_and_dump:66 :1370.9 Mb 'data': lambda: read_pytorch(**setup_dict['data']),
  251. setup_config get_setup_and_dump:67 :1370.9 Mb }, setup_dict)
  252. setup_config get_setup_conf_log_dump:78 :1370.9 Mb time_str = datetime.datetime.now().__format__(time_fmt)
  253. setup_config get_setup_conf_log_dump:79 :1370.9 Mb os.makedirs(path, exist_ok=True)
  254. setup_config get_setup_conf_log_dump:80 :1370.9 Mb fn = os.path.join(path, fn_fmt.format(setup=log_fn_format, now=time_str))
  255. setup_config get_setup_conf_log_dump:81 :1370.9 Mb with open(fn, 'w') as f:
  256. setup_config get_setup_conf_log_dump:82 :1370.9 Mb f.write(custom_json.dumps(setup_w_dump[1], indent=2))
  257. utils.custom_json default:14 :1370.9 Mb if isinstance(obj, type):
  258. utils.custom_json default:15 :1370.9 Mb return {'_type': (obj.__module__, obj.__name__)}
  259. utils.custom_json default:14 :1370.9 Mb if isinstance(obj, type):
  260. utils.custom_json default:15 :1370.9 Mb return {'_type': (obj.__module__, obj.__name__)}
  261. utils.custom_json default:14 :1370.9 Mb if isinstance(obj, type):
  262. utils.custom_json default:15 :1370.9 Mb return {'_type': (obj.__module__, obj.__name__)}
  263. setup_config get_setup_conf_log_dump:83 :1370.9 Mb tee_context_manager = tee_stdout(fn+'.log')
  264. setup_config get_setup_conf_log_dump:84 :1370.9 Mb return setup_w_dump[0], setup_w_dump[1], tee_context_manager
  265. __main__ run_adaptation:320 :1370.9 Mb distance_function = setup['distance']().cuda()
  266. distances.mlp __init__:16 :1370.9 Mb super().__init__(shapes, *argv, **kwargs)
  267. distances.mlp_base __init__:18 :1370.9 Mb super().__init__()
  268. distances.mlp_base __init__:19 :1370.9 Mb self.full_data_pretrain_n = full_data_pretrain_n
  269. distances.mlp_base __init__:20 :1370.9 Mb self._inited = False
  270. distances.mlp_base __init__:21 :1370.9 Mb self._step_every_repeat_n = step_every_repeat_n
  271. distances.mlp_base __init__:22 :1370.9 Mb self._shapes = shapes
  272. distances.mlp_base __init__:23 :1370.9 Mb self._optimizer_builder = optimizer_builder
  273. distances.mlp_base __init__:24 :1370.9 Mb self._initializer = initializer
  274. distances.mlp_base __init__:25 :1370.9 Mb self._attempt_on_forward = attempt_update_on_forward
  275. distances.mlp_base __init__:26 :1370.9 Mb self._update_attempt_counter = 0
  276. distances.mlp_base __init__:27 :1370.9 Mb self._start_from_n_updates = start_from_n_updates
  277. distances.mlp_base __init__:28 :1370.9 Mb self._sub_init(kwargs)
  278. distances.mlp_base _sub_init:50 :1370.9 Mb pass
  279. distances.mlp_base __init__:29 :1370.9 Mb self.draw_method_list.append(self.draw_contour)
  280. distances.mlp __init__:17 :1370.9 Mb self.stored_y = None
  281. __main__ run_adaptation:321 :1370.9 Mb optimizer = setup['optimizer'](target_model.parameters())
  282. __main__ run_adaptation:322 :1370.9 Mb if share_embedding:
  283. __main__ run_adaptation:323 :1370.9 Mb base_optimizer = setup['optimizer'](base_model.parameters())
  284. __main__ run_adaptation:325 :1370.9 Mb train_loaders = setup['data']()
  285. setup_config <lambda>:66 :1370.9 Mb 'data': lambda: read_pytorch(**setup_dict['data']),
  286. read_data read_pytorch:107 :1370.9 Mb if dataset == 'svhn2mnist':
  287. read_data read_pytorch:109 :1370.9 Mb elif dataset == 'gta2city':
  288. read_data read_pytorch:110 :1370.9 Mb return read_gta2city(batch_size, cuda, same_batch_n, shuffle, **kwargs)
  289. read_data read_gta2city:210 :1370.9 Mb kwargs = {'num_workers': workers, 'pin_memory': pin_memory} if cuda else {}
  290. read_data read_gta2city:212 :1370.9 Mb assert not (batch_size > 0 and same_batch_n > 1), \
  291. read_data read_gta2city:215 :1370.9 Mb if batch_size > 0 and same_batch_n == 1:
  292. read_data read_gta2city:216 :1370.9 Mb source_loader: Mapping[str, torch.utils.data.DataLoader] = {
  293. read_data read_gta2city:224 :1370.9 Mb for split_name in ['train', 'test']
  294. read_data <dictcomp>:216 :1370.9 Mb source_loader: Mapping[str, torch.utils.data.DataLoader] = {
  295. read_data <dictcomp>:224 :1370.9 Mb for split_name in ['train', 'test']
  296. read_data <dictcomp>:216 :1370.9 Mb source_loader: Mapping[str, torch.utils.data.DataLoader] = {
  297. read_data <dictcomp>:224 :1370.9 Mb for split_name in ['train', 'test']
  298. read_data <dictcomp>:216 :1370.9 Mb source_loader: Mapping[str, torch.utils.data.DataLoader] = {
  299. read_data read_gta2city:227 :1370.9 Mb target_loader: Mapping[str, torch.utils.data.DataLoader] = {
  300. read_data read_gta2city:236 :1370.9 Mb for split_name in ['train', 'test']
  301. read_data <dictcomp>:227 :1370.9 Mb target_loader: Mapping[str, torch.utils.data.DataLoader] = {
  302. read_data <dictcomp>:236 :1370.9 Mb for split_name in ['train', 'test']
  303. read_data <dictcomp>:227 :1370.9 Mb target_loader: Mapping[str, torch.utils.data.DataLoader] = {
  304. read_data <dictcomp>:236 :1370.9 Mb for split_name in ['train', 'test']
  305. read_data <dictcomp>:227 :1370.9 Mb target_loader: Mapping[str, torch.utils.data.DataLoader] = {
  306. read_data read_gta2city:241 :1370.9 Mb return source_loader, target_loader
  307. __main__ run_adaptation:326 :1370.9 Mb eval_loaders = setup['data']()
  308. setup_config <lambda>:66 :1370.9 Mb 'data': lambda: read_pytorch(**setup_dict['data']),
  309. read_data read_pytorch:107 :1370.9 Mb if dataset == 'svhn2mnist':
  310. read_data read_pytorch:109 :1370.9 Mb elif dataset == 'gta2city':
  311. read_data read_pytorch:110 :1370.9 Mb return read_gta2city(batch_size, cuda, same_batch_n, shuffle, **kwargs)
  312. read_data read_gta2city:210 :1370.9 Mb kwargs = {'num_workers': workers, 'pin_memory': pin_memory} if cuda else {}
  313. read_data read_gta2city:212 :1370.9 Mb assert not (batch_size > 0 and same_batch_n > 1), \
  314. read_data read_gta2city:215 :1370.9 Mb if batch_size > 0 and same_batch_n == 1:
  315. read_data read_gta2city:216 :1370.9 Mb source_loader: Mapping[str, torch.utils.data.DataLoader] = {
  316. read_data read_gta2city:224 :1370.9 Mb for split_name in ['train', 'test']
  317. read_data <dictcomp>:216 :1370.9 Mb source_loader: Mapping[str, torch.utils.data.DataLoader] = {
  318. read_data <dictcomp>:224 :1370.9 Mb for split_name in ['train', 'test']
  319. read_data <dictcomp>:216 :1370.9 Mb source_loader: Mapping[str, torch.utils.data.DataLoader] = {
  320. read_data <dictcomp>:224 :1370.9 Mb for split_name in ['train', 'test']
  321. read_data <dictcomp>:216 :1370.9 Mb source_loader: Mapping[str, torch.utils.data.DataLoader] = {
  322. read_data read_gta2city:227 :1370.9 Mb target_loader: Mapping[str, torch.utils.data.DataLoader] = {
  323. read_data read_gta2city:236 :1370.9 Mb for split_name in ['train', 'test']
  324. read_data <dictcomp>:227 :1370.9 Mb target_loader: Mapping[str, torch.utils.data.DataLoader] = {
  325. read_data <dictcomp>:236 :1370.9 Mb for split_name in ['train', 'test']
  326. read_data <dictcomp>:227 :1370.9 Mb target_loader: Mapping[str, torch.utils.data.DataLoader] = {
  327. read_data <dictcomp>:236 :1370.9 Mb for split_name in ['train', 'test']
  328. read_data <dictcomp>:227 :1370.9 Mb target_loader: Mapping[str, torch.utils.data.DataLoader] = {
  329. read_data read_gta2city:241 :1370.9 Mb return source_loader, target_loader
  330. __main__ run_adaptation:328 :1370.9 Mb with stdout_tee:
  331. utils.tee_stdout tee_stdout:22 :1370.9 Mb print('teeing std to', f_names)
  332. utils.tee_stdout tee_stdout:23 :1370.9 Mb f_objects = [open(f_name, 'w') for f_name in f_names]
  333. utils.tee_stdout <listcomp>:23 :1370.9 Mb f_objects = [open(f_name, 'w') for f_name in f_names]
  334. utils.tee_stdout <listcomp>:23 :1370.9 Mb f_objects = [open(f_name, 'w') for f_name in f_names]
  335. utils.tee_stdout tee_stdout:24 :1370.9 Mb with contextlib.redirect_stdout(MergedIO(sys.stdout, *f_objects)):
  336. utils.tee_stdout __init__:9 :1370.9 Mb self._file_objects = file_objects
  337. utils.tee_stdout tee_stdout:25 :1370.9 Mb yield
  338. __main__ run_adaptation:329 :1370.9 Mb print(conf)
  339. utils.tee_stdout write:12 :1370.9 Mb for f in self._file_objects:
  340. utils.tee_stdout write:13 :1370.9 Mb f.write(string)
  341. utils.tee_stdout write:14 :1370.9 Mb f.flush()
  342. utils.tee_stdout write:12 :1370.9 Mb for f in self._file_objects:
  343. utils.tee_stdout write:13 :1370.9 Mb f.write(string)
  344. utils.tee_stdout write:14 :1370.9 Mb f.flush()
  345. utils.tee_stdout write:12 :1370.9 Mb for f in self._file_objects:
  346. utils.tee_stdout write:12 :1370.9 Mb for f in self._file_objects:
  347. utils.tee_stdout write:13 :1370.9 Mb f.write(string)
  348. utils.tee_stdout write:14 :1370.9 Mb f.flush()
  349. utils.tee_stdout write:12 :1370.9 Mb for f in self._file_objects:
  350. utils.tee_stdout write:13 :1370.9 Mb f.write(string)
  351. utils.tee_stdout write:14 :1370.9 Mb f.flush()
  352. utils.tee_stdout write:12 :1370.9 Mb for f in self._file_objects:
  353. __main__ run_adaptation:330 :1370.9 Mb print(snapshot_name)
  354. utils.tee_stdout write:12 :1370.9 Mb for f in self._file_objects:
  355. utils.tee_stdout write:13 :1370.9 Mb f.write(string)
  356. utils.tee_stdout write:14 :1370.9 Mb f.flush()
  357. utils.tee_stdout write:12 :1370.9 Mb for f in self._file_objects:
  358. utils.tee_stdout write:13 :1370.9 Mb f.write(string)
  359. utils.tee_stdout write:14 :1370.9 Mb f.flush()
  360. utils.tee_stdout write:12 :1370.9 Mb for f in self._file_objects:
  361. utils.tee_stdout write:12 :1370.9 Mb for f in self._file_objects:
  362. utils.tee_stdout write:13 :1370.9 Mb f.write(string)
  363. utils.tee_stdout write:14 :1370.9 Mb f.flush()
  364. utils.tee_stdout write:12 :1370.9 Mb for f in self._file_objects:
  365. utils.tee_stdout write:13 :1370.9 Mb f.write(string)
  366. utils.tee_stdout write:14 :1370.9 Mb f.flush()
  367. utils.tee_stdout write:12 :1370.9 Mb for f in self._file_objects:
  368. __main__ run_adaptation:332 :1370.9 Mb run_iterations(distance_function, distance_name, eval_loaders, shift,
  369. __main__ run_adaptation:333 :1370.9 Mb train_loaders)
  370. __main__ run_iterations:340 :1370.9 Mb for sub_epoch_i in range(total_epochs):
  371. __main__ run_iterations:348 :1370.9 Mb if eval_on_first_iter is True and sub_epoch_i == 0:
  372. __main__ run_iterations:351 :1370.9 Mb print(f'{sub_epoch_i:>3} updating')
  373. utils.tee_stdout write:12 :1370.9 Mb for f in self._file_objects:
  374. utils.tee_stdout write:13 :1370.9 Mb f.write(string)
  375. utils.tee_stdout write:14 :1370.9 Mb f.flush()
  376. utils.tee_stdout write:12 :1370.9 Mb for f in self._file_objects:
  377. utils.tee_stdout write:13 :1370.9 Mb f.write(string)
  378. utils.tee_stdout write:14 :1370.9 Mb f.flush()
  379. utils.tee_stdout write:12 :1370.9 Mb for f in self._file_objects:
  380. utils.tee_stdout write:12 :1370.9 Mb for f in self._file_objects:
  381. utils.tee_stdout write:13 :1370.9 Mb f.write(string)
  382. utils.tee_stdout write:14 :1370.9 Mb f.flush()
  383. utils.tee_stdout write:12 :1370.9 Mb for f in self._file_objects:
  384. utils.tee_stdout write:13 :1370.9 Mb f.write(string)
  385. utils.tee_stdout write:14 :1370.9 Mb f.flush()
  386. utils.tee_stdout write:12 :1370.9 Mb for f in self._file_objects:
  387. __main__ run_iterations:353 :1370.9 Mb if sub_epoch_i == 0:
  388. __main__ run_iterations:354 :1370.9 Mb repeat_learning_i = getattr(distance_function, 'full_data_pretrain_n', 1)
  389. __main__ run_iterations:358 :1370.9 Mb for sub_repeat in range(repeat_learning_i):
  390. __main__ run_iterations:359 :1370.9 Mb pretraining = repeat_learning_i > 1
  391. __main__ run_iterations:360 :1370.9 Mb sub_match_iterator = match_source_target(
  392. __main__ run_iterations:361 :1370.9 Mb sub_epoch_i, train_loaders, distance_function, shift=shift,
  393. __main__ run_iterations:362 :1370.9 Mb discriminator_only=pretraining
  394. __main__ run_iterations:365 :1370.9 Mb print('supervised update')
  395. utils.tee_stdout write:12 :1370.9 Mb for f in self._file_objects:
  396. utils.tee_stdout write:13 :1370.9 Mb f.write(string)
  397. utils.tee_stdout write:14 :1370.9 Mb f.flush()
  398. utils.tee_stdout write:12 :1370.9 Mb for f in self._file_objects:
  399. utils.tee_stdout write:13 :1370.9 Mb f.write(string)
  400. utils.tee_stdout write:14 :1370.9 Mb f.flush()
  401. utils.tee_stdout write:12 :1370.9 Mb for f in self._file_objects:
  402. utils.tee_stdout write:12 :1370.9 Mb for f in self._file_objects:
  403. utils.tee_stdout write:13 :1370.9 Mb f.write(string)
  404. utils.tee_stdout write:14 :1370.9 Mb f.flush()
  405. utils.tee_stdout write:12 :1370.9 Mb for f in self._file_objects:
  406. utils.tee_stdout write:13 :1370.9 Mb f.write(string)
  407. utils.tee_stdout write:14 :1370.9 Mb f.flush()
  408. utils.tee_stdout write:12 :1370.9 Mb for f in self._file_objects:
  409. __main__ run_iterations:367 :1370.9 Mb if share_embedding is True:
  410. __main__ run_iterations:368 :1370.9 Mb sub_base_iterator = supervised_source_update(train_loaders[0]['train'])
  411. __main__ run_iterations:369 :1370.9 Mb sub_iterator = zip(sub_match_iterator, sub_base_iterator)
  412. __main__ run_iterations:373 :1370.9 Mb for __ in sub_iterator:
  413. __main__ match_source_target:107 :1370.9 Mb dist_func.train(True)
  414. __main__ match_source_target:109 :1370.9 Mb discriminator_needs_update = hasattr(dist_func, 'attempt_update_d')
  415. __main__ match_source_target:111 :1370.9 Mb if not discriminator_needs_update and discriminator_only:
  416. __main__ match_source_target:115 :1370.9 Mb if discriminator_only is True:
  417. __main__ match_source_target:118 :1370.9 Mb data_len = len(loaders[0]['train'])
  418. __main__ match_source_target:119 :1370.9 Mb yield_every = data_len // update_report_per_epoch
  419. __main__ match_source_target:120 :1370.9 Mb adaptation_iterator = enumerate(zip(loaders[0]['train'], loaders[1]['train']))
  420. __main__ match_source_target:121 :1370.9 Mb tqdm_adaptation_iterator = tqdm(adaptation_iterator, total=data_len, desc='match')
  421. __main__ match_source_target:122 :1370.9 Mb for batch_idx, ((source_data, s_y), (target_data, ___)) in tqdm_adaptation_iterator:
  422. __main__ match_source_target:123 :1370.9 Mb if source_data.numel == 0:
  423. __main__ match_source_target:127 :1370.9 Mb dist_func.current_pos = (epoch_i, batch_idx, batch_idx)
  424. __main__ match_source_target:128 :1370.9 Mb dist_func.y_a = s_y
  425. __main__ match_source_target:130 :1370.9 Mb data_s = Variable(maybe_cuda(source_data))
  426. start maybe_cuda:85 :1370.9 Mb return x.cuda() if torch.cuda.is_available() else x
  427. __main__ match_source_target:131 :1370.9 Mb data_t = Variable(maybe_cuda(target_data))
  428. start maybe_cuda:85 :1370.9 Mb return x.cuda() if torch.cuda.is_available() else x
  429. __main__ match_source_target:134 :1370.9 Mb if discriminator_needs_update is True:
  430. __main__ match_source_target:136 :1370.9 Mb feature_apply(partial(dist_func.attempt_update_d, epoch_i=epoch_i),
  431. __main__ match_source_target:137 :1370.9 Mb base_model, target_model, data_s, data_t, shift)
  432. distances.utils feature_apply:103 :1370.9 Mb a_phi = model_a.features_at(input_a, shift)
  433. model.fcn16 features_at:16 :1370.9 Mb assert shift == -3, "!= -3 not implemented, not needed"
  434. model.fcn16 features_at:18 :1370.9 Mb h = x
  435. model.fcn16 features_at:19 :1370.9 Mb h = self.relu1_1(self.conv1_1(h))
  436. model.fcn16 features_at:20 :2118.9 Mb h = self.relu1_2(self.conv1_2(h))
  437. model.fcn16 features_at:21 :2764.9 Mb h = self.pool1(h)
  438. model.fcn16 features_at:23 :3088.9 Mb h = self.relu2_1(self.conv2_1(h))
  439. model.fcn16 features_at:24 :3412.9 Mb h = self.relu2_2(self.conv2_2(h))
  440. model.fcn16 features_at:25 :3736.9 Mb h = self.pool2(h)
  441. model.fcn16 features_at:27 :3898.9 Mb h = self.relu3_1(self.conv3_1(h))
  442. model.fcn16 features_at:28 :4060.9 Mb h = self.relu3_2(self.conv3_2(h))
  443. model.fcn16 features_at:29 :4222.9 Mb h = self.relu3_3(self.conv3_3(h))
  444. model.fcn16 features_at:30 :4384.9 Mb h = self.pool3(h)
  445. model.fcn16 features_at:32 :4384.9 Mb h = self.relu4_1(self.conv4_1(h))
  446. model.fcn16 features_at:33 :4466.9 Mb h = self.relu4_2(self.conv4_2(h))
  447. model.fcn16 features_at:34 :4548.9 Mb h = self.relu4_3(self.conv4_3(h))
  448. model.fcn16 features_at:35 :4630.9 Mb h = self.pool4(h)
  449. model.fcn16 features_at:37 :4672.9 Mb h = self.relu5_1(self.conv5_1(h))
  450. model.fcn16 features_at:38 :4694.9 Mb h = self.relu5_2(self.conv5_2(h))
  451. model.fcn16 features_at:39 :4716.9 Mb h = self.relu5_3(self.conv5_3(h))
  452. model.fcn16 features_at:40 :4738.9 Mb h = self.pool5(h)
  453. model.fcn16 features_at:42 :4738.9 Mb h = self.relu6(self.fc6(h))
  454. model.fcn16 features_at:43 :4966.9 Mb h = self.drop6(h)
  455. model.fcn16 features_at:45 :4966.9 Mb h = self.relu7(self.fc7(h))
  456. model.fcn16 features_at:46 :4966.9 Mb h = self.drop7(h)
  457. model.fcn16 features_at:48 :4966.9 Mb h = self.score_fr(h)
  458. model.fcn16 features_at:50 :4966.9 Mb return h
  459. distances.utils feature_apply:104 :4966.9 Mb b_phi = model_b.features_at(input_b, shift)
  460. model.fcn16 features_at:16 :4966.9 Mb assert shift == -3, "!= -3 not implemented, not needed"
  461. model.fcn16 features_at:18 :4966.9 Mb h = x
  462. model.fcn16 features_at:19 :4966.9 Mb h = self.relu1_1(self.conv1_1(h))
  463. model.fcn16 features_at:20 :5612.9 Mb h = self.relu1_2(self.conv1_2(h))
  464. model.fcn16 features_at:21 :6258.9 Mb h = self.pool1(h)
  465. model.fcn16 features_at:23 :6744.9 Mb h = self.relu2_1(self.conv2_1(h))
  466. model.fcn16 features_at:24 :7068.9 Mb h = self.relu2_2(self.conv2_2(h))
  467. model.fcn16 features_at:25 :7392.9 Mb h = self.pool2(h)
  468. model.fcn16 features_at:27 :7554.9 Mb h = self.relu3_1(self.conv3_1(h))
  469. model.fcn16 features_at:28 :7716.9 Mb h = self.relu3_2(self.conv3_2(h))
  470. model.fcn16 features_at:29 :7878.9 Mb h = self.relu3_3(self.conv3_3(h))
  471. model.fcn16 features_at:30 :8040.9 Mb h = self.pool3(h)
  472. model.fcn16 features_at:32 :8164.9 Mb h = self.relu4_1(self.conv4_1(h))
  473. model.fcn16 features_at:33 :8246.9 Mb h = self.relu4_2(self.conv4_2(h))
  474. model.fcn16 features_at:34 :8328.9 Mb h = self.relu4_3(self.conv4_3(h))
  475. model.fcn16 features_at:35 :8410.9 Mb h = self.pool4(h)
  476. model.fcn16 features_at:37 :8474.9 Mb h = self.relu5_1(self.conv5_1(h))
  477. model.fcn16 features_at:38 :8496.9 Mb h = self.relu5_2(self.conv5_2(h))
  478. model.fcn16 features_at:39 :8518.9 Mb h = self.relu5_3(self.conv5_3(h))
  479. model.fcn16 features_at:40 :8540.9 Mb h = self.pool5(h)
  480. model.fcn16 features_at:42 :8540.9 Mb h = self.relu6(self.fc6(h))
  481. model.fcn16 features_at:43 :8768.9 Mb h = self.drop6(h)
  482. model.fcn16 features_at:45 :8768.9 Mb h = self.relu7(self.fc7(h))
  483. model.fcn16 features_at:46 :8768.9 Mb h = self.drop7(h)
  484. model.fcn16 features_at:48 :8768.9 Mb h = self.score_fr(h)
  485. model.fcn16 features_at:50 :8768.9 Mb return h
  486. distances.utils feature_apply:105 :8768.9 Mb dist_val = apply_func(a_phi, b_phi)
  487. distances.mlp_base attempt_update_d:62 :8768.9 Mb self._check_inputs(features_a, features_b)
  488. distances.mlp_fcn _check_inputs:32 :8768.9 Mb self._maybe_init(features_a)
  489. distances.mlp_fcn _maybe_init:28 :8768.9 Mb if not self._inited:
  490. distances.mlp_fcn _maybe_init:29 :8768.9 Mb self._init_net(some_feature_input.size()[1:])
  491. distances.mlp_fcn _init_net:37 :8768.9 Mb if self._shapes is not None:
  492. distances.mlp_fcn _init_net:38 :8768.9 Mb used_kern_sizes = (n_features[0],) + tuple(self._shapes['channels'])
  493. distances.mlp_fcn _init_net:39 :8768.9 Mb self.cnn_net = self.classifier = nn.Sequential(
  494. distances.mlp_fcn _init_net:40 :8768.9 Mb *chain.from_iterable(
  495. distances.mlp_fcn _init_net:41 :8768.9 Mb (nn.Conv2d(used_kern_sizes[i], used_kern_sizes[i+1],
  496. distances.mlp_fcn _init_net:45 :8768.9 Mb for i in range(len(used_kern_sizes)-1)
  497. distances.mlp_fcn _init_net:47 :8768.9 Mb Flatten()
  498. distances.mlp_fcn <genexpr>:41 :8768.9 Mb (nn.Conv2d(used_kern_sizes[i], used_kern_sizes[i+1],
  499. distances.mlp_fcn <genexpr>:45 :8768.9 Mb for i in range(len(used_kern_sizes)-1)
  500. distances.mlp_fcn <genexpr>:41 :8768.9 Mb (nn.Conv2d(used_kern_sizes[i], used_kern_sizes[i+1],
  501. distances.mlp_fcn <genexpr>:45 :8768.9 Mb for i in range(len(used_kern_sizes)-1)
  502. distances.mlp_fcn <genexpr>:41 :8768.9 Mb (nn.Conv2d(used_kern_sizes[i], used_kern_sizes[i+1],
  503. distances.mlp_fcn _init_net:50 :8768.9 Mb test_pass_var = Variable(torch.zeros(1, *n_features), volatile=True).cuda()
  504. distances.mlp_fcn _init_net:51 :8768.9 Mb feature_n = self.cnn_net(test_pass_var).size(1) # because [1, F*H*W]
  505. distances.mlp_fcn forward:17 :8768.9 Mb return X.view(X.size(0), -1)
  506. distances.mlp_fcn _init_net:52 :8768.9 Mb self.net = nn.Sequential(
  507. distances.mlp_fcn _init_net:53 :8768.9 Mb self.cnn_net,
  508. distances.mlp_fcn _init_net:54 :8768.9 Mb nn.Linear(feature_n, 1)
  509. distances.mlp_fcn _init_net:57 :8768.9 Mb for w in self.parameters():
  510. distances.mlp_fcn _init_net:58 :8768.9 Mb if w.ndimension() >= 2 and not getattr(w, 'initialized', False):
  511. distances.mlp_fcn _init_net:59 :8768.9 Mb self._initializer(w)
  512. distances.mlp_fcn _init_net:57 :8768.9 Mb for w in self.parameters():
  513. distances.mlp_fcn _init_net:58 :8768.9 Mb if w.ndimension() >= 2 and not getattr(w, 'initialized', False):
  514. distances.mlp_fcn _init_net:57 :8768.9 Mb for w in self.parameters():
  515. distances.mlp_fcn _init_net:58 :8768.9 Mb if w.ndimension() >= 2 and not getattr(w, 'initialized', False):
  516. distances.mlp_fcn _init_net:59 :8768.9 Mb self._initializer(w)
  517. distances.mlp_fcn _init_net:57 :8768.9 Mb for w in self.parameters():
  518. distances.mlp_fcn _init_net:58 :8768.9 Mb if w.ndimension() >= 2 and not getattr(w, 'initialized', False):
  519. distances.mlp_fcn _init_net:57 :8768.9 Mb for w in self.parameters():
  520. distances.mlp_fcn _init_net:58 :8768.9 Mb if w.ndimension() >= 2 and not getattr(w, 'initialized', False):
  521. distances.mlp_fcn _init_net:59 :8768.9 Mb self._initializer(w)
  522. distances.mlp_fcn _init_net:57 :8768.9 Mb for w in self.parameters():
  523. distances.mlp_fcn _init_net:58 :8768.9 Mb if w.ndimension() >= 2 and not getattr(w, 'initialized', False):
  524. distances.mlp_fcn _init_net:57 :8768.9 Mb for w in self.parameters():
  525. distances.mlp_fcn _init_net:61 :8768.9 Mb self._d_optimizer = self._optimizer_builder(self.parameters())
  526. distances.mlp_fcn _init_net:62 :8768.9 Mb self._n_features = n_features
  527. distances.mlp_fcn _init_net:63 :8768.9 Mb self.__inited = True
  528. distances.mlp_fcn _check_inputs:33 :8768.9 Mb assert features_a.size()[1:] == features_b.size()[1:] == self._n_features
  529. distances.mlp_base attempt_update_d:64 :8768.9 Mb if self._start_from_n_updates > 0 and epoch_i == 0:
  530. distances.mlp_base attempt_update_d:73 :8768.9 Mb if (self._step_every_repeat_n[0] > 0
  531. distances.mlp_base attempt_update_d:74 :8768.9 Mb and self._update_attempt_counter % self._step_every_repeat_n[0] == 0):
  532. distances.mlp_base attempt_update_d:75 :8768.9 Mb for _ in range(self._step_every_repeat_n[1]):
  533. distances.mlp_base attempt_update_d:76 :8768.9 Mb self.d_update_step(features_a, features_b)
  534. distances.mlp_base d_update_step:54 :8768.9 Mb cross_ent = self.objective(features_a, features_b)
  535. distances.mlp objective:21 :8768.9 Mb full_x = torch.cat([features_a, features_b], 0)
  536. distances.mlp objective:23 :8768.9 Mb if self.stored_y is None:
  537. distances.mlp objective:24 :8768.9 Mb to_concat = [torch.ones(features_a.size(0)), torch.zeros(features_b.size(0))]
  538. distances.mlp objective:25 :8768.9 Mb _y = Variable(torch.cat(to_concat).cuda())
  539. distances.mlp objective:26 :8768.9 Mb self.stored_y = _y
  540. distances.mlp objective:30 :8768.9 Mb full_y = _y if not inverse_labels else (1 - _y)
  541. distances.mlp objective:31 :8768.9 Mb output = self.network_forward(full_x)
  542. distances.mlp_base network_forward:37 :8768.9 Mb return self.net(x)
  543. distances.mlp_fcn forward:17 :8768.9 Mb return X.view(X.size(0), -1)
  544. distances.mlp objective:32 :8798.9 Mb cross_ent = F.binary_cross_entropy(F.sigmoid(output.view(-1)), full_y.view(-1))
  545. distances.mlp objective:33 :8818.9 Mb assert not has_nan(cross_ent)
  546. distances.utils has_nan:83 :8818.9 Mb if type(x) is float:
  547. distances.utils has_nan:86 :8818.9 Mb x = x.data if type(x) is Variable else x
  548. distances.utils has_nan:87 :8818.9 Mb return ((float(torch.sum(x != x)) > 0)
  549. distances.utils has_nan:88 :8818.9 Mb or float(torch.sum(x == np.inf)) > 0)
  550. distances.mlp objective:34 :8818.9 Mb return cross_ent
  551. distances.mlp_base d_update_step:56 :8818.9 Mb self._d_optimizer.zero_grad()
  552. distances.mlp_base d_update_step:58 :8818.9 Mb cross_ent.backward()
  553. distances.mlp_base d_update_step:59 :6284.9 Mb self._d_optimizer.step()
  554. distances.mlp_base attempt_update_d:77 :6284.9 Mb self._update_attempt_counter += 1
  555. distances.mlp_base attempt_update_d:75 :6284.9 Mb for _ in range(self._step_every_repeat_n[1]):
  556. distances.mlp_base attempt_update_d:78 :6284.9 Mb return
  557. distances.utils feature_apply:106 :6284.9 Mb return dist_val
  558. __main__ match_source_target:139 :6284.9 Mb del data_s, data_t
  559. __main__ match_source_target:140 :6284.9 Mb data_s = Variable(maybe_cuda(source_data))
  560. start maybe_cuda:85 :6284.9 Mb return x.cuda() if torch.cuda.is_available() else x
  561. __main__ match_source_target:141 :6284.9 Mb data_t = Variable(maybe_cuda(target_data))
  562. start maybe_cuda:85 :6284.9 Mb return x.cuda() if torch.cuda.is_available() else x
  563. __main__ match_source_target:145 :6284.9 Mb if not discriminator_only:
  564. __main__ match_source_target:146 :6284.9 Mb dist_val = feature_apply(dist_func,
  565. __main__ match_source_target:147 :6284.9 Mb base_model, target_model, data_s, data_t, shift)
  566. distances.utils feature_apply:103 :6284.9 Mb a_phi = model_a.features_at(input_a, shift)
  567. model.fcn16 features_at:16 :6284.9 Mb assert shift == -3, "!= -3 not implemented, not needed"
  568. model.fcn16 features_at:18 :6284.9 Mb h = x
  569. model.fcn16 features_at:19 :6284.9 Mb h = self.relu1_1(self.conv1_1(h))
  570. model.fcn16 features_at:20 :6284.9 Mb h = self.relu1_2(self.conv1_2(h))
  571. model.fcn16 features_at:21 :6284.9 Mb h = self.pool1(h)
  572. model.fcn16 features_at:23 :6284.9 Mb h = self.relu2_1(self.conv2_1(h))
  573. model.fcn16 features_at:24 :6284.9 Mb h = self.relu2_2(self.conv2_2(h))
  574. model.fcn16 features_at:25 :6284.9 Mb h = self.pool2(h)
  575. model.fcn16 features_at:27 :6284.9 Mb h = self.relu3_1(self.conv3_1(h))
  576. model.fcn16 features_at:28 :6284.9 Mb h = self.relu3_2(self.conv3_2(h))
  577. model.fcn16 features_at:29 :6284.9 Mb h = self.relu3_3(self.conv3_3(h))
  578. model.fcn16 features_at:30 :6284.9 Mb h = self.pool3(h)
  579. model.fcn16 features_at:32 :6284.9 Mb h = self.relu4_1(self.conv4_1(h))
  580. model.fcn16 features_at:33 :6284.9 Mb h = self.relu4_2(self.conv4_2(h))
  581. model.fcn16 features_at:34 :6284.9 Mb h = self.relu4_3(self.conv4_3(h))
  582. model.fcn16 features_at:35 :6284.9 Mb h = self.pool4(h)
  583. model.fcn16 features_at:37 :6284.9 Mb h = self.relu5_1(self.conv5_1(h))
  584. model.fcn16 features_at:38 :6284.9 Mb h = self.relu5_2(self.conv5_2(h))
  585. model.fcn16 features_at:39 :6284.9 Mb h = self.relu5_3(self.conv5_3(h))
  586. model.fcn16 features_at:40 :6284.9 Mb h = self.pool5(h)
  587. model.fcn16 features_at:42 :6284.9 Mb h = self.relu6(self.fc6(h))
  588. model.fcn16 features_at:43 :6284.9 Mb h = self.drop6(h)
  589. model.fcn16 features_at:45 :6284.9 Mb h = self.relu7(self.fc7(h))
  590. model.fcn16 features_at:46 :6284.9 Mb h = self.drop7(h)
  591. model.fcn16 features_at:48 :6284.9 Mb h = self.score_fr(h)
  592. model.fcn16 features_at:50 :6284.9 Mb return h
  593. distances.utils feature_apply:104 :6284.9 Mb b_phi = model_b.features_at(input_b, shift)
  594. model.fcn16 features_at:16 :6284.9 Mb assert shift == -3, "!= -3 not implemented, not needed"
  595. model.fcn16 features_at:18 :6284.9 Mb h = x
  596. model.fcn16 features_at:19 :6284.9 Mb h = self.relu1_1(self.conv1_1(h))
  597. model.fcn16 features_at:20 :6284.9 Mb h = self.relu1_2(self.conv1_2(h))
  598. model.fcn16 features_at:21 :6930.9 Mb h = self.pool1(h)
  599. model.fcn16 features_at:23 :7254.9 Mb h = self.relu2_1(self.conv2_1(h))
  600. model.fcn16 features_at:24 :7578.9 Mb h = self.relu2_2(self.conv2_2(h))
  601. model.fcn16 features_at:25 :7902.9 Mb h = self.pool2(h)
  602. model.fcn16 features_at:27 :8146.9 Mb h = self.relu3_1(self.conv3_1(h))
  603. model.fcn16 features_at:28 :8308.9 Mb h = self.relu3_2(self.conv3_2(h))
  604. model.fcn16 features_at:29 :8470.9 Mb h = self.relu3_3(self.conv3_3(h))
  605. model.fcn16 features_at:30 :8632.9 Mb h = self.pool3(h)
  606. model.fcn16 features_at:32 :8756.9 Mb h = self.relu4_1(self.conv4_1(h))
  607. model.fcn16 features_at:33 :8838.9 Mb h = self.relu4_2(self.conv4_2(h))
  608. model.fcn16 features_at:34 :8920.9 Mb h = self.relu4_3(self.conv4_3(h))
  609. model.fcn16 features_at:35 :9002.9 Mb h = self.pool4(h)
  610. model.fcn16 features_at:37 :9044.9 Mb h = self.relu5_1(self.conv5_1(h))
  611. model.fcn16 features_at:38 :9044.9 Mb h = self.relu5_2(self.conv5_2(h))
  612. model.fcn16 features_at:39 :9066.9 Mb h = self.relu5_3(self.conv5_3(h))
  613. model.fcn16 features_at:40 :9088.9 Mb h = self.pool5(h)
  614. model.fcn16 features_at:42 :9088.9 Mb h = self.relu6(self.fc6(h))
  615. model.fcn16 features_at:43 :9316.9 Mb h = self.drop6(h)
  616. model.fcn16 features_at:45 :9316.9 Mb h = self.relu7(self.fc7(h))
  617. model.fcn16 features_at:46 :9316.9 Mb h = self.drop7(h)
  618. model.fcn16 features_at:48 :9316.9 Mb h = self.score_fr(h)
  619. model.fcn16 features_at:50 :9316.9 Mb return h
  620. distances.utils feature_apply:105 :9316.9 Mb dist_val = apply_func(a_phi, b_phi)
  621. distances.mlp_base forward:40 :9316.9 Mb self._check_inputs(features_a, features_b)
  622. distances.mlp_fcn _check_inputs:32 :9316.9 Mb self._maybe_init(features_a)
  623. distances.mlp_fcn _maybe_init:28 :9316.9 Mb if not self._inited:
  624. distances.mlp_fcn _maybe_init:29 :9316.9 Mb self._init_net(some_feature_input.size()[1:])
  625. distances.mlp_fcn _init_net:37 :9316.9 Mb if self._shapes is not None:
  626. distances.mlp_fcn _init_net:38 :9316.9 Mb used_kern_sizes = (n_features[0],) + tuple(self._shapes['channels'])
  627. distances.mlp_fcn _init_net:39 :9316.9 Mb self.cnn_net = self.classifier = nn.Sequential(
  628. distances.mlp_fcn _init_net:40 :9316.9 Mb *chain.from_iterable(
  629. distances.mlp_fcn _init_net:41 :9316.9 Mb (nn.Conv2d(used_kern_sizes[i], used_kern_sizes[i+1],
  630. distances.mlp_fcn _init_net:45 :9316.9 Mb for i in range(len(used_kern_sizes)-1)
  631. distances.mlp_fcn _init_net:47 :9316.9 Mb Flatten()
  632. distances.mlp_fcn <genexpr>:41 :9316.9 Mb (nn.Conv2d(used_kern_sizes[i], used_kern_sizes[i+1],
  633. distances.mlp_fcn <genexpr>:45 :9316.9 Mb for i in range(len(used_kern_sizes)-1)
  634. distances.mlp_fcn <genexpr>:41 :9316.9 Mb (nn.Conv2d(used_kern_sizes[i], used_kern_sizes[i+1],
  635. distances.mlp_fcn <genexpr>:45 :9316.9 Mb for i in range(len(used_kern_sizes)-1)
  636. distances.mlp_fcn <genexpr>:41 :9316.9 Mb (nn.Conv2d(used_kern_sizes[i], used_kern_sizes[i+1],
  637. distances.mlp_fcn _init_net:50 :9316.9 Mb test_pass_var = Variable(torch.zeros(1, *n_features), volatile=True).cuda()
  638. distances.mlp_fcn _init_net:51 :9316.9 Mb feature_n = self.cnn_net(test_pass_var).size(1) # because [1, F*H*W]
  639. distances.mlp_fcn forward:17 :9316.9 Mb return X.view(X.size(0), -1)
  640. distances.mlp_fcn _init_net:52 :9316.9 Mb self.net = nn.Sequential(
  641. distances.mlp_fcn _init_net:53 :9316.9 Mb self.cnn_net,
  642. distances.mlp_fcn _init_net:54 :9316.9 Mb nn.Linear(feature_n, 1)
  643. distances.mlp_fcn _init_net:57 :9316.9 Mb for w in self.parameters():
  644. distances.mlp_fcn _init_net:58 :9316.9 Mb if w.ndimension() >= 2 and not getattr(w, 'initialized', False):
  645. distances.mlp_fcn _init_net:59 :9316.9 Mb self._initializer(w)
  646. distances.mlp_fcn _init_net:57 :9316.9 Mb for w in self.parameters():
  647. distances.mlp_fcn _init_net:58 :9316.9 Mb if w.ndimension() >= 2 and not getattr(w, 'initialized', False):
  648. distances.mlp_fcn _init_net:57 :9316.9 Mb for w in self.parameters():
  649. distances.mlp_fcn _init_net:58 :9316.9 Mb if w.ndimension() >= 2 and not getattr(w, 'initialized', False):
  650. distances.mlp_fcn _init_net:59 :9316.9 Mb self._initializer(w)
  651. distances.mlp_fcn _init_net:57 :9316.9 Mb for w in self.parameters():
  652. distances.mlp_fcn _init_net:58 :9316.9 Mb if w.ndimension() >= 2 and not getattr(w, 'initialized', False):
  653. distances.mlp_fcn _init_net:57 :9316.9 Mb for w in self.parameters():
  654. distances.mlp_fcn _init_net:58 :9316.9 Mb if w.ndimension() >= 2 and not getattr(w, 'initialized', False):
  655. distances.mlp_fcn _init_net:59 :9316.9 Mb self._initializer(w)
  656. distances.mlp_fcn _init_net:57 :9316.9 Mb for w in self.parameters():
  657. distances.mlp_fcn _init_net:58 :9316.9 Mb if w.ndimension() >= 2 and not getattr(w, 'initialized', False):
  658. distances.mlp_fcn _init_net:57 :9316.9 Mb for w in self.parameters():
  659. distances.mlp_fcn _init_net:61 :9316.9 Mb self._d_optimizer = self._optimizer_builder(self.parameters())
  660. distances.mlp_fcn _init_net:62 :9316.9 Mb self._n_features = n_features
  661. distances.mlp_fcn _init_net:63 :9316.9 Mb self.__inited = True
  662. distances.mlp_fcn _check_inputs:33 :9316.9 Mb assert features_a.size()[1:] == features_b.size()[1:] == self._n_features
  663. distances.mlp_base forward:42 :9316.9 Mb if self._attempt_on_forward is True:
  664. distances.mlp_base forward:46 :9316.9 Mb inv_label_cross_ent = self.objective(features_a, features_b, inverse_labels=inv)
  665. distances.mlp objective:21 :9316.9 Mb full_x = torch.cat([features_a, features_b], 0)
  666. distances.mlp objective:23 :9316.9 Mb if self.stored_y is None:
  667. distances.mlp objective:28 :9316.9 Mb _y = self.stored_y
  668. distances.mlp objective:30 :9316.9 Mb full_y = _y if not inverse_labels else (1 - _y)
  669. distances.mlp objective:31 :9316.9 Mb output = self.network_forward(full_x)
  670. distances.mlp_base network_forward:37 :9316.9 Mb return self.net(x)
  671. distances.mlp_fcn forward:17 :9316.9 Mb return X.view(X.size(0), -1)
  672. distances.mlp objective:32 :9316.9 Mb cross_ent = F.binary_cross_entropy(F.sigmoid(output.view(-1)), full_y.view(-1))
  673. distances.mlp objective:33 :9316.9 Mb assert not has_nan(cross_ent)
  674. distances.utils has_nan:83 :9316.9 Mb if type(x) is float:
  675. distances.utils has_nan:86 :9316.9 Mb x = x.data if type(x) is Variable else x
  676. distances.utils has_nan:87 :9316.9 Mb return ((float(torch.sum(x != x)) > 0)
  677. distances.utils has_nan:88 :9316.9 Mb or float(torch.sum(x == np.inf)) > 0)
  678. distances.mlp objective:34 :9316.9 Mb return cross_ent
  679. distances.mlp_base forward:47 :9316.9 Mb return inv_label_cross_ent
  680. distances.utils feature_apply:106 :9316.9 Mb return dist_val
  681. __main__ match_source_target:149 :9316.9 Mb optimizer.zero_grad()
  682. __main__ match_source_target:150 :9316.9 Mb dist_val.backward()
  683. __main__ match_source_target:151 :10620.9Mb optimizer.step()
  684. __main__ match_source_target:154 :10620.9Mb if (batch_idx + 1) % yield_every == 0:
  685. __main__ match_source_target:122 :10620.9Mb for batch_idx, ((source_data, s_y), (target_data, ___)) in tqdm_adaptation_iterator:
  686. __main__ match_source_target:123 :10620.9Mb if source_data.numel == 0:
  687. __main__ match_source_target:127 :10620.9Mb dist_func.current_pos = (epoch_i, batch_idx, batch_idx)
  688. __main__ match_source_target:128 :10620.9Mb dist_func.y_a = s_y
  689. __main__ match_source_target:130 :10620.9Mb data_s = Variable(maybe_cuda(source_data))
  690. start maybe_cuda:85 :10620.9Mb return x.cuda() if torch.cuda.is_available() else x
  691. __main__ match_source_target:131 :10620.9Mb data_t = Variable(maybe_cuda(target_data))
  692. start maybe_cuda:85 :10620.9Mb return x.cuda() if torch.cuda.is_available() else x
  693. __main__ match_source_target:134 :10620.9Mb if discriminator_needs_update is True:
  694. __main__ match_source_target:136 :10620.9Mb feature_apply(partial(dist_func.attempt_update_d, epoch_i=epoch_i),
  695. __main__ match_source_target:137 :10620.9Mb base_model, target_model, data_s, data_t, shift)
  696. distances.utils feature_apply:103 :10620.9Mb a_phi = model_a.features_at(input_a, shift)
  697. model.fcn16 features_at:16 :10620.9Mb assert shift == -3, "!= -3 not implemented, not needed"
  698. model.fcn16 features_at:18 :10620.9Mb h = x
  699. model.fcn16 features_at:19 :10620.9Mb h = self.relu1_1(self.conv1_1(h))
  700. model.fcn16 features_at:20 :10620.9Mb h = self.relu1_2(self.conv1_2(h))
  701. model.fcn16 features_at:21 :10620.9Mb h = self.pool1(h)
  702. model.fcn16 features_at:23 :10620.9Mb h = self.relu2_1(self.conv2_1(h))
  703. model.fcn16 features_at:24 :10620.9Mb h = self.relu2_2(self.conv2_2(h))
  704. model.fcn16 features_at:25 :10620.9Mb h = self.pool2(h)
  705. model.fcn16 features_at:27 :10620.9Mb h = self.relu3_1(self.conv3_1(h))
  706. model.fcn16 features_at:28 :10620.9Mb h = self.relu3_2(self.conv3_2(h))
  707. model.fcn16 features_at:29 :10620.9Mb h = self.relu3_3(self.conv3_3(h))
  708. model.fcn16 features_at:30 :10620.9Mb h = self.pool3(h)
  709. model.fcn16 features_at:32 :10620.9Mb h = self.relu4_1(self.conv4_1(h))
  710. model.fcn16 features_at:33 :10620.9Mb h = self.relu4_2(self.conv4_2(h))
  711. model.fcn16 features_at:34 :10620.9Mb h = self.relu4_3(self.conv4_3(h))
  712. model.fcn16 features_at:35 :10620.9Mb h = self.pool4(h)
  713. model.fcn16 features_at:37 :10620.9Mb h = self.relu5_1(self.conv5_1(h))
  714. model.fcn16 features_at:38 :10620.9Mb h = self.relu5_2(self.conv5_2(h))
  715. model.fcn16 features_at:39 :10620.9Mb h = self.relu5_3(self.conv5_3(h))
  716. model.fcn16 features_at:40 :10620.9Mb h = self.pool5(h)
  717. model.fcn16 features_at:42 :10620.9Mb h = self.relu6(self.fc6(h))
  718. model.fcn16 features_at:43 :10620.9Mb h = self.drop6(h)
  719. model.fcn16 features_at:45 :10620.9Mb h = self.relu7(self.fc7(h))
  720. model.fcn16 features_at:46 :10620.9Mb h = self.drop7(h)
  721. model.fcn16 features_at:48 :10620.9Mb h = self.score_fr(h)
  722. model.fcn16 features_at:50 :10620.9Mb return h
  723. distances.utils feature_apply:104 :10620.9Mb b_phi = model_b.features_at(input_b, shift)
  724. model.fcn16 features_at:16 :10620.9Mb assert shift == -3, "!= -3 not implemented, not needed"
  725. model.fcn16 features_at:18 :10620.9Mb h = x
  726. model.fcn16 features_at:19 :10620.9Mb h = self.relu1_1(self.conv1_1(h))
  727. model.fcn16 features_at:20 :10620.9Mb h = self.relu1_2(self.conv1_2(h))
  728. model.fcn16 features_at:21 :10620.9Mb h = self.pool1(h)
  729. model.fcn16 features_at:23 :10620.9Mb h = self.relu2_1(self.conv2_1(h))
  730. model.fcn16 features_at:24 :10620.9Mb h = self.relu2_2(self.conv2_2(h))
  731. model.fcn16 features_at:25 :10620.9Mb h = self.pool2(h)
  732. model.fcn16 features_at:27 :10620.9Mb h = self.relu3_1(self.conv3_1(h))
  733. model.fcn16 features_at:28 :10620.9Mb h = self.relu3_2(self.conv3_2(h))
  734. model.fcn16 features_at:29 :10620.9Mb h = self.relu3_3(self.conv3_3(h))
  735. model.fcn16 features_at:30 :10620.9Mb h = self.pool3(h)
  736. model.fcn16 features_at:32 :10620.9Mb h = self.relu4_1(self.conv4_1(h))
  737. model.fcn16 features_at:33 :10620.9Mb h = self.relu4_2(self.conv4_2(h))
  738. model.fcn16 features_at:34 :10620.9Mb h = self.relu4_3(self.conv4_3(h))
  739. model.fcn16 features_at:35 :10620.9Mb h = self.pool4(h)
  740. model.fcn16 features_at:37 :10620.9Mb h = self.relu5_1(self.conv5_1(h))
  741. model.fcn16 features_at:38 :10620.9Mb h = self.relu5_2(self.conv5_2(h))
  742. model.fcn16 features_at:39 :10620.9Mb h = self.relu5_3(self.conv5_3(h))
  743. model.fcn16 features_at:40 :10620.9Mb h = self.pool5(h)
  744. model.fcn16 features_at:42 :10620.9Mb h = self.relu6(self.fc6(h))
  745. model.fcn16 features_at:43 :10620.9Mb h = self.drop6(h)
  746. model.fcn16 features_at:45 :10620.9Mb h = self.relu7(self.fc7(h))
  747. model.fcn16 features_at:46 :10620.9Mb h = self.drop7(h)
  748. model.fcn16 features_at:48 :10620.9Mb h = self.score_fr(h)
  749. model.fcn16 features_at:50 :10620.9Mb return h
  750. distances.utils feature_apply:105 :10620.9Mb dist_val = apply_func(a_phi, b_phi)
  751. distances.mlp_base attempt_update_d:62 :10620.9Mb self._check_inputs(features_a, features_b)
  752. distances.mlp_fcn _check_inputs:32 :10620.9Mb self._maybe_init(features_a)
  753. distances.mlp_fcn _maybe_init:28 :10620.9Mb if not self._inited:
  754. distances.mlp_fcn _maybe_init:29 :10620.9Mb self._init_net(some_feature_input.size()[1:])
  755. distances.mlp_fcn _init_net:37 :10620.9Mb if self._shapes is not None:
  756. distances.mlp_fcn _init_net:38 :10620.9Mb used_kern_sizes = (n_features[0],) + tuple(self._shapes['channels'])
  757. distances.mlp_fcn _init_net:39 :10620.9Mb self.cnn_net = self.classifier = nn.Sequential(
  758. distances.mlp_fcn _init_net:40 :10620.9Mb *chain.from_iterable(
  759. distances.mlp_fcn _init_net:41 :10620.9Mb (nn.Conv2d(used_kern_sizes[i], used_kern_sizes[i+1],
  760. distances.mlp_fcn _init_net:45 :10620.9Mb for i in range(len(used_kern_sizes)-1)
  761. distances.mlp_fcn _init_net:47 :10620.9Mb Flatten()
  762. distances.mlp_fcn <genexpr>:41 :10620.9Mb (nn.Conv2d(used_kern_sizes[i], used_kern_sizes[i+1],
  763. distances.mlp_fcn <genexpr>:45 :10620.9Mb for i in range(len(used_kern_sizes)-1)
  764. distances.mlp_fcn <genexpr>:41 :10620.9Mb (nn.Conv2d(used_kern_sizes[i], used_kern_sizes[i+1],
  765. distances.mlp_fcn <genexpr>:45 :10620.9Mb for i in range(len(used_kern_sizes)-1)
  766. distances.mlp_fcn <genexpr>:41 :10620.9Mb (nn.Conv2d(used_kern_sizes[i], used_kern_sizes[i+1],
  767. distances.mlp_fcn _init_net:50 :10620.9Mb test_pass_var = Variable(torch.zeros(1, *n_features), volatile=True).cuda()
  768. distances.mlp_fcn _init_net:51 :10620.9Mb feature_n = self.cnn_net(test_pass_var).size(1) # because [1, F*H*W]
  769. distances.mlp_fcn forward:17 :10620.9Mb return X.view(X.size(0), -1)
  770. distances.mlp_fcn _init_net:52 :10620.9Mb self.net = nn.Sequential(
  771. distances.mlp_fcn _init_net:53 :10620.9Mb self.cnn_net,
  772. distances.mlp_fcn _init_net:54 :10620.9Mb nn.Linear(feature_n, 1)
  773. distances.mlp_fcn _init_net:57 :10620.9Mb for w in self.parameters():
  774. distances.mlp_fcn _init_net:58 :10620.9Mb if w.ndimension() >= 2 and not getattr(w, 'initialized', False):
  775. distances.mlp_fcn _init_net:59 :10620.9Mb self._initializer(w)
  776. distances.mlp_fcn _init_net:57 :10620.9Mb for w in self.parameters():
  777. distances.mlp_fcn _init_net:58 :10620.9Mb if w.ndimension() >= 2 and not getattr(w, 'initialized', False):
  778. distances.mlp_fcn _init_net:57 :10620.9Mb for w in self.parameters():
  779. distances.mlp_fcn _init_net:58 :10620.9Mb if w.ndimension() >= 2 and not getattr(w, 'initialized', False):
  780. distances.mlp_fcn _init_net:59 :10620.9Mb self._initializer(w)
  781. distances.mlp_fcn _init_net:57 :10620.9Mb for w in self.parameters():
  782. distances.mlp_fcn _init_net:58 :10620.9Mb if w.ndimension() >= 2 and not getattr(w, 'initialized', False):
  783. distances.mlp_fcn _init_net:57 :10620.9Mb for w in self.parameters():
  784. distances.mlp_fcn _init_net:58 :10620.9Mb if w.ndimension() >= 2 and not getattr(w, 'initialized', False):
  785. distances.mlp_fcn _init_net:59 :10620.9Mb self._initializer(w)
  786. distances.mlp_fcn _init_net:57 :10620.9Mb for w in self.parameters():
  787. distances.mlp_fcn _init_net:58 :10620.9Mb if w.ndimension() >= 2 and not getattr(w, 'initialized', False):
  788. distances.mlp_fcn _init_net:57 :10620.9Mb for w in self.parameters():
  789. distances.mlp_fcn _init_net:61 :10620.9Mb self._d_optimizer = self._optimizer_builder(self.parameters())
  790. distances.mlp_fcn _init_net:62 :10620.9Mb self._n_features = n_features
  791. distances.mlp_fcn _init_net:63 :10620.9Mb self.__inited = True
  792. distances.mlp_fcn _check_inputs:33 :10620.9Mb assert features_a.size()[1:] == features_b.size()[1:] == self._n_features
  793. distances.mlp_base attempt_update_d:64 :10620.9Mb if self._start_from_n_updates > 0 and epoch_i == 0:
  794. distances.mlp_base attempt_update_d:73 :10620.9Mb if (self._step_every_repeat_n[0] > 0
  795. distances.mlp_base attempt_update_d:74 :10620.9Mb and self._update_attempt_counter % self._step_every_repeat_n[0] == 0):
  796. distances.mlp_base attempt_update_d:75 :10620.9Mb for _ in range(self._step_every_repeat_n[1]):
  797. distances.mlp_base attempt_update_d:76 :10620.9Mb self.d_update_step(features_a, features_b)
  798. distances.mlp_base d_update_step:54 :10620.9Mb cross_ent = self.objective(features_a, features_b)
  799. distances.mlp objective:21 :10620.9Mb full_x = torch.cat([features_a, features_b], 0)
  800. distances.mlp objective:23 :10620.9Mb if self.stored_y is None:
  801. distances.mlp objective:28 :10620.9Mb _y = self.stored_y
  802. distances.mlp objective:30 :10620.9Mb full_y = _y if not inverse_labels else (1 - _y)
  803. distances.mlp objective:31 :10620.9Mb output = self.network_forward(full_x)
  804. distances.mlp_base network_forward:37 :10620.9Mb return self.net(x)
  805. distances.mlp_fcn forward:17 :10620.9Mb return X.view(X.size(0), -1)
  806. distances.mlp objective:32 :10620.9Mb cross_ent = F.binary_cross_entropy(F.sigmoid(output.view(-1)), full_y.view(-1))
  807. distances.mlp objective:33 :10620.9Mb assert not has_nan(cross_ent)
  808. distances.utils has_nan:83 :10620.9Mb if type(x) is float:
  809. distances.utils has_nan:86 :10620.9Mb x = x.data if type(x) is Variable else x
  810. distances.utils has_nan:87 :10620.9Mb return ((float(torch.sum(x != x)) > 0)
  811. distances.utils has_nan:88 :10620.9Mb or float(torch.sum(x == np.inf)) > 0)
  812. distances.mlp objective:34 :10620.9Mb return cross_ent
  813. distances.mlp_base d_update_step:56 :10620.9Mb self._d_optimizer.zero_grad()
  814. distances.mlp_base d_update_step:58 :10620.9Mb cross_ent.backward()
  815. distances.mlp_base d_update_step:59 :11404.9Mb self._d_optimizer.step()
  816. distances.mlp_base attempt_update_d:77 :11404.9Mb self._update_attempt_counter += 1
  817. distances.mlp_base attempt_update_d:75 :11404.9Mb for _ in range(self._step_every_repeat_n[1]):
  818. distances.mlp_base attempt_update_d:78 :11404.9Mb return
  819. distances.utils feature_apply:106 :11404.9Mb return dist_val
  820. __main__ match_source_target:139 :11404.9Mb del data_s, data_t
  821. __main__ match_source_target:140 :11404.9Mb data_s = Variable(maybe_cuda(source_data))
  822. start maybe_cuda:85 :11404.9Mb return x.cuda() if torch.cuda.is_available() else x
  823. __main__ match_source_target:141 :11404.9Mb data_t = Variable(maybe_cuda(target_data))
  824. start maybe_cuda:85 :11404.9Mb return x.cuda() if torch.cuda.is_available() else x
  825. __main__ match_source_target:145 :11404.9Mb if not discriminator_only:
  826. __main__ match_source_target:146 :11404.9Mb dist_val = feature_apply(dist_func,
  827. __main__ match_source_target:147 :11404.9Mb base_model, target_model, data_s, data_t, shift)
  828. distances.utils feature_apply:103 :11404.9Mb a_phi = model_a.features_at(input_a, shift)
  829. model.fcn16 features_at:16 :11404.9Mb assert shift == -3, "!= -3 not implemented, not needed"
  830. model.fcn16 features_at:18 :11404.9Mb h = x
  831. model.fcn16 features_at:19 :11404.9Mb h = self.relu1_1(self.conv1_1(h))
  832. model.fcn16 features_at:20 :11404.9Mb h = self.relu1_2(self.conv1_2(h))
  833. model.fcn16 features_at:21 :11404.9Mb h = self.pool1(h)
  834. model.fcn16 features_at:23 :11404.9Mb h = self.relu2_1(self.conv2_1(h))
  835. model.fcn16 features_at:24 :11404.9Mb h = self.relu2_2(self.conv2_2(h))
  836. model.fcn16 features_at:25 :11404.9Mb h = self.pool2(h)
  837. model.fcn16 features_at:27 :11404.9Mb h = self.relu3_1(self.conv3_1(h))
  838. model.fcn16 features_at:28 :11404.9Mb h = self.relu3_2(self.conv3_2(h))
  839. model.fcn16 features_at:29 :11404.9Mb h = self.relu3_3(self.conv3_3(h))
  840. model.fcn16 features_at:30 :11404.9Mb h = self.pool3(h)
  841. model.fcn16 features_at:32 :11404.9Mb h = self.relu4_1(self.conv4_1(h))
  842. model.fcn16 features_at:33 :11404.9Mb h = self.relu4_2(self.conv4_2(h))
  843. model.fcn16 features_at:34 :11404.9Mb h = self.relu4_3(self.conv4_3(h))
  844. model.fcn16 features_at:35 :11404.9Mb h = self.pool4(h)
  845. model.fcn16 features_at:37 :11404.9Mb h = self.relu5_1(self.conv5_1(h))
  846. model.fcn16 features_at:38 :11404.9Mb h = self.relu5_2(self.conv5_2(h))
  847. model.fcn16 features_at:39 :11404.9Mb h = self.relu5_3(self.conv5_3(h))
  848. model.fcn16 features_at:40 :11404.9Mb h = self.pool5(h)
  849. model.fcn16 features_at:42 :11404.9Mb h = self.relu6(self.fc6(h))
  850. model.fcn16 features_at:43 :11404.9Mb h = self.drop6(h)
  851. model.fcn16 features_at:45 :11404.9Mb h = self.relu7(self.fc7(h))
  852. model.fcn16 features_at:46 :11404.9Mb h = self.drop7(h)
  853. model.fcn16 features_at:48 :11404.9Mb h = self.score_fr(h)
  854. model.fcn16 features_at:50 :11404.9Mb return h
  855. distances.utils feature_apply:104 :11404.9Mb b_phi = model_b.features_at(input_b, shift)
  856. model.fcn16 features_at:16 :11404.9Mb assert shift == -3, "!= -3 not implemented, not needed"
  857. model.fcn16 features_at:18 :11404.9Mb h = x
  858. model.fcn16 features_at:19 :11404.9Mb h = self.relu1_1(self.conv1_1(h))
  859. model.fcn16 features_at:20 :11404.9Mb h = self.relu1_2(self.conv1_2(h))
  860. model.fcn16 features_at:21 :11404.9Mb h = self.pool1(h)
  861. model.fcn16 features_at:23 :11404.9Mb h = self.relu2_1(self.conv2_1(h))
  862. model.fcn16 features_at:24 :11404.9Mb h = self.relu2_2(self.conv2_2(h))
  863. model.fcn16 features_at:25 :11404.9Mb h = self.pool2(h)
  864. model.fcn16 features_at:27 :11404.9Mb h = self.relu3_1(self.conv3_1(h))
  865. model.fcn16 features_at:28 :11404.9Mb h = self.relu3_2(self.conv3_2(h))
  866. model.fcn16 features_at:29 :11404.9Mb h = self.relu3_3(self.conv3_3(h))
  867. model.fcn16 features_at:30 :11404.9Mb h = self.pool3(h)
  868. model.fcn16 features_at:32 :11404.9Mb h = self.relu4_1(self.conv4_1(h))
  869. model.fcn16 features_at:33 :11404.9Mb h = self.relu4_2(self.conv4_2(h))
  870. model.fcn16 features_at:34 :11404.9Mb h = self.relu4_3(self.conv4_3(h))
  871. model.fcn16 features_at:35 :11404.9Mb h = self.pool4(h)
  872. model.fcn16 features_at:37 :11404.9Mb h = self.relu5_1(self.conv5_1(h))
  873. model.fcn16 features_at:38 :11404.9Mb h = self.relu5_2(self.conv5_2(h))
  874. model.fcn16 features_at:39 :11404.9Mb h = self.relu5_3(self.conv5_3(h))
  875. model.fcn16 features_at:40 :11404.9Mb h = self.pool5(h)
  876. model.fcn16 features_at:42 :11404.9Mb h = self.relu6(self.fc6(h))
  877. model.fcn16 features_at:43 :11404.9Mb h = self.drop6(h)
  878. model.fcn16 features_at:45 :11404.9Mb h = self.relu7(self.fc7(h))
  879. model.fcn16 features_at:46 :11404.9Mb h = self.drop7(h)
  880. model.fcn16 features_at:48 :11404.9Mb h = self.score_fr(h)
  881. model.fcn16 features_at:50 :11404.9Mb return h
  882. distances.utils feature_apply:105 :11404.9Mb dist_val = apply_func(a_phi, b_phi)
  883. distances.mlp_base forward:40 :11404.9Mb self._check_inputs(features_a, features_b)
  884. distances.mlp_fcn _check_inputs:32 :11404.9Mb self._maybe_init(features_a)
  885. distances.mlp_fcn _maybe_init:28 :11404.9Mb if not self._inited:
  886. distances.mlp_fcn _maybe_init:29 :11404.9Mb self._init_net(some_feature_input.size()[1:])
  887. distances.mlp_fcn _init_net:37 :11404.9Mb if self._shapes is not None:
  888. distances.mlp_fcn _init_net:38 :11404.9Mb used_kern_sizes = (n_features[0],) + tuple(self._shapes['channels'])
  889. distances.mlp_fcn _init_net:39 :11404.9Mb self.cnn_net = self.classifier = nn.Sequential(
  890. distances.mlp_fcn _init_net:40 :11404.9Mb *chain.from_iterable(
  891. distances.mlp_fcn _init_net:41 :11404.9Mb (nn.Conv2d(used_kern_sizes[i], used_kern_sizes[i+1],
  892. distances.mlp_fcn _init_net:45 :11404.9Mb for i in range(len(used_kern_sizes)-1)
  893. distances.mlp_fcn _init_net:47 :11404.9Mb Flatten()
  894. distances.mlp_fcn <genexpr>:41 :11404.9Mb (nn.Conv2d(used_kern_sizes[i], used_kern_sizes[i+1],
  895. distances.mlp_fcn <genexpr>:45 :11404.9Mb for i in range(len(used_kern_sizes)-1)
  896. distances.mlp_fcn <genexpr>:41 :11404.9Mb (nn.Conv2d(used_kern_sizes[i], used_kern_sizes[i+1],
  897. distances.mlp_fcn <genexpr>:45 :11404.9Mb for i in range(len(used_kern_sizes)-1)
  898. distances.mlp_fcn <genexpr>:41 :11404.9Mb (nn.Conv2d(used_kern_sizes[i], used_kern_sizes[i+1],
  899. distances.mlp_fcn _init_net:50 :11404.9Mb test_pass_var = Variable(torch.zeros(1, *n_features), volatile=True).cuda()
  900. distances.mlp_fcn _init_net:51 :11404.9Mb feature_n = self.cnn_net(test_pass_var).size(1) # because [1, F*H*W]
  901. distances.mlp_fcn forward:17 :11404.9Mb return X.view(X.size(0), -1)
  902. distances.mlp_fcn _init_net:52 :11404.9Mb self.net = nn.Sequential(
  903. distances.mlp_fcn _init_net:53 :11404.9Mb self.cnn_net,
  904. distances.mlp_fcn _init_net:54 :11404.9Mb nn.Linear(feature_n, 1)
  905. distances.mlp_fcn _init_net:57 :11404.9Mb for w in self.parameters():
  906. distances.mlp_fcn _init_net:58 :11404.9Mb if w.ndimension() >= 2 and not getattr(w, 'initialized', False):
  907. distances.mlp_fcn _init_net:59 :11404.9Mb self._initializer(w)
  908. distances.mlp_fcn _init_net:57 :11404.9Mb for w in self.parameters():
  909. distances.mlp_fcn _init_net:58 :11404.9Mb if w.ndimension() >= 2 and not getattr(w, 'initialized', False):
  910. distances.mlp_fcn _init_net:57 :11404.9Mb for w in self.parameters():
  911. distances.mlp_fcn _init_net:58 :11404.9Mb if w.ndimension() >= 2 and not getattr(w, 'initialized', False):
  912. distances.mlp_fcn _init_net:59 :11404.9Mb self._initializer(w)
  913. distances.mlp_fcn _init_net:57 :11404.9Mb for w in self.parameters():
  914. distances.mlp_fcn _init_net:58 :11404.9Mb if w.ndimension() >= 2 and not getattr(w, 'initialized', False):
  915. distances.mlp_fcn _init_net:57 :11404.9Mb for w in self.parameters():
  916. distances.mlp_fcn _init_net:58 :11404.9Mb if w.ndimension() >= 2 and not getattr(w, 'initialized', False):
  917. distances.mlp_fcn _init_net:59 :11404.9Mb self._initializer(w)
  918. distances.mlp_fcn _init_net:57 :11404.9Mb for w in self.parameters():
  919. distances.mlp_fcn _init_net:58 :11404.9Mb if w.ndimension() >= 2 and not getattr(w, 'initialized', False):
  920. distances.mlp_fcn _init_net:57 :11404.9Mb for w in self.parameters():
  921. distances.mlp_fcn _init_net:61 :11404.9Mb self._d_optimizer = self._optimizer_builder(self.parameters())
  922. distances.mlp_fcn _init_net:62 :11404.9Mb self._n_features = n_features
  923. distances.mlp_fcn _init_net:63 :11404.9Mb self.__inited = True
  924. distances.mlp_fcn _check_inputs:33 :11404.9Mb assert features_a.size()[1:] == features_b.size()[1:] == self._n_features
  925. distances.mlp_base forward:42 :11404.9Mb if self._attempt_on_forward is True:
  926. distances.mlp_base forward:46 :11404.9Mb inv_label_cross_ent = self.objective(features_a, features_b, inverse_labels=inv)
  927. distances.mlp objective:21 :11404.9Mb full_x = torch.cat([features_a, features_b], 0)
  928. distances.mlp objective:23 :11404.9Mb if self.stored_y is None:
  929. distances.mlp objective:28 :11404.9Mb _y = self.stored_y
  930. distances.mlp objective:30 :11404.9Mb full_y = _y if not inverse_labels else (1 - _y)
  931. distances.mlp objective:31 :11404.9Mb output = self.network_forward(full_x)
  932. distances.mlp_base network_forward:37 :11404.9Mb return self.net(x)
  933. distances.mlp_fcn forward:17 :11404.9Mb return X.view(X.size(0), -1)
  934. distances.mlp objective:32 :11404.9Mb cross_ent = F.binary_cross_entropy(F.sigmoid(output.view(-1)), full_y.view(-1))
  935. distances.mlp objective:33 :11404.9Mb assert not has_nan(cross_ent)
  936. distances.utils has_nan:83 :11404.9Mb if type(x) is float:
  937. distances.utils has_nan:86 :11404.9Mb x = x.data if type(x) is Variable else x
  938. distances.utils has_nan:87 :11404.9Mb return ((float(torch.sum(x != x)) > 0)
  939. distances.utils has_nan:88 :11404.9Mb or float(torch.sum(x == np.inf)) > 0)
  940. distances.mlp objective:34 :11404.9Mb return cross_ent
  941. distances.mlp_base forward:47 :11404.9Mb return inv_label_cross_ent
  942. distances.utils feature_apply:106 :11404.9Mb return dist_val
  943. __main__ match_source_target:149 :11404.9Mb optimizer.zero_grad()
  944. __main__ match_source_target:150 :11404.9Mb dist_val.backward()
  945. __main__ match_source_target:151 :11796.9Mb optimizer.step()
  946. __main__ match_source_target:154 :11796.9Mb if (batch_idx + 1) % yield_every == 0:
  947. __main__ match_source_target:122 :11796.9Mb for batch_idx, ((source_data, s_y), (target_data, ___)) in tqdm_adaptation_iterator:
  948. __main__ match_source_target:123 :11796.9Mb if source_data.numel == 0:
  949. __main__ match_source_target:127 :11796.9Mb dist_func.current_pos = (epoch_i, batch_idx, batch_idx)
  950. __main__ match_source_target:128 :11796.9Mb dist_func.y_a = s_y
  951. __main__ match_source_target:130 :11796.9Mb data_s = Variable(maybe_cuda(source_data))
  952. start maybe_cuda:85 :11796.9Mb return x.cuda() if torch.cuda.is_available() else x
  953. __main__ match_source_target:131 :11796.9Mb data_t = Variable(maybe_cuda(target_data))
  954. start maybe_cuda:85 :11796.9Mb return x.cuda() if torch.cuda.is_available() else x
  955. __main__ match_source_target:134 :11796.9Mb if discriminator_needs_update is True:
  956. __main__ match_source_target:136 :11796.9Mb feature_apply(partial(dist_func.attempt_update_d, epoch_i=epoch_i),
  957. __main__ match_source_target:137 :11796.9Mb base_model, target_model, data_s, data_t, shift)
  958. distances.utils feature_apply:103 :11796.9Mb a_phi = model_a.features_at(input_a, shift)
  959. model.fcn16 features_at:16 :11796.9Mb assert shift == -3, "!= -3 not implemented, not needed"
  960. model.fcn16 features_at:18 :11796.9Mb h = x
  961. model.fcn16 features_at:19 :11796.9Mb h = self.relu1_1(self.conv1_1(h))
  962. model.fcn16 features_at:20 :11796.9Mb h = self.relu1_2(self.conv1_2(h))
  963. model.fcn16 features_at:21 :11796.9Mb h = self.pool1(h)
  964. model.fcn16 features_at:23 :11796.9Mb h = self.relu2_1(self.conv2_1(h))
  965. model.fcn16 features_at:24 :11796.9Mb h = self.relu2_2(self.conv2_2(h))
  966. model.fcn16 features_at:25 :11796.9Mb h = self.pool2(h)
  967. model.fcn16 features_at:27 :11796.9Mb h = self.relu3_1(self.conv3_1(h))
  968. model.fcn16 features_at:28 :11796.9Mb h = self.relu3_2(self.conv3_2(h))
  969. model.fcn16 features_at:29 :11796.9Mb h = self.relu3_3(self.conv3_3(h))
  970. model.fcn16 features_at:30 :11796.9Mb h = self.pool3(h)
  971. model.fcn16 features_at:32 :11796.9Mb h = self.relu4_1(self.conv4_1(h))
  972. model.fcn16 features_at:33 :11796.9Mb h = self.relu4_2(self.conv4_2(h))
  973. model.fcn16 features_at:34 :11796.9Mb h = self.relu4_3(self.conv4_3(h))
  974. model.fcn16 features_at:35 :11796.9Mb h = self.pool4(h)
  975. model.fcn16 features_at:37 :11796.9Mb h = self.relu5_1(self.conv5_1(h))
  976. model.fcn16 features_at:38 :11796.9Mb h = self.relu5_2(self.conv5_2(h))
  977. model.fcn16 features_at:39 :11796.9Mb h = self.relu5_3(self.conv5_3(h))
  978. model.fcn16 features_at:40 :11796.9Mb h = self.pool5(h)
  979. model.fcn16 features_at:42 :11796.9Mb h = self.relu6(self.fc6(h))
  980. model.fcn16 features_at:43 :11796.9Mb h = self.drop6(h)
  981. model.fcn16 features_at:45 :11796.9Mb h = self.relu7(self.fc7(h))
  982. model.fcn16 features_at:46 :11796.9Mb h = self.drop7(h)
  983. model.fcn16 features_at:48 :11796.9Mb h = self.score_fr(h)
  984. model.fcn16 features_at:50 :11796.9Mb return h
  985. distances.utils feature_apply:104 :11796.9Mb b_phi = model_b.features_at(input_b, shift)
  986. model.fcn16 features_at:16 :11796.9Mb assert shift == -3, "!= -3 not implemented, not needed"
  987. model.fcn16 features_at:18 :11796.9Mb h = x
  988. model.fcn16 features_at:19 :11796.9Mb h = self.relu1_1(self.conv1_1(h))
  989. model.fcn16 features_at:20 :11796.9Mb h = self.relu1_2(self.conv1_2(h))
  990. model.fcn16 features_at:21 :11796.9Mb h = self.pool1(h)
  991. model.fcn16 features_at:23 :11796.9Mb h = self.relu2_1(self.conv2_1(h))
  992. model.fcn16 features_at:24 :11796.9Mb h = self.relu2_2(self.conv2_2(h))
  993. model.fcn16 features_at:25 :11796.9Mb h = self.pool2(h)
  994. model.fcn16 features_at:27 :11796.9Mb h = self.relu3_1(self.conv3_1(h))
  995. model.fcn16 features_at:28 :11796.9Mb h = self.relu3_2(self.conv3_2(h))
  996. model.fcn16 features_at:29 :11796.9Mb h = self.relu3_3(self.conv3_3(h))
  997. model.fcn16 features_at:30 :11796.9Mb h = self.pool3(h)
  998. model.fcn16 features_at:32 :11796.9Mb h = self.relu4_1(self.conv4_1(h))
  999. model.fcn16 features_at:33 :11796.9Mb h = self.relu4_2(self.conv4_2(h))
  1000. model.fcn16 features_at:34 :11796.9Mb h = self.relu4_3(self.conv4_3(h))
  1001. model.fcn16 features_at:35 :11796.9Mb h = self.pool4(h)
  1002. model.fcn16 features_at:37 :11796.9Mb h = self.relu5_1(self.conv5_1(h))
  1003. model.fcn16 features_at:38 :11796.9Mb h = self.relu5_2(self.conv5_2(h))
  1004. model.fcn16 features_at:39 :11796.9Mb h = self.relu5_3(self.conv5_3(h))
  1005. model.fcn16 features_at:40 :11796.9Mb h = self.pool5(h)
  1006. model.fcn16 features_at:42 :11796.9Mb h = self.relu6(self.fc6(h))
  1007. model.fcn16 features_at:43 :11796.9Mb h = self.drop6(h)
  1008. model.fcn16 features_at:45 :11796.9Mb h = self.relu7(self.fc7(h))
  1009. model.fcn16 features_at:46 :11796.9Mb h = self.drop7(h)
  1010. model.fcn16 features_at:48 :11796.9Mb h = self.score_fr(h)
  1011. model.fcn16 features_at:50 :11796.9Mb return h
  1012. distances.utils feature_apply:105 :11796.9Mb dist_val = apply_func(a_phi, b_phi)
  1013. distances.mlp_base attempt_update_d:62 :11796.9Mb self._check_inputs(features_a, features_b)
  1014. distances.mlp_fcn _check_inputs:32 :11796.9Mb self._maybe_init(features_a)
  1015. distances.mlp_fcn _maybe_init:28 :11796.9Mb if not self._inited:
  1016. distances.mlp_fcn _maybe_init:29 :11796.9Mb self._init_net(some_feature_input.size()[1:])
  1017. distances.mlp_fcn _init_net:37 :11796.9Mb if self._shapes is not None:
  1018. distances.mlp_fcn _init_net:38 :11796.9Mb used_kern_sizes = (n_features[0],) + tuple(self._shapes['channels'])
  1019. distances.mlp_fcn _init_net:39 :11796.9Mb self.cnn_net = self.classifier = nn.Sequential(
  1020. distances.mlp_fcn _init_net:40 :11796.9Mb *chain.from_iterable(
  1021. distances.mlp_fcn _init_net:41 :11796.9Mb (nn.Conv2d(used_kern_sizes[i], used_kern_sizes[i+1],
  1022. distances.mlp_fcn _init_net:45 :11796.9Mb for i in range(len(used_kern_sizes)-1)
  1023. distances.mlp_fcn _init_net:47 :11796.9Mb Flatten()
  1024. distances.mlp_fcn <genexpr>:41 :11796.9Mb (nn.Conv2d(used_kern_sizes[i], used_kern_sizes[i+1],
  1025. distances.mlp_fcn <genexpr>:45 :11796.9Mb for i in range(len(used_kern_sizes)-1)
  1026. distances.mlp_fcn <genexpr>:41 :11796.9Mb (nn.Conv2d(used_kern_sizes[i], used_kern_sizes[i+1],
  1027. distances.mlp_fcn <genexpr>:45 :11796.9Mb for i in range(len(used_kern_sizes)-1)
  1028. distances.mlp_fcn <genexpr>:41 :11796.9Mb (nn.Conv2d(used_kern_sizes[i], used_kern_sizes[i+1],
  1029. distances.mlp_fcn _init_net:50 :11796.9Mb test_pass_var = Variable(torch.zeros(1, *n_features), volatile=True).cuda()
  1030. distances.mlp_fcn _init_net:51 :11796.9Mb feature_n = self.cnn_net(test_pass_var).size(1) # because [1, F*H*W]
  1031. distances.mlp_fcn forward:17 :11796.9Mb return X.view(X.size(0), -1)
  1032. distances.mlp_fcn _init_net:52 :11796.9Mb self.net = nn.Sequential(
  1033. distances.mlp_fcn _init_net:53 :11796.9Mb self.cnn_net,
  1034. distances.mlp_fcn _init_net:54 :11796.9Mb nn.Linear(feature_n, 1)
  1035. distances.mlp_fcn _init_net:57 :11796.9Mb for w in self.parameters():
  1036. distances.mlp_fcn _init_net:58 :11796.9Mb if w.ndimension() >= 2 and not getattr(w, 'initialized', False):
  1037. distances.mlp_fcn _init_net:59 :11796.9Mb self._initializer(w)
  1038. distances.mlp_fcn _init_net:57 :11796.9Mb for w in self.parameters():
  1039. distances.mlp_fcn _init_net:58 :11796.9Mb if w.ndimension() >= 2 and not getattr(w, 'initialized', False):
  1040. distances.mlp_fcn _init_net:57 :11796.9Mb for w in self.parameters():
  1041. distances.mlp_fcn _init_net:58 :11796.9Mb if w.ndimension() >= 2 and not getattr(w, 'initialized', False):
  1042. distances.mlp_fcn _init_net:59 :11796.9Mb self._initializer(w)
  1043. distances.mlp_fcn _init_net:57 :11796.9Mb for w in self.parameters():
  1044. distances.mlp_fcn _init_net:58 :11796.9Mb if w.ndimension() >= 2 and not getattr(w, 'initialized', False):
  1045. distances.mlp_fcn _init_net:57 :11796.9Mb for w in self.parameters():
  1046. distances.mlp_fcn _init_net:58 :11796.9Mb if w.ndimension() >= 2 and not getattr(w, 'initialized', False):
  1047. distances.mlp_fcn _init_net:59 :11796.9Mb self._initializer(w)
  1048. distances.mlp_fcn _init_net:57 :11796.9Mb for w in self.parameters():
  1049. distances.mlp_fcn _init_net:58 :11796.9Mb if w.ndimension() >= 2 and not getattr(w, 'initialized', False):
  1050. distances.mlp_fcn _init_net:57 :11796.9Mb for w in self.parameters():
  1051. distances.mlp_fcn _init_net:61 :11796.9Mb self._d_optimizer = self._optimizer_builder(self.parameters())
  1052. distances.mlp_fcn _init_net:62 :11796.9Mb self._n_features = n_features
  1053. distances.mlp_fcn _init_net:63 :11796.9Mb self.__inited = True
  1054. distances.mlp_fcn _check_inputs:33 :11796.9Mb assert features_a.size()[1:] == features_b.size()[1:] == self._n_features
  1055. distances.mlp_base attempt_update_d:64 :11796.9Mb if self._start_from_n_updates > 0 and epoch_i == 0:
  1056. distances.mlp_base attempt_update_d:73 :11796.9Mb if (self._step_every_repeat_n[0] > 0
  1057. distances.mlp_base attempt_update_d:74 :11796.9Mb and self._update_attempt_counter % self._step_every_repeat_n[0] == 0):
  1058. distances.mlp_base attempt_update_d:75 :11796.9Mb for _ in range(self._step_every_repeat_n[1]):
  1059. distances.mlp_base attempt_update_d:76 :11796.9Mb self.d_update_step(features_a, features_b)
  1060. distances.mlp_base d_update_step:54 :11796.9Mb cross_ent = self.objective(features_a, features_b)
  1061. distances.mlp objective:21 :11796.9Mb full_x = torch.cat([features_a, features_b], 0)
  1062. distances.mlp objective:23 :11796.9Mb if self.stored_y is None:
  1063. distances.mlp objective:28 :11796.9Mb _y = self.stored_y
  1064. distances.mlp objective:30 :11796.9Mb full_y = _y if not inverse_labels else (1 - _y)
  1065. distances.mlp objective:31 :11796.9Mb output = self.network_forward(full_x)
  1066. distances.mlp_base network_forward:37 :11796.9Mb return self.net(x)
  1067. distances.mlp_fcn forward:17 :11796.9Mb return X.view(X.size(0), -1)
  1068. distances.mlp objective:32 :11796.9Mb cross_ent = F.binary_cross_entropy(F.sigmoid(output.view(-1)), full_y.view(-1))
  1069. distances.mlp objective:33 :11796.9Mb assert not has_nan(cross_ent)
  1070. distances.utils has_nan:83 :11796.9Mb if type(x) is float:
  1071. distances.utils has_nan:86 :11796.9Mb x = x.data if type(x) is Variable else x
  1072. distances.utils has_nan:87 :11796.9Mb return ((float(torch.sum(x != x)) > 0)
  1073. distances.utils has_nan:88 :11796.9Mb or float(torch.sum(x == np.inf)) > 0)
  1074. distances.mlp objective:34 :11796.9Mb return cross_ent
  1075. distances.mlp_base d_update_step:56 :11796.9Mb self._d_optimizer.zero_grad()
  1076. distances.mlp_base d_update_step:58 :11796.9Mb cross_ent.backward()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement