Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue with the api use #10

Open
verazuo opened this issue Nov 7, 2017 · 2 comments
Open

issue with the api use #10

verazuo opened this issue Nov 7, 2017 · 2 comments

Comments

@verazuo
Copy link

verazuo commented Nov 7, 2017

att = tf.batch_matmul(a_til_concat, til_bl_3dim, adj_y = True)

Hello, I am running the code in Windows10.
And I met a error in this line.
Below is the error report

Traceback (most recent call last):
  File "main.py", line 76, in <module>
    tf.app.run()
  File "C:\Users\verazuo\Anaconda3\lib\site-packages\tensorflow\python\platform\app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "main.py", line 72, in main
    model.build_model()
  File "C:\Users\verazuo\Desktop\practice\mood\undefined-algorithm\mem_absa2\model.py", line 107, in build_model
    self.build_memory()
  File "C:\Users\verazuo\Desktop\practice\mood\undefined-algorithm\mem_absa2\model.py", line 82, in build_memory
    att = tf.batch_matmul(a_til_concat, til_bl_3dim, adj_y = True)
AttributeError: module 'tensorflow' has no attribute 'batch_matmul'

I try to change the batch_matmul to matmul based on this issue of tf
Then I met this error below.

Traceback (most recent call last):
  File "main.py", line 76, in <module>
    tf.app.run()
  File "C:\Users\verazuo\Anaconda3\lib\site-packages\tensorflow\python\platform\app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "main.py", line 72, in main
    model.build_model()
  File "C:\Users\verazuo\Desktop\practice\mood\undefined-algorithm\mem_absa-master\model.py", line 107, in build_model
    self.build_memory()
  File "C:\Users\verazuo\Desktop\practice\mood\undefined-algorithm\mem_absa-master\model.py", line 82, in build_memory
    att = tf.matmul(a_til_concat, til_bl_3dim, adj_y = True)
TypeError: matmul() got an unexpected keyword argument 'adj_y'

So I delete 'adj_y',now the line has changed like below.

att = tf.matmul(a_til_concat, til_bl_3dim)

This is the Traceback info.

Traceback (most recent call last):
  File "main.py", line 76, in <module>
    tf.app.run()
  File "C:\Users\verazuo\Anaconda3\lib\site-packages\tensorflow\python\platform\app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "main.py", line 72, in main
    model.build_model()
  File "C:\Users\verazuo\Desktop\practice\mood\undefined-algorithm\mem_absa2\model.py", line 107, in build_model
    self.build_memory()
  File "C:\Users\verazuo\Desktop\practice\mood\undefined-algorithm\mem_absa2\model.py", line 82, in build_memory
    att = tf.matmul(a_til_concat, til_bl_3dim)
  File "C:\Users\verazuo\Anaconda3\lib\site-packages\tensorflow\python\ops\math_ops.py", line 1814, in matmul
    a, b, adj_x=adjoint_a, adj_y=adjoint_b, name=name)
  File "C:\Users\verazuo\Anaconda3\lib\site-packages\tensorflow\python\ops\gen_math_ops.py", line 337, in _batch_mat_mul
    adj_y=adj_y, name=name)
  File "C:\Users\verazuo\Anaconda3\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 767, in apply_op
    op_def=op_def)
  File "C:\Users\verazuo\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 2632, in create_op
    set_shapes_for_outputs(ret)
  File "C:\Users\verazuo\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 1911, in set_shapes_for_outputs
    shapes = shape_func(op)
  File "C:\Users\verazuo\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 1861, in call_with_requiring
    return call_cpp_shape_fn(op, require_shape_fn=True)
  File "C:\Users\verazuo\Anaconda3\lib\site-packages\tensorflow\python\framework\common_shapes.py", line 595, in call_cpp_shape_fn
    require_shape_fn)
  File "C:\Users\verazuo\Anaconda3\lib\site-packages\tensorflow\python\framework\common_shapes.py", line 659, in _call_cpp_shape_fn_impl
    raise ValueError(err.message)
ValueError: Dimensions must be equal, but are 100 and 1 for 'MatMul' (op: 'BatchMatMul') with input shapes: [128,78,100], [128,1,100].

Do you have any idea to deal with this error?
Coud you please tell me the develop-environment and configure of your repository?
Thands a lot.

@verazuo
Copy link
Author

verazuo commented Nov 7, 2017

I guess the author used tf0.12, so I try to use a ubuntu16.0.4 machine with tf0.12 and solved the problem, but then I also meet the problem of IndexError: index out of bounds
However, I still want to know how to solve the problem above, do you have any idea?

@jiansonglei
Copy link

'adj_y' of batch_matmul is corresponding to the 'adjoint_b' of matmul.
So, change the code to:

tf.matmul(a_til_concat, til_bl_3dim, adjoint_b = True)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants