MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / matmul_shape

Function matmul_shape

tensorflow/python/framework/common_shapes.py:104–115  ·  view source on GitHub ↗

Shape function for a MatMul op.

(op)

Source from the content-addressed store, hash-verified

102
103
104def matmul_shape(op):
105 """Shape function for a MatMul op."""
106 a_shape = op.inputs[0].get_shape().with_rank(2)
107 transpose_a = op.get_attr("transpose_a")
108 b_shape = op.inputs[1].get_shape().with_rank(2)
109 transpose_b = op.get_attr("transpose_b")
110 output_rows = a_shape[1] if transpose_a else a_shape[0]
111 output_cols = b_shape[0] if transpose_b else b_shape[1]
112 inner_a = a_shape[0] if transpose_a else a_shape[1]
113 inner_b = b_shape[1] if transpose_b else b_shape[0]
114 inner_a.assert_is_compatible_with(inner_b)
115 return [tensor_shape.TensorShape([output_rows, output_cols])]
116
117
118def get_conv_output_size(input_size, filter_size, strides, padding_type):

Callers

nothing calls this directly

Calls 4

with_rankMethod · 0.80
get_shapeMethod · 0.45
get_attrMethod · 0.45

Tested by

no test coverage detected