Skip to content

AttributeError: module 'tensorflow' has no attribute 'matrix_band_part' #2

@mahmuduzzaman

Description

@mahmuduzzaman

In this section of code :

# bilinear term
print("Question context shape ",q_cont.shape)
print("final o/p of context ",c_.shape)

logits = BilinearSimilarity(UNITS)(q_cont,c_)
Y_prob = Prediction()(logits)
print("Logits shape ",logits.shape)

I am getting an error

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-192-bcfc5ecf8bbb> in <module>
      4 
      5 logits = BilinearSimilarity(UNITS)(q_cont,c_)
----> 6 Y_prob = Prediction()(logits)
      7 print("Logits shape ",logits.shape)

~/miniconda2/envs/py3/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/base_layer.py in __call__(self, inputs, *args, **kwargs)
    840                     not base_layer_utils.is_in_eager_or_tf_function()):
    841                   with auto_control_deps.AutomaticControlDependencies() as acd:
--> 842                     outputs = call_fn(cast_inputs, *args, **kwargs)
    843                     # Wrap Tensors in `outputs` in `tf.identity` to avoid
    844                     # circular dependencies.

~/miniconda2/envs/py3/lib/python3.7/site-packages/tensorflow_core/python/autograph/impl/api.py in wrapper(*args, **kwargs)
    235       except Exception as e:  # pylint:disable=broad-except
    236         if hasattr(e, 'ag_error_metadata'):
--> 237           raise e.ag_error_metadata.to_exception(e)
    238         else:
    239           raise

AttributeError: in converted code:

    <ipython-input-187-4c90d856d558>:26 call  *
        outer = tf.matrix_band_part(outer, 0, self.token_span)

    AttributeError: module 'tensorflow' has no attribute 'matrix_band_part'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions