MCPcopy Create free account
hub / github.com/deepspeedai/DeepSpeed / dimension_problem

Function dimension_problem

csrc/spatial/csrc/pt_binding.cpp:12–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10#include "spatial_cuda_layers.h"
11
12ChannelsLastProblem dimension_problem(at::Tensor& input)
13{
14 ChannelsLastProblem dims;
15
16 if (input.dim() == 4) {
17 // In some sense this is unsafe (and a reflection of the assumptions made inside
18 // the C10 options checker). Basically, there's no great way to be sure that
19 // a tensor is in channels last because a 1x1 image will appear to be in channels
20 // last even when it isn't.
21 assert(input.is_contiguous(at::MemoryFormat::ChannelsLast));
22 dims.batch_size = input.size(0);
23 dims.seq_len = input.size(2) * input.size(3);
24 dims.channels = input.size(1);
25 } else {
26 assert(input.is_contiguous());
27 dims.batch_size = input.size(0);
28 dims.seq_len = input.size(1);
29 dims.channels = input.size(2);
30 }
31
32 return dims;
33}
34
35at::Tensor seq_unroll_bias_add(at::Tensor& input, at::Tensor& bias)
36{

Callers 3

seq_unroll_bias_addFunction · 0.85
seq_bias_add_addFunction · 0.85
seq_bias_add_bias_addFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected