Skip to content

Instantly share code, notes, and snippets.

@cossio
Created June 15, 2020 09:36
Show Gist options
  • Save cossio/0227f3b048f7505691a2c84b7f19d9f2 to your computer and use it in GitHub Desktop.
Save cossio/0227f3b048f7505691a2c84b7f19d9f2 to your computer and use it in GitHub Desktop.
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-3-dc0f2ac96f27> in <module>
15 RBM.fit(all_data[in_train][order_train], weights= all_weights[in_train][order_train], batch_size = batch_size,
16 n_iter = n_iter, l1b = l1b, N_MC = N_MC,
---> 17 decay_after = decay_after, verbose = 0,vverbose=1 )
~/work/PGM/source/rbm.py in fit(self, data, batch_size, learning_rate, extra_params, init, optimizer, batch_norm, CD, N_PT, N_MC, nchains, n_iter, MoI, MoI_h, MoI_tau, PTv, PTh, interpolate_z, degree_interpolate_z, zero_track_RBM, only_sampling, lr_decay, lr_final, decay_after, l1, l1b, l1c, l2, l2_fields, reg_delta, no_fields, weights, adapt_PT, AR_min, adapt_MC, tau_max, update_every, N_PT_max, N_MC_max, from_hidden, learning_rate_multiplier, update_betas, record_acceptance, shuffle_data, epsilon, verbose, vverbose, record, record_interval, data_test, weights_test, l1_custom, l1b_custom, M_AIS, n_betas_AIS, decay_style)
704 self.n_v, self.visible, c=self.n_cv)
705 else:
--> 706 self.fantasy_v = self.vlayer.random_init_config(self.nchains)
707 self.fantasy_h = self.hlayer.random_init_config(self.nchains)
708
~/work/PGM/source/layer.py in random_init_config(self, n_samples, N_PT)
257 return self.sample_from_inputs(np.zeros([N_PT * n_samples, self.N, self.n_c], dtype=curr_float), beta=0).reshape([N_PT, n_samples, self.N])
258 else:
--> 259 return self.sample_from_inputs(np.zeros([n_samples, self.N, self.n_c], dtype=curr_float), beta=0).reshape([n_samples, self.N])
260
261 elif self.nature in ['Bernoulli_coupled', 'Spin_coupled']:
~/work/PGM/source/layer.py in sample_from_inputs(self, I, I0, beta, out, **kwargs)
582 else:
583 cy_utilities.sample_from_inputs_Potts_numba2(
--> 584 I, self._fields[0, :, :], out)
585 return out
586
~/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in _compile_for_args(self, *args, **kws)
418 e.patch_message('\n'.join((str(e).rstrip(), help_msg)))
419 # ignore the FULL_TRACEBACKS config, this needs reporting!
--> 420 raise e
421
422 def inspect_llvm(self, signature=None):
~/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in _compile_for_args(self, *args, **kws)
351 argtypes.append(self.typeof_pyval(a))
352 try:
--> 353 return self.compile(tuple(argtypes))
354 except errors.ForceLiteralArg as e:
355 # Received request for compiler re-entry with the list of arguments
~/anaconda3/lib/python3.7/site-packages/numba/compiler_lock.py in _acquire_compile_lock(*args, **kwargs)
30 def _acquire_compile_lock(*args, **kwargs):
31 with self:
---> 32 return func(*args, **kwargs)
33 return _acquire_compile_lock
34
~/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in compile(self, sig)
766 self._cache_misses[sig] += 1
767 try:
--> 768 cres = self._compiler.compile(args, return_type)
769 except errors.ForceLiteralArg as e:
770 def folded(args, kws):
~/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in compile(self, args, return_type)
75
76 def compile(self, args, return_type):
---> 77 status, retval = self._compile_cached(args, return_type)
78 if status:
79 return retval
~/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in _compile_cached(self, args, return_type)
89
90 try:
---> 91 retval = self._compile_core(args, return_type)
92 except errors.TypingError as e:
93 self._failed_cache[key] = e
~/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in _compile_core(self, args, return_type)
107 args=args, return_type=return_type,
108 flags=flags, locals=self.locals,
--> 109 pipeline_class=self.pipeline_class)
110 # Check typing error if object mode is used
111 if cres.typing_error is not None and not flags.enable_pyobject:
~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in compile_extra(typingctx, targetctx, func, args, return_type, flags, locals, library, pipeline_class)
549 pipeline = pipeline_class(typingctx, targetctx, library,
550 args, return_type, flags, locals)
--> 551 return pipeline.compile_extra(func)
552
553
~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in compile_extra(self, func)
329 self.state.lifted = ()
330 self.state.lifted_from = None
--> 331 return self._compile_bytecode()
332
333 def compile_ir(self, func_ir, lifted=(), lifted_from=None):
~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in _compile_bytecode(self)
391 """
392 assert self.state.func_ir is None
--> 393 return self._compile_core()
394
395 def _compile_ir(self):
~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in _compile_core(self)
371 self.state.status.fail_reason = e
372 if is_final_pipeline:
--> 373 raise e
374 else:
375 raise CompilerError("All available pipelines exhausted")
~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in _compile_core(self)
362 res = None
363 try:
--> 364 pm.run(self.state)
365 if self.state.cr is not None:
366 break
~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in run(self, state)
345 (self.pipeline_name, pass_desc)
346 patched_exception = self._patch_error(msg, e)
--> 347 raise patched_exception
348
349 def dependency_analysis(self):
~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in run(self, state)
336 pass_inst = _pass_registry.get(pss).pass_inst
337 if isinstance(pass_inst, CompilerPass):
--> 338 self._runPass(idx, pass_inst, state)
339 else:
340 raise BaseException("Legacy pass in use")
~/anaconda3/lib/python3.7/site-packages/numba/compiler_lock.py in _acquire_compile_lock(*args, **kwargs)
30 def _acquire_compile_lock(*args, **kwargs):
31 with self:
---> 32 return func(*args, **kwargs)
33 return _acquire_compile_lock
34
~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in _runPass(self, index, pss, internal_state)
300 mutated |= check(pss.run_initialization, internal_state)
301 with SimpleTimer() as pass_time:
--> 302 mutated |= check(pss.run_pass, internal_state)
303 with SimpleTimer() as finalize_time:
304 mutated |= check(pss.run_finalizer, internal_state)
~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in check(func, compiler_state)
273
274 def check(func, compiler_state):
--> 275 mangled = func(compiler_state)
276 if mangled not in (True, False):
277 msg = ("CompilerPass implementations should return True/False. "
~/anaconda3/lib/python3.7/site-packages/numba/typed_passes.py in run_pass(self, state)
267 state.flags,
268 state.parfor_diagnostics)
--> 269 parfor_pass.run()
270
271 # check the parfor pass worked and warn if it didn't
~/anaconda3/lib/python3.7/site-packages/numba/parfor.py in run(self)
1498 # run array analysis, a pre-requisite for parfor translation
1499 remove_dels(self.func_ir.blocks)
-> 1500 self.array_analysis.run(self.func_ir.blocks)
1501 # run stencil translation to parfor
1502 if self.options.stencil:
~/anaconda3/lib/python3.7/site-packages/numba/array_analysis.py in run(self, blocks, equiv_set)
1076 inst = ir.SetItem(inst.target, inst.index_var, inst.value, inst.loc)
1077 self.calltypes[inst] = orig_calltype
-> 1078 pre, post = self._analyze_inst(label, scope, equiv_set, inst, redefined)
1079 # Remove anything multiply defined in this block from every block equivs.
1080 if len(redefined) > 0:
~/anaconda3/lib/python3.7/site-packages/numba/array_analysis.py in _analyze_inst(self, label, scope, equiv_set, inst, redefined)
1119 shape = ()
1120 elif isinstance(inst.value, ir.Expr):
-> 1121 result = self._analyze_expr(scope, equiv_set, inst.value)
1122 if result:
1123 shape = result[0]
~/anaconda3/lib/python3.7/site-packages/numba/array_analysis.py in _analyze_expr(self, scope, equiv_set, expr)
1294 except AttributeError:
1295 return None
-> 1296 return guard(fn, scope, equiv_set, expr)
1297
1298 def _analyze_op_getattr(self, scope, equiv_set, expr):
~/anaconda3/lib/python3.7/site-packages/numba/ir_utils.py in guard(func, *args, **kwargs)
1435 """
1436 try:
-> 1437 return func(*args, **kwargs)
1438 except GuardException:
1439 return None
~/anaconda3/lib/python3.7/site-packages/numba/array_analysis.py in _analyze_op_inplace_binop(self, scope, equiv_set, expr)
1703 def _analyze_op_inplace_binop(self, scope, equiv_set, expr):
1704 require(expr.fn in INPLACE_BINARY_MAP_OP)
-> 1705 return self._analyze_broadcast(scope, equiv_set, expr.loc, [expr.lhs, expr.rhs])
1706
1707 def _analyze_op_arrayexpr(self, scope, equiv_set, expr):
~/anaconda3/lib/python3.7/site-packages/numba/array_analysis.py in _analyze_broadcast(self, scope, equiv_set, loc, args)
2285 except GuardException:
2286 return arrs[0], self._call_assert_equiv(scope, loc, equiv_set, arrs)
-> 2287 return self._broadcast_assert_shapes(scope, equiv_set, loc, shapes, names)
2288
2289 def _broadcast_assert_shapes(self, scope, equiv_set, loc, shapes, names):
~/anaconda3/lib/python3.7/site-packages/numba/array_analysis.py in _broadcast_assert_shapes(self, scope, equiv_set, loc, shapes, names)
2293 asserts = []
2294 new_shape = []
-> 2295 max_dim = max([len(shape) for shape in shapes])
2296 const_size_one = None
2297 for i in range(max_dim):
~/anaconda3/lib/python3.7/site-packages/numba/array_analysis.py in <listcomp>(.0)
2293 asserts = []
2294 new_shape = []
-> 2295 max_dim = max([len(shape) for shape in shapes])
2296 const_size_one = None
2297 for i in range(max_dim):
TypeError: Failed in nopython mode pipeline (step: convert to parfors)
object of type 'NoneType' has no len()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment