Reputation: 27
This is the code which has some problem:
symbol_returns[i*num_samples + sample_iter] = tf.multiply(tf.cast(pos[i*num_samples + sample_iter], np.float32), y_[:,i])
daily_returns_by_symbol_ = tf.concat( [tf.reshape(t, [-1,1],1) for t in symbol_returns.values()])
But there is some error, and I have no idea how to solve it.
Traceback (most recent call last):
File "neural_net_exec.py", line 129, in <module>
daily_returns_by_symbol_ = tf.concat( [tf.reshape(t, [-1,1],1) for t in symbol_returns.values()])
File "neural_net_exec.py", line 129, in <listcomp>
daily_returns_by_symbol_ = tf.concat( [tf.reshape(t, [-1,1],1) for t in symbol_returns.values()])
File "/anaconda/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/ops/gen_array_ops.py", line 2619, in reshape
name=name)
File "/anaconda/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 374, in apply_op
with g.as_default(), ops.name_scope(name) as scope:
File "/anaconda/envs/tensorflow/lib/python3.5/contextlib.py", line 59, in __enter__
return next(self.gen)
File "/anaconda/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 4522, in name_scope
with g.as_default(), g.name_scope(n) as scope:
File "/anaconda/envs/tensorflow/lib/python3.5/contextlib.py", line 59, in __enter__
return next(self.gen)
File "/anaconda/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 3171, in name_scope
if not _VALID_OP_NAME_REGEX.match(name):
TypeError: expected string or bytes-like object
Upvotes: 0
Views: 1875
Reputation: 922
The third argument to tf.reshape
, which is optional, should be a string; you have used an integer (i.e., 1
) as the third argument to tf.reshape
, hence the error message.
Upvotes: 2