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

Function _BroadcastMul

tensorflow/python/ops/nn_grad.py:507–519  ·  view source on GitHub ↗

Multiply after broadcasting vec to match dimensions of mat. Args: vec: A 1-D tensor of dimension [D0] mat: A 2-D tensor of dimension [D0, D1] Returns: A tensor of dimension [D0, D1], the result of vec * mat

(vec, mat)

Source from the content-addressed store, hash-verified

505
506
507def _BroadcastMul(vec, mat):
508 """Multiply after broadcasting vec to match dimensions of mat.
509
510 Args:
511 vec: A 1-D tensor of dimension [D0]
512 mat: A 2-D tensor of dimension [D0, D1]
513
514 Returns:
515 A tensor of dimension [D0, D1], the result of vec * mat
516 """
517 # Reshape vec to [D0, 1]
518 vec = array_ops.expand_dims(vec, -1)
519 return vec * mat
520
521
522@ops.RegisterGradient("SoftmaxCrossEntropyWithLogits")

Calls 1

expand_dimsMethod · 0.45

Tested by

no test coverage detected